File tree Expand file tree Collapse file tree
docs/src/examples/components/Partition Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222 Partition ,
2323 Rect ,
2424 RectClipPath ,
25+ Text ,
2526 Layer ,
2627 findAncestor
2728 } from ' layerchart' ;
141142 height ={nodeHeight }
142143 motion ={{ type : ' tween' , delay : 600 }}
143144 >
144- <text
145+ <Text
146+ segments ={[
147+ {
148+ value: node .data [0 ] ?? ' Overall' ,
149+ class: cls (
150+ ' text-[10px] font-medium' ,
151+ colorBy === ' children'
152+ ? ' fill-primary-content'
153+ : ' fill-black'
154+ ),
155+ },
156+ ... (node .children
157+ ? [
158+ {
159+ value: ` ${format (node .value ?? 0 , ' integer' )} ` ,
160+ class: cls (
161+ ' text-[8px] font-extralight' ,
162+ colorBy === ' children'
163+ ? ' fill-primary-content'
164+ : ' fill-black'
165+ ),
166+ },
167+ ]
168+ : []),
169+ ]}
170+ verticalAnchor =" start"
171+ lineHeight =" 10px"
145172 x ={4 }
146- y ={16 * 0.6 + 4 }
147- class ={cls (
148- ' text-[10px] font-medium' ,
149- colorBy === ' children' ? ' fill-primary-content' : ' fill-black'
150- )}
151- >
152- <tspan >{node .data [0 ] ?? ' Overall' }</tspan >
153- {#if node .children }
154- <tspan
155- class ={cls (
156- ' text-[8px] font-extralight' ,
157- colorBy === ' children' ? ' fill-primary-content' : ' fill-black'
158- )}
159- >
160- {format (node .value ?? 0 , ' integer' )}
161- </tspan >
162- {/if }
163- </text >
173+ y ={3.6 }
174+ />
164175 </RectClipPath >
165176 </Group >
166177 </g >
Original file line number Diff line number Diff line change 2323 Rect ,
2424 RectClipPath ,
2525 Layer ,
26+ Text ,
2627 findAncestor
2728 } from ' layerchart' ;
2829 import { Breadcrumb , Button } from ' svelte-ux' ;
119120 fill ={nodeColor }
120121 rx ={5 }
121122 />
122- <text
123+ <Text
124+ segments ={[
125+ {
126+ value: node .data .name ,
127+ class: cls (
128+ ' text-[10px] font-medium' ,
129+ colorBy === ' children'
130+ ? ' fill-primary-content'
131+ : ' fill-black'
132+ ),
133+ },
134+ {
135+ value: ` ${format (node .value ?? 0 , ' integer' )} ` ,
136+ class: cls (
137+ ' text-[8px] font-extralight' ,
138+ colorBy === ' children'
139+ ? ' fill-primary-content'
140+ : ' fill-black'
141+ ),
142+ },
143+ ]}
144+ verticalAnchor =" start"
145+ lineHeight =" 10px"
123146 x ={4 }
124- y ={16 * 0.6 + 4 }
125- class ={cls (
126- ' text-[10px] font-medium' ,
127- colorBy === ' children' ? ' fill-primary-content' : ' fill-black'
128- )}
129- >
130- <tspan >{node .data .name }</tspan >
131- <tspan
132- class ={cls (
133- ' text-[8px] font-extralight' ,
134- colorBy === ' children' ? ' fill-primary-content' : ' fill-black'
135- )}
136- >
137- {format (node .value ?? 0 , ' integer' )}
138- </tspan >
139- </text >
147+ y ={3.6 }
148+ />
140149 </g >
141150 </RectClipPath >
142151 </Group >
You can’t perform that action at this time.
0 commit comments