layerchart 0.16.0 → 0.17.0
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 +10 -10
- package/dist/components/Arc.svelte.d.ts +2 -1
- package/dist/components/Area.svelte +10 -10
- package/dist/components/AreaStack.svelte +25 -25
- package/dist/components/Axis.svelte +131 -0
- package/dist/components/Axis.svelte.d.ts +25 -0
- package/dist/components/Bars.svelte +30 -71
- package/dist/components/Bars.svelte.d.ts +1 -1
- package/dist/components/Baseline.svelte +19 -19
- package/dist/components/Blur.svelte +6 -6
- package/dist/components/Chart.svelte +46 -46
- package/dist/components/ChartClipPath.svelte +7 -7
- package/dist/components/Circle.svelte +7 -7
- package/dist/components/CircleClipPath.svelte +4 -4
- package/dist/components/ClipPath.svelte +3 -3
- package/dist/components/ClipPathUse.svelte +4 -4
- package/dist/components/ConnectedPoints.svelte +16 -16
- package/dist/components/GeoPath.svelte +11 -11
- package/dist/components/GeoPoint.svelte +3 -3
- package/dist/components/GeoTile.svelte +5 -5
- package/dist/components/Graticule.svelte +12 -12
- package/dist/components/Group.svelte +1 -1
- package/dist/components/HighlightLine.svelte +25 -25
- package/dist/components/HighlightRect.svelte +1 -1
- package/dist/components/Labels.svelte +82 -73
- package/dist/components/Labels.svelte.d.ts +2 -2
- package/dist/components/Legend.svelte +57 -57
- package/dist/components/Legend.svelte.d.ts +1 -1
- package/dist/components/Line.svelte +8 -8
- package/dist/components/LinearGradient.svelte +22 -22
- package/dist/components/Link.svelte +9 -9
- package/dist/components/Link.svelte.d.ts +1 -1
- package/dist/components/Pack.svelte.d.ts +2 -2
- package/dist/components/Partition.svelte.d.ts +5 -5
- package/dist/components/Path.svelte +16 -16
- package/dist/components/Pattern.svelte +3 -3
- package/dist/components/Pie.svelte +21 -21
- package/dist/components/Pie.svelte.d.ts +18 -18
- package/dist/components/Points.svelte +14 -14
- package/dist/components/Rect.svelte +8 -8
- package/dist/components/RectClipPath.svelte +4 -4
- package/dist/components/Sankey.svelte.d.ts +2 -2
- package/dist/components/Text.svelte +21 -21
- package/dist/components/Threshold.svelte +25 -25
- package/dist/components/TileImage.svelte +21 -21
- package/dist/components/Tooltip.svelte +25 -25
- package/dist/components/TooltipContext.svelte +80 -78
- package/dist/components/TooltipContext.svelte.d.ts +1 -1
- package/dist/components/TooltipItem.svelte +10 -10
- package/dist/components/Tree.svelte.d.ts +9 -9
- package/dist/components/Zoom.svelte +18 -18
- package/dist/components/index.d.ts +1 -2
- package/dist/components/index.js +1 -2
- package/dist/docs/Blockquote.svelte +1 -1
- package/dist/docs/Code.svelte +19 -19
- package/dist/docs/Code.svelte.d.ts +2 -2
- package/dist/docs/GeoDebug.svelte +25 -25
- package/dist/docs/Header1.svelte +1 -1
- package/dist/docs/Layout.svelte +5 -5
- package/dist/docs/Link.svelte +1 -1
- package/dist/docs/Preview.svelte +24 -24
- package/dist/docs/RangeField.svelte +18 -18
- package/dist/docs/TilesetField.svelte +13 -13
- package/dist/docs/ViewSourceButton.svelte +42 -0
- package/dist/docs/ViewSourceButton.svelte.d.ts +19 -0
- package/dist/docs/ZoomControls.svelte +39 -39
- package/dist/docs/ZoomControls.svelte.d.ts +2 -2
- package/dist/utils/genData.d.ts +2 -2
- package/dist/utils/rect.d.ts +19 -0
- package/dist/utils/rect.js +97 -0
- package/dist/utils/scales.d.ts +8 -0
- package/dist/utils/scales.js +17 -0
- package/package.json +90 -90
- package/dist/components/AxisX.svelte +0 -43
- package/dist/components/AxisX.svelte.d.ts +0 -38
- package/dist/components/AxisY.svelte +0 -55
- package/dist/components/AxisY.svelte.d.ts +0 -38
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script>/*
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
2
|
+
TODO:
|
|
3
|
+
- [ ] Allow spring/tweened to be reactive (but ignore value)
|
|
4
|
+
*/
|
|
5
5
|
// https://caniuse.com/#feat=css-conic-gradients
|
|
6
6
|
// https://css-tricks.com/snippets/css/css-conic-gradient/
|
|
7
7
|
// https://developer.mozilla.org/en-US/docs/Web/CSS/conic-gradient
|
|
@@ -107,16 +107,16 @@ $: yOffset = -Math.cos(angle) * offset;
|
|
|
107
107
|
</script>
|
|
108
108
|
|
|
109
109
|
{#if track}
|
|
110
|
-
|
|
110
|
+
<path d={trackArc()} class="track" bind:this={trackArcEl} {...track} />
|
|
111
111
|
{/if}
|
|
112
112
|
|
|
113
113
|
<path
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
d={arc()}
|
|
115
|
+
transform="translate({xOffset}, {yOffset})"
|
|
116
|
+
{...$$restProps}
|
|
117
|
+
on:click
|
|
118
|
+
on:mousemove
|
|
119
|
+
on:mouseleave
|
|
120
120
|
/>
|
|
121
121
|
|
|
122
122
|
<slot value={$tweened_value} centroid={trackArcCentroid} {boundingBox} />
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { SVGAttributes } from 'svelte/elements';
|
|
2
3
|
import type { spring as springStore, tweened as tweenedStore } from 'svelte/motion';
|
|
3
4
|
declare const __propDef: {
|
|
4
5
|
props: {
|
|
@@ -14,7 +15,7 @@ declare const __propDef: {
|
|
|
14
15
|
outerRadius?: undefined;
|
|
15
16
|
cornerRadius?: number | undefined;
|
|
16
17
|
padAngle?: number | undefined;
|
|
17
|
-
track?: boolean |
|
|
18
|
+
track?: boolean | SVGAttributes<SVGPathElement> | undefined;
|
|
18
19
|
offset?: number | undefined;
|
|
19
20
|
};
|
|
20
21
|
events: {
|
|
@@ -35,17 +35,17 @@ $: {
|
|
|
35
35
|
</script>
|
|
36
36
|
|
|
37
37
|
{#if line}
|
|
38
|
-
|
|
38
|
+
<Path {data} {curve} {defined} {color} {tweened} {...line} />
|
|
39
39
|
{/if}
|
|
40
40
|
|
|
41
41
|
<path
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
class="path-area"
|
|
43
|
+
d={$tweened_d}
|
|
44
|
+
clip-path={clipPath}
|
|
45
|
+
fill={color}
|
|
46
|
+
fill-opacity={opacity}
|
|
47
|
+
{...$$restProps}
|
|
48
|
+
on:click
|
|
49
|
+
on:mousemove
|
|
50
|
+
on:mouseleave
|
|
51
51
|
/>
|
|
@@ -12,32 +12,32 @@ $: lineData = [...$data].reverse();
|
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
{#if line}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
<g class="line-group">
|
|
16
|
+
{#each lineData as seriesData}
|
|
17
|
+
<Path
|
|
18
|
+
data={seriesData}
|
|
19
|
+
y={(d) => $yScale(d[1])}
|
|
20
|
+
color={$rGet(seriesData)}
|
|
21
|
+
{curve}
|
|
22
|
+
{defined}
|
|
23
|
+
{tweened}
|
|
24
|
+
{...line}
|
|
25
|
+
/>
|
|
26
|
+
{/each}
|
|
27
|
+
</g>
|
|
28
28
|
{/if}
|
|
29
29
|
|
|
30
30
|
<g class="area-group">
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
{#each $data as seriesData}
|
|
32
|
+
<Area
|
|
33
|
+
data={seriesData}
|
|
34
|
+
y0={(d) => $yScale(d[0])}
|
|
35
|
+
y1={(d) => $yScale(d[1])}
|
|
36
|
+
color={$rGet(seriesData)}
|
|
37
|
+
{curve}
|
|
38
|
+
{defined}
|
|
39
|
+
{opacity}
|
|
40
|
+
{tweened}
|
|
41
|
+
/>
|
|
42
|
+
{/each}
|
|
43
43
|
</g>
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<script>import { getContext } from 'svelte';
|
|
2
|
+
import { format as formatValue } from 'svelte-ux';
|
|
3
|
+
import { max, min } from 'd3-array';
|
|
4
|
+
import Text from './Text.svelte';
|
|
5
|
+
import { isScaleBand } from '../utils/scales';
|
|
6
|
+
const { xScale, yScale, xRange, yRange, width } = getContext('LayerCake');
|
|
7
|
+
export let placement;
|
|
8
|
+
/** Control the number of ticks*/
|
|
9
|
+
export let ticks = placement === 'left' || placement === 'right' ? 4 : undefined;
|
|
10
|
+
export let gridlines = false;
|
|
11
|
+
export let tickSize = 4;
|
|
12
|
+
export let format = undefined;
|
|
13
|
+
export let labelProps = undefined;
|
|
14
|
+
$: orientation = ['top', 'bottom'].includes(placement) ? 'horizontal' : 'vertical';
|
|
15
|
+
$: scale = orientation === 'horizontal' ? $xScale : $yScale;
|
|
16
|
+
$: tickVals = Array.isArray(ticks)
|
|
17
|
+
? ticks
|
|
18
|
+
: isScaleBand(scale)
|
|
19
|
+
? scale.domain()
|
|
20
|
+
: scale.ticks(typeof ticks === 'function' ? ticks(scale) : ticks);
|
|
21
|
+
function getCoords(tick) {
|
|
22
|
+
switch (placement) {
|
|
23
|
+
case 'top':
|
|
24
|
+
return {
|
|
25
|
+
x: $xScale(tick) + (isScaleBand($xScale) ? $xScale.bandwidth() / 2 : 0),
|
|
26
|
+
y: min($yRange)
|
|
27
|
+
};
|
|
28
|
+
case 'bottom':
|
|
29
|
+
return {
|
|
30
|
+
x: $xScale(tick) + (isScaleBand($xScale) ? $xScale.bandwidth() / 2 : 0),
|
|
31
|
+
y: max($yRange)
|
|
32
|
+
};
|
|
33
|
+
case 'left':
|
|
34
|
+
return {
|
|
35
|
+
x: min($xRange),
|
|
36
|
+
y: $yScale(tick) + (isScaleBand($yScale) ? $yScale.bandwidth() / 2 : 0)
|
|
37
|
+
};
|
|
38
|
+
case 'right':
|
|
39
|
+
return {
|
|
40
|
+
x: max($xRange),
|
|
41
|
+
y: $yScale(tick) + (isScaleBand($yScale) ? $yScale.bandwidth() / 2 : 0)
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
function getDefaultLabelProps() {
|
|
46
|
+
switch (placement) {
|
|
47
|
+
case 'top':
|
|
48
|
+
return {
|
|
49
|
+
textAnchor: 'middle',
|
|
50
|
+
verticalAnchor: 'end',
|
|
51
|
+
dy: -6 // manually adjusted until Text supports custom styles
|
|
52
|
+
};
|
|
53
|
+
case 'bottom':
|
|
54
|
+
return {
|
|
55
|
+
textAnchor: 'middle',
|
|
56
|
+
verticalAnchor: 'start',
|
|
57
|
+
dy: 4 // manually adjusted until Text supports custom styles
|
|
58
|
+
};
|
|
59
|
+
case 'left':
|
|
60
|
+
return {
|
|
61
|
+
textAnchor: 'end',
|
|
62
|
+
verticalAnchor: 'middle',
|
|
63
|
+
dx: -4,
|
|
64
|
+
dy: -2 // manually adjusted until Text supports custom styles
|
|
65
|
+
};
|
|
66
|
+
case 'right':
|
|
67
|
+
return {
|
|
68
|
+
textAnchor: 'start',
|
|
69
|
+
verticalAnchor: 'middle',
|
|
70
|
+
dx: 4,
|
|
71
|
+
dy: -2 // manually adjusted until Text supports custom styles
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
</script>
|
|
76
|
+
|
|
77
|
+
<g class="Axis placement-{placement}">
|
|
78
|
+
{#each tickVals as tick, i}
|
|
79
|
+
{@const tickCoords = getCoords(tick)}
|
|
80
|
+
<g>
|
|
81
|
+
{#if gridlines !== false}
|
|
82
|
+
{#if orientation === 'horizontal'}
|
|
83
|
+
<line
|
|
84
|
+
x1={tickCoords.x}
|
|
85
|
+
y1={min($yRange)}
|
|
86
|
+
x2={tickCoords.x}
|
|
87
|
+
y2={max($yRange)}
|
|
88
|
+
class="gridline stroke-gray-200"
|
|
89
|
+
{...gridlines}
|
|
90
|
+
/>
|
|
91
|
+
{:else if orientation === 'vertical'}
|
|
92
|
+
<line
|
|
93
|
+
x1={0}
|
|
94
|
+
y1={tickCoords.y}
|
|
95
|
+
x2={$width}
|
|
96
|
+
y2={tickCoords.y}
|
|
97
|
+
class="gridline stroke-gray-200"
|
|
98
|
+
{...gridlines}
|
|
99
|
+
/>
|
|
100
|
+
{/if}
|
|
101
|
+
{/if}
|
|
102
|
+
|
|
103
|
+
{#if orientation === 'horizontal'}
|
|
104
|
+
<line
|
|
105
|
+
x1={tickCoords.x}
|
|
106
|
+
y1={tickCoords.y}
|
|
107
|
+
x2={tickCoords.x}
|
|
108
|
+
y2={tickCoords.y + (placement === 'top' ? -tickSize : tickSize)}
|
|
109
|
+
class="tick stroke-gray-400"
|
|
110
|
+
/>
|
|
111
|
+
{:else if orientation === 'vertical'}
|
|
112
|
+
<line
|
|
113
|
+
x1={tickCoords.x}
|
|
114
|
+
y1={tickCoords.y}
|
|
115
|
+
x2={tickCoords.x + (placement === 'left' ? -tickSize : tickSize)}
|
|
116
|
+
y2={tickCoords.y}
|
|
117
|
+
class="tick stroke-gray-400"
|
|
118
|
+
/>
|
|
119
|
+
{/if}
|
|
120
|
+
|
|
121
|
+
<Text
|
|
122
|
+
x={tickCoords.x}
|
|
123
|
+
y={tickCoords.y}
|
|
124
|
+
class="label text-[10px] stroke-white [stroke-width:2px] font-light"
|
|
125
|
+
value={formatValue(tick, format ?? scale.tickFormat?.())}
|
|
126
|
+
{...getDefaultLabelProps()}
|
|
127
|
+
{...labelProps}
|
|
128
|
+
/>
|
|
129
|
+
</g>
|
|
130
|
+
{/each}
|
|
131
|
+
</g>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import { type ComponentProps } from 'svelte';
|
|
3
|
+
import type { SVGAttributes } from 'svelte/elements';
|
|
4
|
+
import { type FormatType } from 'svelte-ux';
|
|
5
|
+
import Text from './Text.svelte';
|
|
6
|
+
declare const __propDef: {
|
|
7
|
+
props: {
|
|
8
|
+
placement: 'top' | 'bottom' | 'left' | 'right';
|
|
9
|
+
/** Control the number of ticks*/ ticks?: number | Function | undefined;
|
|
10
|
+
gridlines?: boolean | SVGAttributes<SVGLineElement> | undefined;
|
|
11
|
+
tickSize?: number | undefined;
|
|
12
|
+
format?: FormatType;
|
|
13
|
+
labelProps?: ComponentProps<Text> | undefined;
|
|
14
|
+
};
|
|
15
|
+
events: {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
};
|
|
18
|
+
slots: {};
|
|
19
|
+
};
|
|
20
|
+
export type AxisProps = typeof __propDef.props;
|
|
21
|
+
export type AxisEvents = typeof __propDef.events;
|
|
22
|
+
export type AxisSlots = typeof __propDef.slots;
|
|
23
|
+
export default class Axis extends SvelteComponentTyped<AxisProps, AxisEvents, AxisSlots> {
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
<script>import { getContext } from 'svelte';
|
|
2
|
-
import { scaleBand } from 'd3-scale';
|
|
3
|
-
import { max, min } from 'd3-array';
|
|
4
|
-
import { unique } from 'svelte-ux/utils/array';
|
|
5
2
|
import Rect from './Rect.svelte';
|
|
6
|
-
|
|
3
|
+
import { createDimensionGetter } from '../utils/rect';
|
|
4
|
+
const { data, xScale, x: xContext, y: yContext, rGet, config } = getContext('LayerCake');
|
|
7
5
|
/**
|
|
8
6
|
* Override `x` from context. Useful for multiple Bar instances
|
|
9
7
|
*/
|
|
@@ -15,69 +13,31 @@ $: _x = x ? (typeof x === 'string' ? (d) => d[x] : x) : $xContext;
|
|
|
15
13
|
*/
|
|
16
14
|
export let y = $yContext;
|
|
17
15
|
$: _y = y ? (typeof y === 'string' ? (d) => d[y] : y) : $yContext;
|
|
18
|
-
/*
|
|
19
|
-
TODO:
|
|
20
|
-
- [ ] Support vertical/horizontal layout (Bar/Column)
|
|
21
|
-
*/
|
|
22
16
|
export let color = 'var(--color-blue-500)';
|
|
23
17
|
export let opacity = 1;
|
|
24
18
|
export let stroke = 'black';
|
|
25
19
|
export let strokeWidth = 0;
|
|
26
20
|
export let radius = 0;
|
|
27
|
-
export let getKey = (item) => _x(item);
|
|
21
|
+
export let getKey = (item) => $xScale.bandwidth ? _x(item) : _y(item);
|
|
28
22
|
export let getProps = undefined;
|
|
29
|
-
|
|
23
|
+
/** Inset the rect for amount of padding. Useful with multiple bars (bullet, overlap, etc) */
|
|
24
|
+
export let padding = 0;
|
|
30
25
|
export let spring = undefined;
|
|
31
26
|
export let tweened = undefined;
|
|
32
27
|
// See: https://svelte.dev/repl/7000c5ce05b84cd98ccbfb2768b4be3d?version=3.38.3
|
|
33
28
|
export let groupBy = undefined;
|
|
34
29
|
export let groupPaddingInner = 0.2;
|
|
35
30
|
export let groupPaddingOuter = 0;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// console.log({ item, y: $y(item) });
|
|
45
|
-
const x = $xGet(item) + (groupBy ? x1Scale(item[groupBy]) : 0) - widthOffset / 2;
|
|
46
|
-
// TODO: Do we need to support the non-bandwidth scale?
|
|
47
|
-
// const width = $xScale.bandwidth
|
|
48
|
-
// ? $xScale.bandwidth()
|
|
49
|
-
// : Math.max(0, $xGet(d)[1] - $xGet(d)[0]);
|
|
50
|
-
const width = Math.max(0, (groupBy ? x1Scale.bandwidth() : $xScale.bandwidth()) + widthOffset);
|
|
51
|
-
const yValue = _y(item);
|
|
52
|
-
let yTop = 0;
|
|
53
|
-
let yBottom = 0;
|
|
54
|
-
if (Array.isArray(yValue)) {
|
|
55
|
-
// Array contains both top and bottom values (stack, etc);
|
|
56
|
-
yTop = max(yValue);
|
|
57
|
-
yBottom = min(yValue);
|
|
31
|
+
$: getDimensions = createDimensionGetter(getContext('LayerCake'), {
|
|
32
|
+
x,
|
|
33
|
+
y,
|
|
34
|
+
groupBy,
|
|
35
|
+
padding,
|
|
36
|
+
groupPadding: {
|
|
37
|
+
inner: groupPaddingInner,
|
|
38
|
+
outer: groupPaddingOuter
|
|
58
39
|
}
|
|
59
|
-
|
|
60
|
-
// null/undefined value
|
|
61
|
-
yTop = 0;
|
|
62
|
-
yBottom = 0;
|
|
63
|
-
}
|
|
64
|
-
else if (yValue > 0) {
|
|
65
|
-
// Positive value
|
|
66
|
-
yTop = yValue;
|
|
67
|
-
yBottom = min($yRange); // or `0`?
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
// Negative value
|
|
71
|
-
yTop = min($yRange); // or `0`?
|
|
72
|
-
yBottom = yValue;
|
|
73
|
-
}
|
|
74
|
-
return {
|
|
75
|
-
x,
|
|
76
|
-
y: $yScale(yTop),
|
|
77
|
-
width,
|
|
78
|
-
height: $yScale(yBottom) - $yScale(yTop)
|
|
79
|
-
};
|
|
80
|
-
};
|
|
40
|
+
});
|
|
81
41
|
function getColor(item, index) {
|
|
82
42
|
if (typeof color === 'function') {
|
|
83
43
|
return color({ value: _y(item), item, index });
|
|
@@ -91,21 +51,20 @@ function getColor(item, index) {
|
|
|
91
51
|
}
|
|
92
52
|
</script>
|
|
93
53
|
|
|
94
|
-
<g class="
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
{/each}
|
|
54
|
+
<g class="Bars">
|
|
55
|
+
{#each $data as item, index (getKey(item, index))}
|
|
56
|
+
<Rect
|
|
57
|
+
data-id={index}
|
|
58
|
+
fill={getColor(item, index)}
|
|
59
|
+
fill-opacity={opacity}
|
|
60
|
+
{stroke}
|
|
61
|
+
stroke-width={strokeWidth}
|
|
62
|
+
rx={radius}
|
|
63
|
+
{spring}
|
|
64
|
+
{tweened}
|
|
65
|
+
{...$getDimensions(item)}
|
|
66
|
+
{...getProps?.({ value: _y(item), item, index })}
|
|
67
|
+
{...$$restProps}
|
|
68
|
+
/>
|
|
69
|
+
{/each}
|
|
111
70
|
</g>
|
|
@@ -20,7 +20,7 @@ declare const __propDef: {
|
|
|
20
20
|
item: any;
|
|
21
21
|
index: number;
|
|
22
22
|
}) => any) | undefined;
|
|
23
|
-
|
|
23
|
+
padding?: number | undefined;
|
|
24
24
|
spring?: boolean | Parameters<typeof springStore>[1];
|
|
25
25
|
tweened?: boolean | Parameters<typeof tweenedStore>[1];
|
|
26
26
|
groupBy?: string | undefined;
|
|
@@ -2,29 +2,29 @@
|
|
|
2
2
|
import { getContext } from 'svelte';
|
|
3
3
|
import { cls } from 'svelte-ux';
|
|
4
4
|
import { isScaleBand } from '../utils/scales';
|
|
5
|
-
const {
|
|
5
|
+
const { xScale, yScale, xRange, yRange } = getContext('LayerCake');
|
|
6
6
|
export let x = false;
|
|
7
7
|
export let y = false;
|
|
8
8
|
</script>
|
|
9
9
|
|
|
10
10
|
<g class="baseline">
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
{#if x}
|
|
12
|
+
<line
|
|
13
|
+
x1={0}
|
|
14
|
+
x2={max($xRange) || 0}
|
|
15
|
+
y1={isScaleBand($yScale) ? max($yRange) : $yScale(0) || 0}
|
|
16
|
+
y2={isScaleBand($yScale) ? max($yRange) : $yScale(0) || 0}
|
|
17
|
+
class={cls('stroke-gray-400', $$props.class)}
|
|
18
|
+
/>
|
|
19
|
+
{/if}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
21
|
+
{#if y}
|
|
22
|
+
<line
|
|
23
|
+
x1={isScaleBand($xScale) ? min($xRange) : $xScale(0) || 0}
|
|
24
|
+
x2={isScaleBand($xScale) ? min($xRange) : $xScale(0) || 0}
|
|
25
|
+
y1={min($yRange) || 0}
|
|
26
|
+
y2={max($yRange) || 0}
|
|
27
|
+
class={cls('stroke-gray-400', $$props.class)}
|
|
28
|
+
/>
|
|
29
|
+
{/if}
|
|
30
30
|
</g>
|
|
@@ -4,13 +4,13 @@ export let stdDeviation = 5;
|
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
6
|
<defs>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
<filter {id}>
|
|
8
|
+
<feGaussianBlur in="SourceGraphic" {stdDeviation} />
|
|
9
|
+
</filter>
|
|
10
10
|
</defs>
|
|
11
11
|
|
|
12
12
|
{#if $$slots.default}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
<g filter="url(#{id})">
|
|
14
|
+
<slot {id} />
|
|
15
|
+
</g>
|
|
16
16
|
{/if}
|
|
@@ -64,51 +64,51 @@ export let geo = undefined;
|
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
66
|
<LayerCake
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
67
|
+
{data}
|
|
68
|
+
{x}
|
|
69
|
+
{xDomain}
|
|
70
|
+
{y}
|
|
71
|
+
{yScale}
|
|
72
|
+
{yDomain}
|
|
73
|
+
{yReverse}
|
|
74
|
+
{...$$restProps}
|
|
75
|
+
let:aspectRatio
|
|
76
|
+
let:containerHeight
|
|
77
|
+
let:containerWidth
|
|
78
|
+
let:height
|
|
79
|
+
let:width
|
|
80
|
+
let:element
|
|
81
|
+
let:xScale
|
|
82
|
+
let:yScale
|
|
83
83
|
>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
84
|
+
<GeoContext {...geo} let:projection>
|
|
85
|
+
{#if tooltip}
|
|
86
|
+
<TooltipContext {...tooltip} let:tooltip>
|
|
87
|
+
<slot
|
|
88
|
+
{aspectRatio}
|
|
89
|
+
{containerHeight}
|
|
90
|
+
{containerWidth}
|
|
91
|
+
{height}
|
|
92
|
+
{width}
|
|
93
|
+
{element}
|
|
94
|
+
{projection}
|
|
95
|
+
{tooltip}
|
|
96
|
+
{xScale}
|
|
97
|
+
{yScale}
|
|
98
|
+
/>
|
|
99
|
+
</TooltipContext>
|
|
100
|
+
{:else}
|
|
101
|
+
<slot
|
|
102
|
+
{aspectRatio}
|
|
103
|
+
{containerHeight}
|
|
104
|
+
{containerWidth}
|
|
105
|
+
{height}
|
|
106
|
+
{width}
|
|
107
|
+
{element}
|
|
108
|
+
{projection}
|
|
109
|
+
{xScale}
|
|
110
|
+
{yScale}
|
|
111
|
+
/>
|
|
112
|
+
{/if}
|
|
113
|
+
</GeoContext>
|
|
114
114
|
</LayerCake>
|
|
@@ -4,12 +4,12 @@ const { width, height, padding } = getContext('LayerCake');
|
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
6
|
<RectClipPath
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
x={-$padding.left}
|
|
8
|
+
y={-$padding.top}
|
|
9
|
+
width={$width + $padding.left + $padding.right}
|
|
10
|
+
height={$height + $padding.top + $padding.bottom}
|
|
11
|
+
on:click
|
|
12
|
+
{...$$restProps}
|
|
13
13
|
>
|
|
14
|
-
|
|
14
|
+
<slot />
|
|
15
15
|
</RectClipPath>
|
|
@@ -13,11 +13,11 @@ $: tweened_r.set(r);
|
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
15
|
<circle
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
cx={$tweened_cx}
|
|
17
|
+
cy={$tweened_cy}
|
|
18
|
+
r={$tweened_r}
|
|
19
|
+
{...$$restProps}
|
|
20
|
+
on:click
|
|
21
|
+
on:mousemove
|
|
22
|
+
on:mouseleave
|
|
23
23
|
/>
|
|
@@ -11,11 +11,11 @@ export let tweened = undefined;
|
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<ClipPath {id}>
|
|
14
|
-
|
|
14
|
+
<Circle {cx} {cy} {r} {spring} {tweened} />
|
|
15
15
|
</ClipPath>
|
|
16
16
|
|
|
17
17
|
{#if $$slots.default}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
<g style="clip-path: url(#{id})" on:click on:mousemove on:mouseleave>
|
|
19
|
+
<slot {id} />
|
|
20
|
+
</g>
|
|
21
21
|
{/if}
|