layerchart 2.0.0-next.50 → 2.0.0-next.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Axis.svelte +25 -0
- package/dist/components/Axis.svelte.d.ts +10 -0
- package/dist/components/Circle.svelte +82 -59
- package/dist/components/Ellipse.svelte +83 -64
- package/dist/components/GeoRaster.svelte +311 -0
- package/dist/components/GeoRaster.svelte.d.ts +61 -0
- package/dist/components/Grid.svelte +15 -0
- package/dist/components/Grid.svelte.d.ts +5 -0
- package/dist/components/Image.svelte +2 -2
- package/dist/components/Line.svelte +82 -62
- package/dist/components/Points.svelte +2 -2
- package/dist/components/Polygon.svelte +92 -56
- package/dist/components/Rect.svelte +113 -64
- package/dist/components/Rule.svelte +2 -0
- package/dist/components/Sankey.svelte +0 -2
- package/dist/components/Text.svelte +83 -52
- package/dist/components/charts/PieChart.svelte +2 -2
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/layers/Canvas.svelte +65 -48
- package/dist/components/layers/Canvas.svelte.d.ts +10 -0
- package/dist/contexts/canvas.d.ts +3 -0
- package/dist/server/ContextCapture.svelte +30 -0
- package/dist/server/ContextCapture.svelte.d.ts +8 -0
- package/dist/server/ServerChart.svelte +26 -0
- package/dist/server/ServerChart.svelte.d.ts +11 -0
- package/dist/server/TestBarChart.svelte +35 -0
- package/dist/server/TestBarChart.svelte.d.ts +14 -0
- package/dist/server/TestLineChart.svelte +35 -0
- package/dist/server/TestLineChart.svelte.d.ts +14 -0
- package/dist/server/captureStore.d.ts +8 -0
- package/dist/server/captureStore.js +18 -0
- package/dist/server/index.d.ts +137 -0
- package/dist/server/index.js +141 -0
- package/dist/server/renderChart.ssr.test.d.ts +1 -0
- package/dist/server/renderChart.ssr.test.js +205 -0
- package/dist/server/renderTree.d.ts +8 -0
- package/dist/server/renderTree.js +29 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-geo-projection-skips-markInfo-should-not-derive-x-y-accessors-from-marks-when-geo-projection-is-active-1.png +0 -0
- package/dist/states/__screenshots__/chart.svelte.test.ts/ChartState-geo-projection-skips-markInfo-should-not-derive-x-y-accessors-from-marks-when-geo-projection-is-active-2.png +0 -0
- package/dist/states/chart.svelte.d.ts +5 -1
- package/dist/states/chart.svelte.js +18 -3
- package/dist/states/chart.svelte.test.js +110 -0
- package/dist/states/geo.svelte.d.ts +5 -1
- package/dist/states/geo.svelte.js +80 -68
- package/dist/utils/canvas.js +29 -10
- package/dist/utils/canvas.svelte.test.js +2 -2
- package/dist/utils/motion.svelte.js +14 -0
- package/package.json +7 -1
|
@@ -101,6 +101,18 @@
|
|
|
101
101
|
*/
|
|
102
102
|
scale?: any;
|
|
103
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Stroke color for axis rule, grid lines, and tick marks.
|
|
106
|
+
* Useful for server-side rendering where CSS variables are not available.
|
|
107
|
+
*/
|
|
108
|
+
stroke?: string;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Fill color for tick labels and axis label.
|
|
112
|
+
* Useful for server-side rendering where CSS variables are not available.
|
|
113
|
+
*/
|
|
114
|
+
fill?: string;
|
|
115
|
+
|
|
104
116
|
/**
|
|
105
117
|
* Classes for styling various parts of the axis
|
|
106
118
|
* @default {}
|
|
@@ -156,6 +168,8 @@
|
|
|
156
168
|
tickMarks = true,
|
|
157
169
|
format,
|
|
158
170
|
tickLabelProps,
|
|
171
|
+
stroke,
|
|
172
|
+
fill,
|
|
159
173
|
motion,
|
|
160
174
|
transitionIn,
|
|
161
175
|
transitionInParams,
|
|
@@ -168,6 +182,8 @@
|
|
|
168
182
|
|
|
169
183
|
const ctx = getChartContext();
|
|
170
184
|
|
|
185
|
+
ctx.registerComponent({ name: 'Axis', kind: 'composite-mark' });
|
|
186
|
+
|
|
171
187
|
const orientation = $derived(
|
|
172
188
|
placement === 'angle'
|
|
173
189
|
? 'angle'
|
|
@@ -465,6 +481,8 @@
|
|
|
465
481
|
// complement 10px text (until Text supports custom styles)
|
|
466
482
|
capHeight: '7px',
|
|
467
483
|
lineHeight: '11px',
|
|
484
|
+
fill,
|
|
485
|
+
stroke,
|
|
468
486
|
...labelProps,
|
|
469
487
|
class: cls('lc-axis-label', classes.label, labelProps?.class),
|
|
470
488
|
}) satisfies ComponentProps<typeof Text>;
|
|
@@ -479,6 +497,7 @@
|
|
|
479
497
|
<Rule
|
|
480
498
|
x={placement === 'left' ? '$left' : placement === 'right' ? '$right' : placement === 'angle'}
|
|
481
499
|
y={placement === 'top' ? '$top' : placement === 'bottom' ? '$bottom' : placement === 'radius'}
|
|
500
|
+
{stroke}
|
|
482
501
|
{motion}
|
|
483
502
|
{...extractLayerProps(rule, 'lc-axis-rule', classes.rule ?? '')}
|
|
484
503
|
/>
|
|
@@ -506,6 +525,8 @@
|
|
|
506
525
|
// complement 10px text (until Text supports custom styles)
|
|
507
526
|
capHeight: '7px',
|
|
508
527
|
lineHeight: '11px',
|
|
528
|
+
fill,
|
|
529
|
+
stroke,
|
|
509
530
|
...tickLabelProps,
|
|
510
531
|
class: cls('lc-axis-tick-label', classes.tickLabel, tickLabelProps?.class),
|
|
511
532
|
}}
|
|
@@ -515,6 +536,7 @@
|
|
|
515
536
|
<Rule
|
|
516
537
|
x={orientation === 'horizontal' || orientation === 'angle' ? tick : false}
|
|
517
538
|
y={orientation === 'vertical' || orientation === 'radius' ? tick : false}
|
|
539
|
+
{stroke}
|
|
518
540
|
{motion}
|
|
519
541
|
{...extractLayerProps(grid, 'lc-axis-grid', classes.rule ?? '')}
|
|
520
542
|
/>
|
|
@@ -528,6 +550,7 @@
|
|
|
528
550
|
y1={tickCoords.y}
|
|
529
551
|
x2={tickCoords.x}
|
|
530
552
|
y2={tickCoords.y + (placement === 'top' ? -tickLength : tickLength)}
|
|
553
|
+
{stroke}
|
|
531
554
|
{motion}
|
|
532
555
|
class={tickClasses}
|
|
533
556
|
/>
|
|
@@ -537,6 +560,7 @@
|
|
|
537
560
|
y1={tickCoords.y}
|
|
538
561
|
x2={tickCoords.x + (placement === 'left' ? -tickLength : tickLength)}
|
|
539
562
|
y2={tickCoords.y}
|
|
563
|
+
{stroke}
|
|
540
564
|
{motion}
|
|
541
565
|
class={tickClasses}
|
|
542
566
|
/>
|
|
@@ -546,6 +570,7 @@
|
|
|
546
570
|
y1={radialTickCoordsY}
|
|
547
571
|
x2={radialTickMarkCoordsX}
|
|
548
572
|
y2={radialTickMarkCoordsY}
|
|
573
|
+
{stroke}
|
|
549
574
|
{motion}
|
|
550
575
|
class={tickClasses}
|
|
551
576
|
/>
|
|
@@ -87,6 +87,16 @@ export type AxisPropsWithoutHTML<In extends Transition = Transition> = {
|
|
|
87
87
|
* Override scale for the axis
|
|
88
88
|
*/
|
|
89
89
|
scale?: any;
|
|
90
|
+
/**
|
|
91
|
+
* Stroke color for axis rule, grid lines, and tick marks.
|
|
92
|
+
* Useful for server-side rendering where CSS variables are not available.
|
|
93
|
+
*/
|
|
94
|
+
stroke?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Fill color for tick labels and axis label.
|
|
97
|
+
* Useful for server-side rendering where CSS variables are not available.
|
|
98
|
+
*/
|
|
99
|
+
fill?: string;
|
|
90
100
|
/**
|
|
91
101
|
* Classes for styling various parts of the axis
|
|
92
102
|
* @default {}
|
|
@@ -95,7 +95,13 @@
|
|
|
95
95
|
import { untrack } from 'svelte';
|
|
96
96
|
import { createMotion, createDataMotionMap, type MotionProp } from '../utils/motion.svelte.js';
|
|
97
97
|
import { renderCircle, type ComputedStylesOptions } from '../utils/canvas.js';
|
|
98
|
-
import {
|
|
98
|
+
import {
|
|
99
|
+
hasAnyDataProp,
|
|
100
|
+
resolveDataProp,
|
|
101
|
+
resolveColorProp,
|
|
102
|
+
resolveGeoDataPair,
|
|
103
|
+
resolveStyleProp,
|
|
104
|
+
} from '../utils/dataProp.js';
|
|
99
105
|
import { getGeoContext } from '../contexts/geo.js';
|
|
100
106
|
import { chartDataArray } from '../utils/common.js';
|
|
101
107
|
import type { SVGAttributes } from 'svelte/elements';
|
|
@@ -130,9 +136,7 @@
|
|
|
130
136
|
const geo = getGeoContext();
|
|
131
137
|
|
|
132
138
|
// Data to iterate over in data mode
|
|
133
|
-
const resolvedData: any[] = $derived(
|
|
134
|
-
dataMode ? (dataProp ?? chartDataArray(chartCtx.data)) : []
|
|
135
|
-
);
|
|
139
|
+
const resolvedData: any[] = $derived(dataMode ? (dataProp ?? chartDataArray(chartCtx.data)) : []);
|
|
136
140
|
|
|
137
141
|
// Resolve a single data item to pixel coordinates
|
|
138
142
|
function resolveCircle(d: any) {
|
|
@@ -201,21 +205,16 @@
|
|
|
201
205
|
|
|
202
206
|
const layerCtx = getLayerContext();
|
|
203
207
|
|
|
204
|
-
const motionCx = createMotion(
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
);
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
);
|
|
214
|
-
const motionR = createMotion(
|
|
215
|
-
initialR,
|
|
216
|
-
() => (typeof r === 'number' ? r : 1),
|
|
217
|
-
motion
|
|
218
|
-
);
|
|
208
|
+
const motionCx = createMotion(initialCx, () => (typeof cx === 'number' ? cx : 0), motion);
|
|
209
|
+
const motionCy = createMotion(initialCy, () => (typeof cy === 'number' ? cy : 0), motion);
|
|
210
|
+
const motionR = createMotion(initialR, () => (typeof r === 'number' ? r : 1), motion);
|
|
211
|
+
|
|
212
|
+
const staticFill = $derived(typeof fill === 'string' ? fill : undefined);
|
|
213
|
+
const staticFillOpacity = $derived(typeof fillOpacity === 'number' ? fillOpacity : undefined);
|
|
214
|
+
const staticStroke = $derived(typeof stroke === 'string' ? stroke : undefined);
|
|
215
|
+
const staticStrokeWidth = $derived(typeof strokeWidth === 'number' ? strokeWidth : undefined);
|
|
216
|
+
const staticOpacity = $derived(typeof opacity === 'number' ? opacity : undefined);
|
|
217
|
+
const staticClassName = $derived(typeof className === 'string' ? className : undefined);
|
|
219
218
|
|
|
220
219
|
// Style options (shared between pixel and data mode)
|
|
221
220
|
function getStyleOptions(
|
|
@@ -228,16 +227,29 @@
|
|
|
228
227
|
itemClass?: string | undefined
|
|
229
228
|
) {
|
|
230
229
|
return styleOverrides
|
|
231
|
-
? merge(
|
|
230
|
+
? merge(
|
|
231
|
+
{
|
|
232
|
+
styles: {
|
|
233
|
+
strokeWidth:
|
|
234
|
+
itemStrokeWidth ?? (typeof strokeWidth === 'number' ? strokeWidth : undefined),
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
styleOverrides
|
|
238
|
+
)
|
|
232
239
|
: {
|
|
233
240
|
styles: {
|
|
234
241
|
fill: itemFill ?? fill,
|
|
235
|
-
fillOpacity:
|
|
242
|
+
fillOpacity:
|
|
243
|
+
itemFillOpacity ?? (typeof fillOpacity === 'number' ? fillOpacity : undefined),
|
|
236
244
|
stroke: itemStroke ?? stroke,
|
|
237
|
-
strokeWidth:
|
|
245
|
+
strokeWidth:
|
|
246
|
+
itemStrokeWidth ?? (typeof strokeWidth === 'number' ? strokeWidth : undefined),
|
|
238
247
|
opacity: itemOpacity ?? (typeof opacity === 'number' ? opacity : undefined),
|
|
239
248
|
},
|
|
240
|
-
classes: cls(
|
|
249
|
+
classes: cls(
|
|
250
|
+
'lc-circle',
|
|
251
|
+
itemClass ?? (typeof className === 'string' ? className : undefined)
|
|
252
|
+
),
|
|
241
253
|
style: restProps.style as string | undefined,
|
|
242
254
|
};
|
|
243
255
|
}
|
|
@@ -254,7 +266,15 @@
|
|
|
254
266
|
const resolvedStrokeWidth = resolveStyleProp(strokeWidth, item.d);
|
|
255
267
|
const resolvedOpacity = resolveStyleProp(opacity, item.d);
|
|
256
268
|
const resolvedClass = resolveStyleProp(className, item.d);
|
|
257
|
-
const styleOpts = getStyleOptions(
|
|
269
|
+
const styleOpts = getStyleOptions(
|
|
270
|
+
styleOverrides,
|
|
271
|
+
resolvedFill,
|
|
272
|
+
resolvedStroke,
|
|
273
|
+
resolvedFillOpacity,
|
|
274
|
+
resolvedStrokeWidth,
|
|
275
|
+
resolvedOpacity,
|
|
276
|
+
resolvedClass
|
|
277
|
+
);
|
|
258
278
|
renderCircle(ctx, item, styleOpts);
|
|
259
279
|
}
|
|
260
280
|
} else {
|
|
@@ -284,30 +304,33 @@
|
|
|
284
304
|
color: typeof fill === 'string' ? fill : undefined,
|
|
285
305
|
};
|
|
286
306
|
},
|
|
287
|
-
canvasRender:
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
307
|
+
canvasRender:
|
|
308
|
+
layerCtx === 'canvas'
|
|
309
|
+
? {
|
|
310
|
+
render,
|
|
311
|
+
events: {
|
|
312
|
+
click: restProps.onclick,
|
|
313
|
+
pointerdown: restProps.onpointerdown,
|
|
314
|
+
pointerenter: restProps.onpointerenter,
|
|
315
|
+
pointermove: restProps.onpointermove,
|
|
316
|
+
pointerleave: restProps.onpointerleave,
|
|
317
|
+
},
|
|
318
|
+
deps: () => [
|
|
319
|
+
dataMode,
|
|
320
|
+
dataMode ? resolvedItems : null,
|
|
321
|
+
motionCx.current,
|
|
322
|
+
motionCy.current,
|
|
323
|
+
motionR.current,
|
|
324
|
+
fillKey!.current,
|
|
325
|
+
fillOpacity,
|
|
326
|
+
strokeKey!.current,
|
|
327
|
+
strokeWidth,
|
|
328
|
+
opacity,
|
|
329
|
+
className,
|
|
330
|
+
restProps.style,
|
|
331
|
+
],
|
|
332
|
+
}
|
|
333
|
+
: undefined,
|
|
311
334
|
});
|
|
312
335
|
</script>
|
|
313
336
|
|
|
@@ -339,12 +362,12 @@
|
|
|
339
362
|
cx={motionCx.current}
|
|
340
363
|
cy={motionCy.current}
|
|
341
364
|
r={motionR.current}
|
|
342
|
-
fill={
|
|
343
|
-
fill-opacity={
|
|
344
|
-
stroke={
|
|
345
|
-
stroke-width={
|
|
346
|
-
opacity={
|
|
347
|
-
class={cls('lc-circle',
|
|
365
|
+
fill={staticFill}
|
|
366
|
+
fill-opacity={staticFillOpacity}
|
|
367
|
+
stroke={staticStroke}
|
|
368
|
+
stroke-width={staticStrokeWidth}
|
|
369
|
+
opacity={staticOpacity}
|
|
370
|
+
class={cls('lc-circle', staticClassName)}
|
|
348
371
|
{...restProps}
|
|
349
372
|
/>
|
|
350
373
|
{/if}
|
|
@@ -382,13 +405,13 @@
|
|
|
382
405
|
style:width="{motionR.current * 2}px"
|
|
383
406
|
style:height="{motionR.current * 2}px"
|
|
384
407
|
style:border-radius="50%"
|
|
385
|
-
style:background-color={
|
|
386
|
-
style:opacity={
|
|
387
|
-
style:border-width={
|
|
388
|
-
style:border-color={
|
|
408
|
+
style:background-color={staticFill}
|
|
409
|
+
style:opacity={staticOpacity}
|
|
410
|
+
style:border-width={staticStrokeWidth}
|
|
411
|
+
style:border-color={staticStroke}
|
|
389
412
|
style:border-style="solid"
|
|
390
413
|
style:transform="translate(-50%, -50%)"
|
|
391
|
-
class={cls('lc-circle',
|
|
414
|
+
class={cls('lc-circle', staticClassName)}
|
|
392
415
|
{...restProps}
|
|
393
416
|
>
|
|
394
417
|
{@render children?.()}
|
|
@@ -108,7 +108,13 @@
|
|
|
108
108
|
import { getChartContext } from '../contexts/chart.js';
|
|
109
109
|
import { createMotion, createDataMotionMap, type MotionProp } from '../utils/motion.svelte.js';
|
|
110
110
|
import { renderEllipse, type ComputedStylesOptions } from '../utils/canvas.js';
|
|
111
|
-
import {
|
|
111
|
+
import {
|
|
112
|
+
hasAnyDataProp,
|
|
113
|
+
resolveDataProp,
|
|
114
|
+
resolveColorProp,
|
|
115
|
+
resolveGeoDataPair,
|
|
116
|
+
resolveStyleProp,
|
|
117
|
+
} from '../utils/dataProp.js';
|
|
112
118
|
import { getGeoContext } from '../contexts/geo.js';
|
|
113
119
|
import { chartDataArray } from '../utils/common.js';
|
|
114
120
|
import type { SVGAttributes } from 'svelte/elements';
|
|
@@ -144,9 +150,7 @@
|
|
|
144
150
|
const geo = getGeoContext();
|
|
145
151
|
|
|
146
152
|
// Data to iterate over in data mode
|
|
147
|
-
const resolvedData: any[] = $derived(
|
|
148
|
-
dataMode ? (dataProp ?? chartDataArray(chartCtx.data)) : []
|
|
149
|
-
);
|
|
153
|
+
const resolvedData: any[] = $derived(dataMode ? (dataProp ?? chartDataArray(chartCtx.data)) : []);
|
|
150
154
|
|
|
151
155
|
// Resolve a single data item to pixel coordinates
|
|
152
156
|
function resolveEllipse(d: any) {
|
|
@@ -217,26 +221,10 @@
|
|
|
217
221
|
|
|
218
222
|
const layerCtx = getLayerContext();
|
|
219
223
|
|
|
220
|
-
const motionCx = createMotion(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
);
|
|
225
|
-
const motionCy = createMotion(
|
|
226
|
-
initialCy,
|
|
227
|
-
() => (typeof cy === 'number' ? cy : 0),
|
|
228
|
-
motion
|
|
229
|
-
);
|
|
230
|
-
const motionRx = createMotion(
|
|
231
|
-
initialRx,
|
|
232
|
-
() => (typeof rx === 'number' ? rx : 1),
|
|
233
|
-
motion
|
|
234
|
-
);
|
|
235
|
-
const motionRy = createMotion(
|
|
236
|
-
initialRy,
|
|
237
|
-
() => (typeof ry === 'number' ? ry : 1),
|
|
238
|
-
motion
|
|
239
|
-
);
|
|
224
|
+
const motionCx = createMotion(initialCx, () => (typeof cx === 'number' ? cx : 0), motion);
|
|
225
|
+
const motionCy = createMotion(initialCy, () => (typeof cy === 'number' ? cy : 0), motion);
|
|
226
|
+
const motionRx = createMotion(initialRx, () => (typeof rx === 'number' ? rx : 1), motion);
|
|
227
|
+
const motionRy = createMotion(initialRy, () => (typeof ry === 'number' ? ry : 1), motion);
|
|
240
228
|
|
|
241
229
|
function getStyleOptions(
|
|
242
230
|
styleOverrides: ComputedStylesOptions | undefined,
|
|
@@ -248,16 +236,29 @@
|
|
|
248
236
|
itemClass?: string | undefined
|
|
249
237
|
) {
|
|
250
238
|
return styleOverrides
|
|
251
|
-
? merge(
|
|
239
|
+
? merge(
|
|
240
|
+
{
|
|
241
|
+
styles: {
|
|
242
|
+
strokeWidth:
|
|
243
|
+
itemStrokeWidth ?? (typeof strokeWidth === 'number' ? strokeWidth : undefined),
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
styleOverrides
|
|
247
|
+
)
|
|
252
248
|
: {
|
|
253
249
|
styles: {
|
|
254
250
|
fill: itemFill ?? fill,
|
|
255
|
-
fillOpacity:
|
|
251
|
+
fillOpacity:
|
|
252
|
+
itemFillOpacity ?? (typeof fillOpacity === 'number' ? fillOpacity : undefined),
|
|
256
253
|
stroke: itemStroke ?? stroke,
|
|
257
|
-
strokeWidth:
|
|
254
|
+
strokeWidth:
|
|
255
|
+
itemStrokeWidth ?? (typeof strokeWidth === 'number' ? strokeWidth : undefined),
|
|
258
256
|
opacity: itemOpacity ?? (typeof opacity === 'number' ? opacity : undefined),
|
|
259
257
|
},
|
|
260
|
-
classes: cls(
|
|
258
|
+
classes: cls(
|
|
259
|
+
'lc-ellipse',
|
|
260
|
+
itemClass ?? (typeof className === 'string' ? className : undefined)
|
|
261
|
+
),
|
|
261
262
|
};
|
|
262
263
|
}
|
|
263
264
|
|
|
@@ -273,7 +274,15 @@
|
|
|
273
274
|
const resolvedStrokeWidth = resolveStyleProp(strokeWidth, item.d);
|
|
274
275
|
const resolvedOpacity = resolveStyleProp(opacity, item.d);
|
|
275
276
|
const resolvedClass = resolveStyleProp(className, item.d);
|
|
276
|
-
const styleOpts = getStyleOptions(
|
|
277
|
+
const styleOpts = getStyleOptions(
|
|
278
|
+
styleOverrides,
|
|
279
|
+
resolvedFill,
|
|
280
|
+
resolvedStroke,
|
|
281
|
+
resolvedFillOpacity,
|
|
282
|
+
resolvedStrokeWidth,
|
|
283
|
+
resolvedOpacity,
|
|
284
|
+
resolvedClass
|
|
285
|
+
);
|
|
277
286
|
renderEllipse(ctx, item, styleOpts);
|
|
278
287
|
}
|
|
279
288
|
} else {
|
|
@@ -295,6 +304,13 @@
|
|
|
295
304
|
const fillKey = layerCtx === 'canvas' ? createKey(() => fill) : undefined;
|
|
296
305
|
const strokeKey = layerCtx === 'canvas' ? createKey(() => stroke) : undefined;
|
|
297
306
|
|
|
307
|
+
const staticFill = $derived(typeof fill === 'string' ? fill : undefined);
|
|
308
|
+
const staticFillOpacity = $derived(typeof fillOpacity === 'number' ? fillOpacity : undefined);
|
|
309
|
+
const staticStroke = $derived(typeof stroke === 'string' ? stroke : undefined);
|
|
310
|
+
const staticStrokeWidth = $derived(typeof strokeWidth === 'number' ? strokeWidth : undefined);
|
|
311
|
+
const staticOpacity = $derived(typeof opacity === 'number' ? opacity : undefined);
|
|
312
|
+
const staticClassName = $derived(typeof className === 'string' ? className : undefined);
|
|
313
|
+
|
|
298
314
|
chartCtx.registerComponent({
|
|
299
315
|
name: 'Ellipse',
|
|
300
316
|
kind: 'mark',
|
|
@@ -307,30 +323,33 @@
|
|
|
307
323
|
color: typeof fill === 'string' ? fill : typeof stroke === 'string' ? stroke : undefined,
|
|
308
324
|
};
|
|
309
325
|
},
|
|
310
|
-
canvasRender:
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
326
|
+
canvasRender:
|
|
327
|
+
layerCtx === 'canvas'
|
|
328
|
+
? {
|
|
329
|
+
render,
|
|
330
|
+
events: {
|
|
331
|
+
click: restProps.onclick,
|
|
332
|
+
pointerdown: restProps.onpointerdown,
|
|
333
|
+
pointerenter: restProps.onpointerenter,
|
|
334
|
+
pointermove: restProps.onpointermove,
|
|
335
|
+
pointerleave: restProps.onpointerleave,
|
|
336
|
+
},
|
|
337
|
+
deps: () => [
|
|
338
|
+
dataMode,
|
|
339
|
+
dataMode ? resolvedItems : null,
|
|
340
|
+
motionCx.current,
|
|
341
|
+
motionCy.current,
|
|
342
|
+
motionRx.current,
|
|
343
|
+
motionRy.current,
|
|
344
|
+
fillKey!.current,
|
|
345
|
+
fillOpacity,
|
|
346
|
+
strokeKey!.current,
|
|
347
|
+
strokeWidth,
|
|
348
|
+
opacity,
|
|
349
|
+
className,
|
|
350
|
+
],
|
|
351
|
+
}
|
|
352
|
+
: undefined,
|
|
334
353
|
});
|
|
335
354
|
</script>
|
|
336
355
|
|
|
@@ -364,12 +383,12 @@
|
|
|
364
383
|
cy={motionCy.current}
|
|
365
384
|
rx={motionRx.current}
|
|
366
385
|
ry={motionRy.current}
|
|
367
|
-
fill={
|
|
368
|
-
fill-opacity={
|
|
369
|
-
stroke={
|
|
370
|
-
stroke-width={
|
|
371
|
-
opacity={
|
|
372
|
-
class={cls('lc-ellipse',
|
|
386
|
+
fill={staticFill}
|
|
387
|
+
fill-opacity={staticFillOpacity}
|
|
388
|
+
stroke={staticStroke}
|
|
389
|
+
stroke-width={staticStrokeWidth}
|
|
390
|
+
opacity={staticOpacity}
|
|
391
|
+
class={cls('lc-ellipse', staticClassName)}
|
|
373
392
|
{...restProps}
|
|
374
393
|
/>
|
|
375
394
|
{/if}
|
|
@@ -407,13 +426,13 @@
|
|
|
407
426
|
style:width="{motionRx.current * 2}px"
|
|
408
427
|
style:height="{motionRy.current * 2}px"
|
|
409
428
|
style:border-radius="50%"
|
|
410
|
-
style:background-color={
|
|
411
|
-
style:opacity={
|
|
412
|
-
style:border-width={
|
|
413
|
-
style:border-color={
|
|
429
|
+
style:background-color={staticFill}
|
|
430
|
+
style:opacity={staticOpacity}
|
|
431
|
+
style:border-width={staticStrokeWidth}
|
|
432
|
+
style:border-color={staticStroke}
|
|
414
433
|
style:border-style="solid"
|
|
415
434
|
style:transform="translate(-50%, -50%)"
|
|
416
|
-
class={cls('lc-ellipse',
|
|
435
|
+
class={cls('lc-ellipse', staticClassName)}
|
|
417
436
|
{...restProps}
|
|
418
437
|
></div>
|
|
419
438
|
{/if}
|