layerchart 0.53.0 → 0.54.1
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/Arc.svelte +170 -144
- package/dist/components/Area.svelte +96 -67
- package/dist/components/Area.svelte.d.ts +1 -0
- package/dist/components/Axis.svelte +241 -234
- package/dist/components/Axis.svelte.d.ts +2 -1
- package/dist/components/Bar.svelte +72 -45
- package/dist/components/Bars.svelte +46 -34
- package/dist/components/Bars.svelte.d.ts +1 -0
- package/dist/components/Blur.svelte +5 -3
- package/dist/components/Bounds.svelte +37 -21
- package/dist/components/Brush.svelte +181 -110
- package/dist/components/Calendar.svelte +51 -38
- package/dist/components/Chart.svelte +296 -73
- package/dist/components/Chart.svelte.d.ts +42 -25
- package/dist/components/ChartClipPath.svelte +8 -5
- package/dist/components/ChartContext.svelte +243 -93
- package/dist/components/ChartContext.svelte.d.ts +15 -23
- package/dist/components/Circle.svelte +25 -16
- package/dist/components/CircleClipPath.svelte +16 -10
- package/dist/components/ClipPath.svelte +11 -7
- package/dist/components/ColorRamp.svelte +12 -10
- package/dist/components/ForceSimulation.svelte +185 -116
- package/dist/components/Frame.svelte +10 -6
- package/dist/components/GeoCircle.svelte +15 -9
- package/dist/components/GeoContext.svelte +109 -62
- package/dist/components/GeoEdgeFade.svelte +20 -14
- package/dist/components/GeoPath.svelte +107 -69
- package/dist/components/GeoPoint.svelte +32 -18
- package/dist/components/GeoSpline.svelte +30 -22
- package/dist/components/GeoTile.svelte +40 -30
- package/dist/components/GeoVisible.svelte +10 -7
- package/dist/components/Graticule.svelte +14 -8
- package/dist/components/Grid.svelte +178 -0
- package/dist/components/Grid.svelte.d.ts +35 -0
- package/dist/components/Group.svelte +43 -31
- package/dist/components/Highlight.svelte +284 -243
- package/dist/components/HitCanvas.svelte +75 -42
- package/dist/components/Hull.svelte +40 -20
- package/dist/components/Labels.svelte +84 -63
- package/dist/components/Labels.svelte.d.ts +2 -0
- package/dist/components/Legend.svelte +106 -75
- package/dist/components/Legend.svelte.d.ts +1 -1
- package/dist/components/Line.svelte +29 -19
- package/dist/components/LinearGradient.svelte +21 -15
- package/dist/components/Link.svelte +44 -22
- package/dist/components/MonthPath.svelte +23 -16
- package/dist/components/MotionPath.svelte +34 -25
- package/dist/components/Pack.svelte +21 -14
- package/dist/components/Partition.svelte +35 -20
- package/dist/components/Pattern.svelte +8 -6
- package/dist/components/Pie.svelte +76 -57
- package/dist/components/Point.svelte +11 -7
- package/dist/components/Points.svelte +178 -143
- package/dist/components/RadialGradient.svelte +25 -18
- package/dist/components/Rect.svelte +33 -19
- package/dist/components/RectClipPath.svelte +16 -11
- package/dist/components/Rule.svelte +66 -42
- package/dist/components/Rule.svelte.d.ts +2 -0
- package/dist/components/Sankey.svelte +55 -30
- package/dist/components/Spline.svelte +118 -96
- package/dist/components/Text.svelte +137 -104
- package/dist/components/Threshold.svelte +18 -7
- package/dist/components/TileImage.svelte +56 -50
- package/dist/components/TransformContext.svelte +238 -136
- package/dist/components/TransformControls.svelte +57 -29
- package/dist/components/TransformControls.svelte.d.ts +1 -1
- package/dist/components/Tree.svelte +33 -23
- package/dist/components/Treemap.svelte +69 -41
- package/dist/components/Voronoi.svelte +55 -28
- package/dist/components/charts/AreaChart.svelte +162 -87
- package/dist/components/charts/AreaChart.svelte.d.ts +41 -3
- package/dist/components/charts/BarChart.svelte +207 -108
- package/dist/components/charts/BarChart.svelte.d.ts +41 -3
- package/dist/components/charts/LineChart.svelte +119 -47
- package/dist/components/charts/LineChart.svelte.d.ts +41 -3
- package/dist/components/charts/PieChart.svelte +117 -53
- package/dist/components/charts/PieChart.svelte.d.ts +17 -2
- package/dist/components/charts/ScatterChart.svelte +92 -42
- package/dist/components/charts/ScatterChart.svelte.d.ts +39 -3
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/layout/Canvas.svelte +63 -43
- package/dist/components/layout/Html.svelte +28 -18
- package/dist/components/layout/Svg.svelte +47 -32
- package/dist/components/tooltip/Tooltip.svelte +143 -82
- package/dist/components/tooltip/Tooltip.svelte.d.ts +1 -1
- package/dist/components/tooltip/TooltipContext.svelte +315 -248
- package/dist/components/tooltip/TooltipContext.svelte.d.ts +7 -0
- package/dist/components/tooltip/TooltipHeader.svelte +9 -3
- package/dist/components/tooltip/TooltipItem.svelte +17 -9
- package/dist/components/tooltip/TooltipList.svelte +2 -1
- package/dist/components/tooltip/TooltipSeparator.svelte +3 -2
- package/dist/docs/Blockquote.svelte +4 -3
- package/dist/docs/Code.svelte +15 -8
- package/dist/docs/CurveMenuField.svelte +17 -12
- package/dist/docs/GeoDebug.svelte +13 -9
- package/dist/docs/Header1.svelte +2 -1
- package/dist/docs/Json.svelte +6 -4
- package/dist/docs/Layout.svelte +6 -6
- package/dist/docs/PathDataMenuField.svelte +52 -44
- package/dist/docs/Preview.svelte +48 -29
- package/dist/docs/TilesetField.svelte +80 -62
- package/dist/docs/TransformDebug.svelte +8 -5
- package/dist/docs/ViewSourceButton.svelte +13 -9
- package/dist/stores/motionStore.d.ts +1 -1
- package/dist/utils/scales.d.ts +4 -4
- package/package.json +29 -30
|
@@ -1,93 +1,178 @@
|
|
|
1
|
-
<script generics="TData">
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
<script lang="ts" generics="TData">
|
|
2
|
+
import { type ComponentProps } from 'svelte';
|
|
3
|
+
import { scaleBand, scaleOrdinal, scaleLinear } from 'd3-scale';
|
|
4
|
+
import { stack, stackOffsetDiverging, stackOffsetExpand, stackOffsetNone } from 'd3-shape';
|
|
5
|
+
import { sum } from 'd3-array';
|
|
6
|
+
import { format } from '@layerstack/utils';
|
|
7
|
+
|
|
8
|
+
import Axis from '../Axis.svelte';
|
|
9
|
+
import Bars from '../Bars.svelte';
|
|
10
|
+
import Chart from '../Chart.svelte';
|
|
11
|
+
import Grid from '../Grid.svelte';
|
|
12
|
+
import Highlight from '../Highlight.svelte';
|
|
13
|
+
import Labels from '../Labels.svelte';
|
|
14
|
+
import Legend from '../Legend.svelte';
|
|
15
|
+
import Rule from '../Rule.svelte';
|
|
16
|
+
import Svg from '../layout/Svg.svelte';
|
|
17
|
+
import * as Tooltip from '../tooltip/index.js';
|
|
18
|
+
|
|
19
|
+
import { accessor, chartDataArray, type Accessor } from '../../utils/common.js';
|
|
20
|
+
|
|
21
|
+
type ChartProps = ComponentProps<Chart<TData>>;
|
|
22
|
+
|
|
23
|
+
interface $$Props extends ChartProps {
|
|
24
|
+
axis?: typeof axis;
|
|
25
|
+
grid?: typeof grid;
|
|
26
|
+
bandPadding?: typeof bandPadding;
|
|
27
|
+
groupPadding?: typeof groupPadding;
|
|
28
|
+
labels?: typeof labels;
|
|
29
|
+
legend?: typeof legend;
|
|
30
|
+
orientation?: typeof orientation;
|
|
31
|
+
props?: typeof props;
|
|
32
|
+
rule?: typeof rule;
|
|
33
|
+
series?: typeof series;
|
|
34
|
+
seriesLayout?: typeof seriesLayout;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export let data: $$Props['data'] = [];
|
|
38
|
+
export let x: Accessor<TData> = undefined;
|
|
39
|
+
export let y: Accessor<TData> = undefined;
|
|
40
|
+
|
|
41
|
+
export let orientation: 'vertical' | 'horizontal' = 'vertical';
|
|
42
|
+
$: isVertical = orientation === 'vertical';
|
|
43
|
+
|
|
44
|
+
export let series: {
|
|
45
|
+
key: string;
|
|
46
|
+
label?: string;
|
|
47
|
+
value?: Accessor<TData>;
|
|
48
|
+
/** Provider series data, else uses chart data (with value/key accessor) */
|
|
49
|
+
data?: TData[];
|
|
50
|
+
color?: string;
|
|
51
|
+
props?: Partial<ComponentProps<Bars>>;
|
|
52
|
+
}[] = [
|
|
22
53
|
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
color: 'hsl(var(--color-primary))',
|
|
54
|
+
key: 'default',
|
|
55
|
+
value: orientation === 'vertical' ? y : x,
|
|
26
56
|
},
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export let
|
|
38
|
-
|
|
39
|
-
export let
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
let
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
$:
|
|
57
|
+
];
|
|
58
|
+
$: isDefaultSeries = series.length === 1 && series[0].key === 'default';
|
|
59
|
+
|
|
60
|
+
/** Determine how to layout series. Overlap (default), stack, or group side by side */
|
|
61
|
+
export let seriesLayout: 'overlap' | 'group' | 'stack' | 'stackExpand' | 'stackDiverging' =
|
|
62
|
+
'overlap';
|
|
63
|
+
$: stackSeries = seriesLayout.startsWith('stack');
|
|
64
|
+
$: groupSeries = seriesLayout === 'group';
|
|
65
|
+
|
|
66
|
+
export let axis: ComponentProps<Axis> | 'x' | 'y' | boolean = true;
|
|
67
|
+
export let rule: ComponentProps<Rule> | boolean = true;
|
|
68
|
+
export let grid: ComponentProps<Grid> | boolean = true;
|
|
69
|
+
export let labels: ComponentProps<Labels> | boolean = false;
|
|
70
|
+
export let legend: ComponentProps<Legend> | boolean = false;
|
|
71
|
+
|
|
72
|
+
/** Padding between primary x or y bands/bars, applied to scaleBand().padding() */
|
|
73
|
+
export let bandPadding = 0.4;
|
|
74
|
+
/** Padding between group/series items when using 'seriesLayout="group"', applied to scaleBand().padding() */
|
|
75
|
+
export let groupPadding = 0;
|
|
76
|
+
|
|
77
|
+
$: xScale = isVertical ? scaleBand().padding(bandPadding) : scaleLinear();
|
|
78
|
+
$: xBaseline = isVertical ? undefined : 0;
|
|
79
|
+
|
|
80
|
+
$: yScale = isVertical ? scaleLinear() : scaleBand().padding(bandPadding);
|
|
81
|
+
$: yBaseline = isVertical ? 0 : undefined;
|
|
82
|
+
|
|
83
|
+
let x1Scale: ChartProps['x1Scale'];
|
|
84
|
+
let x1Domain: ChartProps['x1Domain'];
|
|
85
|
+
let x1Range: ChartProps['x1Range'];
|
|
86
|
+
|
|
87
|
+
let y1Scale: ChartProps['y1Scale'];
|
|
88
|
+
let y1Domain: ChartProps['y1Domain'];
|
|
89
|
+
let y1Range: ChartProps['y1Range'];
|
|
90
|
+
|
|
91
|
+
$: if (seriesLayout === 'group') {
|
|
51
92
|
if (isVertical) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
93
|
+
x1Scale = scaleBand().padding(groupPadding);
|
|
94
|
+
x1Domain = series.map((s) => s.key);
|
|
95
|
+
x1Range = ({ xScale }) => [0, xScale.bandwidth?.()];
|
|
96
|
+
} else {
|
|
97
|
+
y1Scale = scaleBand().padding(groupPadding);
|
|
98
|
+
y1Domain = series.map((s) => s.key);
|
|
99
|
+
y1Range = ({ yScale }) => [0, yScale.bandwidth?.()];
|
|
55
100
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
$:
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export let props: {
|
|
104
|
+
xAxis?: Partial<ComponentProps<Axis>>;
|
|
105
|
+
yAxis?: Partial<ComponentProps<Axis>>;
|
|
106
|
+
grid?: Partial<ComponentProps<Grid>>;
|
|
107
|
+
rule?: Partial<ComponentProps<Rule>>;
|
|
108
|
+
bars?: Partial<ComponentProps<Bars>>;
|
|
109
|
+
legend?: Partial<ComponentProps<Legend>>;
|
|
110
|
+
highlight?: Partial<ComponentProps<Highlight>>;
|
|
111
|
+
labels?: Partial<ComponentProps<Labels>>;
|
|
112
|
+
} = {};
|
|
113
|
+
|
|
114
|
+
$: allSeriesData = series
|
|
115
|
+
.flatMap((s) =>
|
|
116
|
+
s.data?.map((d) => {
|
|
117
|
+
return { seriesKey: s.key, ...d };
|
|
118
|
+
})
|
|
119
|
+
)
|
|
120
|
+
.filter((d) => d) as Array<TData & { stackData?: any }>;
|
|
121
|
+
|
|
122
|
+
$: chartData = (allSeriesData.length ? allSeriesData : chartDataArray(data)) as Array<
|
|
123
|
+
TData & { stackData?: any }
|
|
124
|
+
>;
|
|
125
|
+
|
|
126
|
+
$: if (stackSeries) {
|
|
70
127
|
const seriesKeys = series.map((s) => s.key);
|
|
71
128
|
// const stackData = stack().keys(seriesKeys)(chartDataArray(data)) as any[];
|
|
72
|
-
|
|
129
|
+
|
|
130
|
+
const offset =
|
|
131
|
+
seriesLayout === 'stackExpand'
|
|
73
132
|
? stackOffsetExpand
|
|
74
133
|
: seriesLayout === 'stackDiverging'
|
|
75
|
-
|
|
76
|
-
|
|
134
|
+
? stackOffsetDiverging
|
|
135
|
+
: stackOffsetNone;
|
|
77
136
|
const stackData = stack()
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const s = series.find((d) => d.key === key)
|
|
81
|
-
return accessor(s.value ?? s.key)(d);
|
|
82
|
-
|
|
83
|
-
|
|
137
|
+
.keys(seriesKeys)
|
|
138
|
+
.value((d, key) => {
|
|
139
|
+
const s = series.find((d) => d.key === key)!;
|
|
140
|
+
return accessor(s.value ?? s.key)(d as any);
|
|
141
|
+
})
|
|
142
|
+
.offset(offset)(chartDataArray(data)) as any[];
|
|
143
|
+
|
|
84
144
|
chartData = chartData.map((d, i) => {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
145
|
+
return {
|
|
146
|
+
...d,
|
|
147
|
+
stackData: stackData.map((sd) => sd[i]),
|
|
148
|
+
};
|
|
89
149
|
});
|
|
90
|
-
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function getBarsProps(s: (typeof series)[number], i: number) {
|
|
153
|
+
const barsProps: ComponentProps<Bars> = {
|
|
154
|
+
data: s.data,
|
|
155
|
+
x: !isVertical
|
|
156
|
+
? stackSeries
|
|
157
|
+
? (d) => d.stackData[i]
|
|
158
|
+
: (s.value ?? (s.data ? undefined : s.key))
|
|
159
|
+
: undefined,
|
|
160
|
+
y: isVertical
|
|
161
|
+
? stackSeries
|
|
162
|
+
? (d) => d.stackData[i]
|
|
163
|
+
: (s.value ?? (s.data ? undefined : s.key))
|
|
164
|
+
: undefined,
|
|
165
|
+
x1: isVertical && groupSeries ? (d) => s.value ?? s.key : undefined,
|
|
166
|
+
y1: !isVertical && groupSeries ? (d) => s.value ?? s.key : undefined,
|
|
167
|
+
radius: 4,
|
|
168
|
+
strokeWidth: 1,
|
|
169
|
+
fill: s.color,
|
|
170
|
+
...props.bars,
|
|
171
|
+
...s.props,
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
return barsProps;
|
|
175
|
+
}
|
|
91
176
|
</script>
|
|
92
177
|
|
|
93
178
|
<Chart
|
|
@@ -112,6 +197,8 @@ $: if (stackSeries) {
|
|
|
112
197
|
{y1Scale}
|
|
113
198
|
{y1Domain}
|
|
114
199
|
{y1Range}
|
|
200
|
+
c={isVertical ? y : x}
|
|
201
|
+
cRange={['hsl(var(--color-primary))']}
|
|
115
202
|
padding={axis === false
|
|
116
203
|
? undefined
|
|
117
204
|
: {
|
|
@@ -124,20 +211,45 @@ $: if (stackSeries) {
|
|
|
124
211
|
let:xScale
|
|
125
212
|
let:y
|
|
126
213
|
let:yScale
|
|
214
|
+
let:c
|
|
215
|
+
let:cScale
|
|
127
216
|
let:width
|
|
128
217
|
let:height
|
|
129
218
|
let:padding
|
|
130
219
|
let:tooltip
|
|
131
220
|
>
|
|
132
|
-
{@const slotProps = {
|
|
221
|
+
{@const slotProps = {
|
|
222
|
+
x,
|
|
223
|
+
xScale,
|
|
224
|
+
y,
|
|
225
|
+
yScale,
|
|
226
|
+
c,
|
|
227
|
+
cScale,
|
|
228
|
+
width,
|
|
229
|
+
height,
|
|
230
|
+
padding,
|
|
231
|
+
tooltip,
|
|
232
|
+
series,
|
|
233
|
+
getBarsProps,
|
|
234
|
+
}}
|
|
133
235
|
<slot {...slotProps}>
|
|
134
236
|
<Svg>
|
|
237
|
+
<slot name="grid" {...slotProps}>
|
|
238
|
+
{#if grid}
|
|
239
|
+
<Grid
|
|
240
|
+
x={!isVertical}
|
|
241
|
+
y={isVertical}
|
|
242
|
+
{...typeof grid === 'object' ? grid : null}
|
|
243
|
+
{...props.grid}
|
|
244
|
+
/>
|
|
245
|
+
{/if}
|
|
246
|
+
</slot>
|
|
247
|
+
|
|
135
248
|
<slot name="axis" {...slotProps}>
|
|
136
249
|
{#if axis}
|
|
137
250
|
{#if axis !== 'x'}
|
|
138
251
|
<Axis
|
|
139
252
|
placement="left"
|
|
140
|
-
grid={isVertical}
|
|
141
253
|
format={(value) => {
|
|
142
254
|
if (isVertical && seriesLayout === 'stackExpand') {
|
|
143
255
|
return format(value, 'percentRound');
|
|
@@ -153,7 +265,6 @@ $: if (stackSeries) {
|
|
|
153
265
|
{#if axis !== 'y'}
|
|
154
266
|
<Axis
|
|
155
267
|
placement="bottom"
|
|
156
|
-
grid={!isVertical}
|
|
157
268
|
format={(value) => {
|
|
158
269
|
if (!isVertical && seriesLayout === 'stackExpand') {
|
|
159
270
|
return format(value, 'percentRound');
|
|
@@ -167,7 +278,12 @@ $: if (stackSeries) {
|
|
|
167
278
|
{/if}
|
|
168
279
|
|
|
169
280
|
{#if rule}
|
|
170
|
-
<Rule
|
|
281
|
+
<Rule
|
|
282
|
+
x={isVertical ? false : 0}
|
|
283
|
+
y={isVertical ? 0 : false}
|
|
284
|
+
{...typeof rule === 'object' ? rule : null}
|
|
285
|
+
{...props.rule}
|
|
286
|
+
/>
|
|
171
287
|
{/if}
|
|
172
288
|
{/if}
|
|
173
289
|
</slot>
|
|
@@ -176,26 +292,7 @@ $: if (stackSeries) {
|
|
|
176
292
|
|
|
177
293
|
<slot name="marks" {...slotProps}>
|
|
178
294
|
{#each series as s, i}
|
|
179
|
-
<Bars
|
|
180
|
-
data={s.data}
|
|
181
|
-
x={!isVertical
|
|
182
|
-
? stackSeries
|
|
183
|
-
? (d) => d.stackData[i]
|
|
184
|
-
: (s.value ?? (s.data ? undefined : s.key))
|
|
185
|
-
: undefined}
|
|
186
|
-
y={isVertical
|
|
187
|
-
? stackSeries
|
|
188
|
-
? (d) => d.stackData[i]
|
|
189
|
-
: (s.value ?? (s.data ? undefined : s.key))
|
|
190
|
-
: undefined}
|
|
191
|
-
x1={isVertical && groupSeries ? (d) => s.value ?? s.key : undefined}
|
|
192
|
-
y1={!isVertical && groupSeries ? (d) => s.value ?? s.key : undefined}
|
|
193
|
-
radius={4}
|
|
194
|
-
strokeWidth={1}
|
|
195
|
-
fill={s.color}
|
|
196
|
-
{...props.bars}
|
|
197
|
-
{...s.props}
|
|
198
|
-
/>
|
|
295
|
+
<Bars {...getBarsProps(s, i)} />
|
|
199
296
|
{/each}
|
|
200
297
|
</slot>
|
|
201
298
|
|
|
@@ -213,10 +310,12 @@ $: if (stackSeries) {
|
|
|
213
310
|
<slot name="legend" {...slotProps}>
|
|
214
311
|
{#if legend}
|
|
215
312
|
<Legend
|
|
216
|
-
scale={
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
313
|
+
scale={isDefaultSeries
|
|
314
|
+
? undefined
|
|
315
|
+
: scaleOrdinal(
|
|
316
|
+
series.map((s) => s.label ?? s.key),
|
|
317
|
+
series.map((s) => s.color)
|
|
318
|
+
)}
|
|
220
319
|
placement="bottom"
|
|
221
320
|
variant="swatches"
|
|
222
321
|
{...props.legend}
|
|
@@ -236,7 +335,7 @@ $: if (stackSeries) {
|
|
|
236
335
|
<Tooltip.Item
|
|
237
336
|
label={s.label ?? (s.key !== 'default' ? s.key : 'value')}
|
|
238
337
|
value={valueAccessor(data)}
|
|
239
|
-
color={s.color}
|
|
338
|
+
color={s.color ?? cScale?.(c(data))}
|
|
240
339
|
{format}
|
|
241
340
|
valueAlign="right"
|
|
242
341
|
/>
|
|
@@ -2,6 +2,7 @@ import { SvelteComponentTyped } from "svelte";
|
|
|
2
2
|
import { type ComponentProps } from 'svelte';
|
|
3
3
|
import Axis from '../Axis.svelte';
|
|
4
4
|
import Bars from '../Bars.svelte';
|
|
5
|
+
import Grid from '../Grid.svelte';
|
|
5
6
|
import Highlight from '../Highlight.svelte';
|
|
6
7
|
import Labels from '../Labels.svelte';
|
|
7
8
|
import Legend from '../Legend.svelte';
|
|
@@ -75,7 +76,7 @@ declare class __sveltets_Render<TData> {
|
|
|
75
76
|
width: number;
|
|
76
77
|
height: number;
|
|
77
78
|
}) => number[] | string[]) | undefined;
|
|
78
|
-
cRange?: string[];
|
|
79
|
+
cRange?: string[] | readonly string[];
|
|
79
80
|
xReverse?: boolean;
|
|
80
81
|
yReverse?: boolean;
|
|
81
82
|
zReverse?: boolean;
|
|
@@ -130,6 +131,13 @@ declare class __sveltets_Render<TData> {
|
|
|
130
131
|
onClick?: ({ data }: {
|
|
131
132
|
data: any;
|
|
132
133
|
}) => any;
|
|
134
|
+
tooltip?: import("svelte/store").Writable<{
|
|
135
|
+
y: number;
|
|
136
|
+
x: number;
|
|
137
|
+
data: any;
|
|
138
|
+
show: (e: PointerEvent, tooltipData?: any) => void;
|
|
139
|
+
hide: () => void;
|
|
140
|
+
}>;
|
|
133
141
|
}> | undefined;
|
|
134
142
|
transform?: Partial<{
|
|
135
143
|
mode?: "canvas" | "manual" | "none";
|
|
@@ -178,6 +186,14 @@ declare class __sveltets_Render<TData> {
|
|
|
178
186
|
setScale?: (value: number, options?: import("../../stores/motionStore").MotionOptions) => void;
|
|
179
187
|
}> | undefined;
|
|
180
188
|
transformContext?: import("..").TransformContext;
|
|
189
|
+
geoProjection?: import("svelte/store").Writable<import("d3-geo").GeoProjection> | undefined;
|
|
190
|
+
tooltipContext?: import("svelte/store").Writable<{
|
|
191
|
+
y: number;
|
|
192
|
+
x: number;
|
|
193
|
+
data: any;
|
|
194
|
+
show: (e: PointerEvent, tooltipData?: any) => void;
|
|
195
|
+
hide: () => void;
|
|
196
|
+
}> | undefined;
|
|
181
197
|
} & {
|
|
182
198
|
axis?: boolean | "x" | "y" | {
|
|
183
199
|
[x: string]: any;
|
|
@@ -185,7 +201,7 @@ declare class __sveltets_Render<TData> {
|
|
|
185
201
|
label?: string | undefined;
|
|
186
202
|
labelPlacement?: ("start" | "middle" | "end") | undefined;
|
|
187
203
|
labelProps?: Partial<ComponentProps<import("..").Text>> | undefined;
|
|
188
|
-
rule?: (boolean |
|
|
204
|
+
rule?: (boolean | Partial<ComponentProps<Rule>>) | undefined;
|
|
189
205
|
grid?: (boolean | Pick<import("svelte/elements").SVGAttributes<SVGElement>, "class" | "style">) | undefined;
|
|
190
206
|
ticks?: number | any[] | ((scale: import("../../utils/scales").AnyScale) => any) | null | undefined;
|
|
191
207
|
tickLength?: number | undefined;
|
|
@@ -201,10 +217,28 @@ declare class __sveltets_Render<TData> {
|
|
|
201
217
|
label?: string;
|
|
202
218
|
} | undefined;
|
|
203
219
|
};
|
|
220
|
+
grid?: boolean | {
|
|
221
|
+
[x: string]: any;
|
|
222
|
+
x?: (boolean | Pick<import("svelte/elements").SVGAttributes<SVGElement>, "class" | "style">) | undefined;
|
|
223
|
+
y?: (boolean | Pick<import("svelte/elements").SVGAttributes<SVGElement>, "class" | "style">) | undefined;
|
|
224
|
+
xTicks?: number | any[] | ((scale: import("../../utils/scales").AnyScale) => any) | null | undefined;
|
|
225
|
+
yTicks?: number | any[] | ((scale: import("../../utils/scales").AnyScale) => any) | null | undefined;
|
|
226
|
+
bandAlign?: ("center" | "between") | undefined;
|
|
227
|
+
radialY?: ("circle" | "linear") | undefined;
|
|
228
|
+
spring?: boolean | Parameters<typeof import("svelte/motion").spring>[1];
|
|
229
|
+
tweened?: boolean | Parameters<typeof import("svelte/motion").tweened>[1];
|
|
230
|
+
transitionIn?: (typeof import("svelte/transition").fade | (() => {})) | undefined;
|
|
231
|
+
transitionInParams?: import("svelte-ux").TransitionParams | undefined;
|
|
232
|
+
classes?: {
|
|
233
|
+
root?: string;
|
|
234
|
+
line?: string;
|
|
235
|
+
} | undefined;
|
|
236
|
+
};
|
|
204
237
|
bandPadding?: number;
|
|
205
238
|
groupPadding?: number;
|
|
206
239
|
labels?: boolean | {
|
|
207
240
|
[x: string]: any;
|
|
241
|
+
value?: Accessor;
|
|
208
242
|
placement?: ("inside" | "outside" | "center") | undefined;
|
|
209
243
|
offset?: number | undefined;
|
|
210
244
|
format?: import("@layerstack/utils").FormatType | undefined;
|
|
@@ -220,7 +254,7 @@ declare class __sveltets_Render<TData> {
|
|
|
220
254
|
tickValues?: any[] | undefined;
|
|
221
255
|
tickFontSize?: number | undefined;
|
|
222
256
|
tickLength?: number | undefined;
|
|
223
|
-
placement?: ("
|
|
257
|
+
placement?: ("center" | "left" | "right" | "bottom" | "top" | "top-left" | "top-right" | "bottom-left" | "bottom-right") | undefined;
|
|
224
258
|
orientation?: ("horizontal" | "vertical") | undefined;
|
|
225
259
|
variant?: ("ramp" | "swatches") | undefined;
|
|
226
260
|
classes?: {
|
|
@@ -236,6 +270,7 @@ declare class __sveltets_Render<TData> {
|
|
|
236
270
|
props?: {
|
|
237
271
|
xAxis?: Partial<ComponentProps<Axis>>;
|
|
238
272
|
yAxis?: Partial<ComponentProps<Axis>>;
|
|
273
|
+
grid?: Partial<ComponentProps<Grid>>;
|
|
239
274
|
rule?: Partial<ComponentProps<Rule>>;
|
|
240
275
|
bars?: Partial<ComponentProps<Bars>>;
|
|
241
276
|
legend?: Partial<ComponentProps<Legend>>;
|
|
@@ -245,7 +280,9 @@ declare class __sveltets_Render<TData> {
|
|
|
245
280
|
rule?: boolean | {
|
|
246
281
|
[x: string]: any;
|
|
247
282
|
x?: (number | Date | boolean | "left" | "right") | undefined;
|
|
283
|
+
xOffset?: number | undefined;
|
|
248
284
|
y?: (number | Date | boolean | "top" | "bottom") | undefined;
|
|
285
|
+
yOffset?: number | undefined;
|
|
249
286
|
};
|
|
250
287
|
series?: {
|
|
251
288
|
key: string;
|
|
@@ -263,6 +300,7 @@ declare class __sveltets_Render<TData> {
|
|
|
263
300
|
};
|
|
264
301
|
slots(): {
|
|
265
302
|
default: any;
|
|
303
|
+
grid: any;
|
|
266
304
|
axis: any;
|
|
267
305
|
'below-marks': any;
|
|
268
306
|
marks: any;
|