layerchart 0.16.0 → 0.17.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 +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 +30 -30
- 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 +21 -16
- 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
|
@@ -7,11 +7,11 @@ export let clipPathId = uniqueId('clipPath-');
|
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<ClipPath id={clipPathId}>
|
|
10
|
-
|
|
10
|
+
<use href="#{refId}" />
|
|
11
11
|
</ClipPath>
|
|
12
12
|
|
|
13
13
|
{#if $$slots.default}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
<g style="clip-path: url(#{clipPathId})" on:click on:mousemove on:mouseleave on:keydown>
|
|
15
|
+
<slot {refId} {clipPathId} />
|
|
16
|
+
</g>
|
|
17
17
|
{/if}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script>/*
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
2
|
+
TODO:
|
|
3
|
+
- [ ] Consider becoming LinkLine using d3-path buider https://github.com/d3/d3-path
|
|
4
|
+
- https://github.com/airbnb/visx/blob/master/packages/visx-shape/src/shapes/link/line/LinkHorizontalLine.tsx
|
|
5
|
+
*/
|
|
6
6
|
import { getContext } from 'svelte';
|
|
7
7
|
import { extent } from 'd3-array';
|
|
8
8
|
import Line from './Line.svelte';
|
|
@@ -28,9 +28,9 @@ function getOffset(value, offset, scale) {
|
|
|
28
28
|
$: points = $data.flatMap((d) => {
|
|
29
29
|
if (Array.isArray($config.x)) {
|
|
30
30
|
/*
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
x={["prop1" ,"prop2"]}
|
|
32
|
+
y="prop3"
|
|
33
|
+
*/
|
|
34
34
|
const [xMin, xMax] = extent($xGet(d));
|
|
35
35
|
return {
|
|
36
36
|
x1: xMin + getOffset(xMin, offsetX, $xScale),
|
|
@@ -41,9 +41,9 @@ $: points = $data.flatMap((d) => {
|
|
|
41
41
|
}
|
|
42
42
|
else if (Array.isArray($config.y)) {
|
|
43
43
|
/*
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
x="prop1"
|
|
45
|
+
y={["prop2" ,"prop3"]}
|
|
46
|
+
*/
|
|
47
47
|
const [yMin, yMax] = extent($yGet(d));
|
|
48
48
|
return {
|
|
49
49
|
x1: $xGet(d) + getOffset($xGet(d), offsetX, $xScale),
|
|
@@ -54,9 +54,9 @@ $: points = $data.flatMap((d) => {
|
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
56
|
/*
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
x="prop1"
|
|
58
|
+
y="prop2"
|
|
59
|
+
*/
|
|
60
60
|
// Not really supported (nothing to connect...)
|
|
61
61
|
return {
|
|
62
62
|
x1: $xGet(d) + getOffset($xGet(d), offsetX, $xScale),
|
|
@@ -69,7 +69,7 @@ $: points = $data.flatMap((d) => {
|
|
|
69
69
|
</script>
|
|
70
70
|
|
|
71
71
|
<g class="connected-points">
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
72
|
+
{#each points as p}
|
|
73
|
+
<Line x1={p.x1} y1={p.y1} x2={p.x2} y2={p.y2} {...$$restProps} />
|
|
74
|
+
{/each}
|
|
75
75
|
</g>
|
|
@@ -42,15 +42,15 @@ $: if (renderContext === 'canvas' && $ctx) {
|
|
|
42
42
|
</script>
|
|
43
43
|
|
|
44
44
|
{#if renderContext === 'svg'}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
<slot {geoPath}>
|
|
46
|
+
<path
|
|
47
|
+
d={geoPath(geojson)}
|
|
48
|
+
fill={fill || (fillScale && $rGet(fillScale)) || 'transparent'}
|
|
49
|
+
stroke={stroke || 'black'}
|
|
50
|
+
on:mousemove={(e) => tooltip?.show(e, geojson)}
|
|
51
|
+
on:mouseleave={(e) => tooltip?.hide()}
|
|
52
|
+
on:click={(event) => dispatch('click', { geoPath, event })}
|
|
53
|
+
{...$$restProps}
|
|
54
|
+
/>
|
|
55
|
+
</slot>
|
|
56
56
|
{/if}
|
|
@@ -39,9 +39,9 @@ $: if (renderContext === 'canvas' && $ctx && url) {
|
|
|
39
39
|
</script>
|
|
40
40
|
|
|
41
41
|
{#if renderContext === 'svg' && url}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
<slot {tiles}>
|
|
43
|
+
{#each tiles as [x, y, z] (url(x, y, z))}
|
|
44
|
+
<TileImage {url} {x} {y} {z} {tx} {ty} {k} {disableCache} {debug} />
|
|
45
|
+
{/each}
|
|
46
|
+
</slot>
|
|
47
47
|
{/if}
|
|
@@ -9,18 +9,18 @@ $: graticule.step(step);
|
|
|
9
9
|
</script>
|
|
10
10
|
|
|
11
11
|
<g class="graticule">
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
<!-- TODO: Any reason to still render the single `MultiLineString` path if using `lines` and/or `outline` -->
|
|
13
|
+
{#if !lines && !outline}
|
|
14
|
+
<GeoPath geojson={graticule()} {...$$restProps} />
|
|
15
|
+
{/if}
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
{#if lines}
|
|
18
|
+
{#each graticule.lines() as line}
|
|
19
|
+
<GeoPath geojson={line} {...lines} />
|
|
20
|
+
{/each}
|
|
21
|
+
{/if}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
{#if outline}
|
|
24
|
+
<GeoPath geojson={graticule.outline()} {...outline} />
|
|
25
|
+
{/if}
|
|
26
26
|
</g>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script>import { getContext } from 'svelte';
|
|
2
|
-
import { get } from 'svelte/store';
|
|
3
2
|
import { max } from 'd3-array';
|
|
3
|
+
import { notNull } from 'svelte-ux';
|
|
4
4
|
import { isScaleBand } from '../utils/scales';
|
|
5
5
|
import Circle from './Circle.svelte';
|
|
6
6
|
import Line from './Line.svelte';
|
|
@@ -10,7 +10,7 @@ const tooltip = tooltipContext();
|
|
|
10
10
|
export let color = undefined;
|
|
11
11
|
export let axis = 'x';
|
|
12
12
|
// TODO: Fix circle points being backwards for stack (see AreaStack)
|
|
13
|
-
function getColor(item, index =
|
|
13
|
+
function getColor(item, index = -1) {
|
|
14
14
|
if (color) {
|
|
15
15
|
if (typeof color === 'function') {
|
|
16
16
|
return color({ value: $y(item), item, index });
|
|
@@ -40,7 +40,7 @@ $: if ($tooltip.data) {
|
|
|
40
40
|
// `x` accessor with multiple properties (ex. `x={['start', 'end']})`)
|
|
41
41
|
lines = [
|
|
42
42
|
...lines,
|
|
43
|
-
...x.map((xItem, i) => ({
|
|
43
|
+
...x.filter(notNull).map((xItem, i) => ({
|
|
44
44
|
x1: xItem + xOffset,
|
|
45
45
|
y1: 0,
|
|
46
46
|
x2: xItem + xOffset,
|
|
@@ -65,7 +65,7 @@ $: if ($tooltip.data) {
|
|
|
65
65
|
// `y` accessor with multiple properties (ex. `y={['start', 'end']})`)
|
|
66
66
|
lines = [
|
|
67
67
|
...lines,
|
|
68
|
-
...y.map((yItem, i) => ({
|
|
68
|
+
...y.filter(notNull).map((yItem, i) => ({
|
|
69
69
|
x1: 0,
|
|
70
70
|
y1: yItem + yOffset,
|
|
71
71
|
x2: max($xRange),
|
|
@@ -87,7 +87,7 @@ $: if ($tooltip.data) {
|
|
|
87
87
|
}
|
|
88
88
|
if (Array.isArray(x)) {
|
|
89
89
|
// `x` accessor with multiple properties (ex. `x={['start', 'end']})`)
|
|
90
|
-
points = x.map((xItem, i) => ({
|
|
90
|
+
points = x.filter(notNull).map((xItem, i) => ({
|
|
91
91
|
x: xItem + xOffset,
|
|
92
92
|
y: $yGet($tooltip.data) + yOffset,
|
|
93
93
|
color: getColor($tooltip.data) // TODO: improve
|
|
@@ -115,30 +115,30 @@ $: if ($tooltip.data) {
|
|
|
115
115
|
</script>
|
|
116
116
|
|
|
117
117
|
{#if $tooltip.data}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
118
|
+
{#each lines as line}
|
|
119
|
+
<Line
|
|
120
|
+
spring
|
|
121
|
+
x1={line.x1}
|
|
122
|
+
y1={line.y1}
|
|
123
|
+
x2={line.x2}
|
|
124
|
+
y2={line.y2}
|
|
125
|
+
stroke="rgba(0,0,0,.5)"
|
|
126
|
+
stroke-width={2}
|
|
127
|
+
style="pointerEvents: none"
|
|
128
|
+
stroke-dasharray="2,2"
|
|
129
|
+
/>
|
|
130
|
+
{/each}
|
|
131
131
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
132
|
+
{#each points as point}
|
|
133
|
+
<Circle
|
|
134
|
+
spring
|
|
135
|
+
cx={point.x}
|
|
136
|
+
cy={point.y}
|
|
137
|
+
r={7}
|
|
138
|
+
fill="rgba(255,255,255,.9)"
|
|
139
|
+
stroke={point.color}
|
|
140
|
+
stroke-width={2}
|
|
141
|
+
/>
|
|
142
|
+
<Circle spring cx={point.x} cy={point.y} r={3} fill={point.color} />
|
|
143
|
+
{/each}
|
|
144
144
|
{/if}
|
|
@@ -4,79 +4,39 @@
|
|
|
4
4
|
* - [ ] Support multiple values (threshold, stacks, etc)
|
|
5
5
|
*/
|
|
6
6
|
import { getContext } from 'svelte';
|
|
7
|
-
import { scaleBand } from 'd3-scale';
|
|
8
|
-
import { max, min } from 'd3-array';
|
|
9
7
|
import Text from './Text.svelte';
|
|
10
8
|
import { format as formatValue } from 'svelte-ux';
|
|
11
9
|
import { formatNumberAsStyle } from 'svelte-ux/utils/number';
|
|
12
|
-
import { greatestAbs
|
|
10
|
+
import { greatestAbs } from 'svelte-ux/utils/array';
|
|
13
11
|
import { isScaleBand } from '../utils/scales';
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
import { createDimensionGetter } from '../utils/rect';
|
|
13
|
+
const { flatData, yScale, x, y, custom } = getContext('LayerCake');
|
|
14
|
+
// export let orientation: 'outside' | 'inside' | 'auto' = 'auto';
|
|
16
15
|
export let significantDigits = 3;
|
|
17
16
|
export let format = undefined;
|
|
18
17
|
export let formatStyle = null;
|
|
19
|
-
export let overlap = false;
|
|
18
|
+
// export let overlap = false;
|
|
20
19
|
$: yBaseline = $custom?.yBaseline ?? 0;
|
|
21
20
|
export let groupBy = undefined;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
width = groupBy ? x1Scale.bandwidth() : $xScale.bandwidth();
|
|
33
|
-
x += (groupBy ? x1Scale(item[groupBy]) : 0) + width / 2;
|
|
34
|
-
}
|
|
35
|
-
const yValue = $y(item);
|
|
36
|
-
let yTop = 0;
|
|
37
|
-
let yBottom = 0;
|
|
38
|
-
if (Array.isArray(yValue)) {
|
|
39
|
-
// Array contains both top and bottom values;
|
|
40
|
-
yTop = max(yValue);
|
|
41
|
-
yBottom = min(yValue);
|
|
42
|
-
}
|
|
43
|
-
else if (yValue == null) {
|
|
44
|
-
// null/undefined value
|
|
45
|
-
yTop = 0;
|
|
46
|
-
yBottom = 0;
|
|
47
|
-
}
|
|
48
|
-
else if (yValue > 0) {
|
|
49
|
-
// Positive value
|
|
50
|
-
yTop = yValue;
|
|
51
|
-
yBottom = min($yRange); // or `0`?
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
// Negative value
|
|
55
|
-
yTop = min($yRange); // or `0`?
|
|
56
|
-
yBottom = yValue;
|
|
57
|
-
}
|
|
58
|
-
if (yBottom < 0) {
|
|
59
|
-
// Show label below
|
|
60
|
-
return {
|
|
61
|
-
x,
|
|
62
|
-
y: $yScale(yBottom),
|
|
63
|
-
dy: '0.5em',
|
|
64
|
-
width
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
// Show label above
|
|
69
|
-
return {
|
|
70
|
-
x,
|
|
71
|
-
y: $yScale(yTop),
|
|
72
|
-
dy: '-0.6em',
|
|
73
|
-
width
|
|
74
|
-
};
|
|
21
|
+
export let groupPaddingInner = 0.2;
|
|
22
|
+
export let groupPaddingOuter = 0;
|
|
23
|
+
$: getDimensions = createDimensionGetter(getContext('LayerCake'), {
|
|
24
|
+
// x,
|
|
25
|
+
// y,
|
|
26
|
+
groupBy,
|
|
27
|
+
// padding,
|
|
28
|
+
groupPadding: {
|
|
29
|
+
inner: groupPaddingInner,
|
|
30
|
+
outer: groupPaddingOuter
|
|
75
31
|
}
|
|
32
|
+
});
|
|
33
|
+
$: getValue = (item) => (isScaleBand($yScale) ? $x(item) : $y(item));
|
|
34
|
+
$: getLabelValue = (item) => {
|
|
35
|
+
const value = getValue(item);
|
|
36
|
+
return (Array.isArray(value) ? greatestAbs(value) : value) + yBaseline;
|
|
76
37
|
};
|
|
77
|
-
$:
|
|
78
|
-
const
|
|
79
|
-
const labelValue = (Array.isArray(value) ? greatestAbs(value) : value) + yBaseline;
|
|
38
|
+
$: getFormattedValue = (item) => {
|
|
39
|
+
const labelValue = getLabelValue(item);
|
|
80
40
|
let formattedValue = labelValue;
|
|
81
41
|
if (labelValue != null) {
|
|
82
42
|
if (format) {
|
|
@@ -90,17 +50,66 @@ $: getValue = (item) => {
|
|
|
90
50
|
}
|
|
91
51
|
return formattedValue ?? '';
|
|
92
52
|
};
|
|
53
|
+
$: getTextProps = (item) => {
|
|
54
|
+
const labelValue = getLabelValue(item);
|
|
55
|
+
const dimensions = $getDimensions(item);
|
|
56
|
+
if (isScaleBand($yScale)) {
|
|
57
|
+
// Position label left/right on horizontal bars
|
|
58
|
+
if (labelValue < 0) {
|
|
59
|
+
// left
|
|
60
|
+
return {
|
|
61
|
+
x: dimensions?.x - 4,
|
|
62
|
+
y: dimensions?.y + (dimensions?.height ?? 0) / 2,
|
|
63
|
+
textAnchor: 'end',
|
|
64
|
+
verticalAnchor: 'middle',
|
|
65
|
+
capHeight: '.6rem'
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
// right
|
|
70
|
+
return {
|
|
71
|
+
x: dimensions?.x + dimensions?.width + 4,
|
|
72
|
+
y: dimensions?.y + (dimensions?.height ?? 0) / 2,
|
|
73
|
+
textAnchor: 'start',
|
|
74
|
+
verticalAnchor: 'middle',
|
|
75
|
+
capHeight: '.6rem'
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
// Position label top/bottom on vertical bars
|
|
81
|
+
if (labelValue < 0) {
|
|
82
|
+
// bottom
|
|
83
|
+
return {
|
|
84
|
+
x: dimensions?.x + (dimensions?.width ?? 0) / 2,
|
|
85
|
+
y: dimensions?.y + dimensions?.height,
|
|
86
|
+
dy: '0.5em',
|
|
87
|
+
textAnchor: 'middle',
|
|
88
|
+
verticalAnchor: 'middle'
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// top
|
|
93
|
+
return {
|
|
94
|
+
x: dimensions?.x + (dimensions?.width ?? 0) / 2,
|
|
95
|
+
y: dimensions?.y,
|
|
96
|
+
dy: '-0.6em',
|
|
97
|
+
textAnchor: 'middle',
|
|
98
|
+
verticalAnchor: 'middle'
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
93
103
|
</script>
|
|
94
104
|
|
|
95
|
-
<g class="
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
{/each}
|
|
105
|
+
<g class="Labels">
|
|
106
|
+
{#each $flatData as item, index}
|
|
107
|
+
<!-- TODO: Add labels for each item when array/stack? Use `getValue(item)` instead and iterate -->
|
|
108
|
+
<Text
|
|
109
|
+
value={getFormattedValue(item)}
|
|
110
|
+
class="text-xs stroke-white [stroke-width:2px]"
|
|
111
|
+
{...getTextProps(item)}
|
|
112
|
+
{...$$restProps}
|
|
113
|
+
/>
|
|
114
|
+
{/each}
|
|
106
115
|
</g>
|
|
@@ -3,12 +3,12 @@ import { type FormatType } from 'svelte-ux';
|
|
|
3
3
|
declare const __propDef: {
|
|
4
4
|
props: {
|
|
5
5
|
[x: string]: any;
|
|
6
|
-
orientation?: "auto" | "outside" | "inside" | undefined;
|
|
7
6
|
significantDigits?: number | undefined;
|
|
8
7
|
format?: FormatType;
|
|
9
8
|
formatStyle?: any;
|
|
10
|
-
overlap?: boolean | undefined;
|
|
11
9
|
groupBy?: string | undefined;
|
|
10
|
+
groupPaddingInner?: number | undefined;
|
|
11
|
+
groupPaddingOuter?: number | undefined;
|
|
12
12
|
};
|
|
13
13
|
events: {
|
|
14
14
|
[evt: string]: CustomEvent<any>;
|
|
@@ -101,64 +101,64 @@ else {
|
|
|
101
101
|
</script>
|
|
102
102
|
|
|
103
103
|
<div
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
104
|
+
class={cls(
|
|
105
|
+
'inline-block',
|
|
106
|
+
{
|
|
107
|
+
'top-left': 'absolute top-0 left-0',
|
|
108
|
+
top: 'absolute top-0 left-1/2 -translate-x-1/2',
|
|
109
|
+
'top-right': 'absolute top-0 right-0',
|
|
110
|
+
left: 'absolute top-1/2 left-0 -translate-y-1/2',
|
|
111
|
+
center: 'absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2',
|
|
112
|
+
right: 'absolute top-1/2 right-0 -translate-y-1/2',
|
|
113
|
+
'bottom-left': 'absolute bottom-0 left-0',
|
|
114
|
+
bottom: 'absolute bottom-0 left-1/2 -translate-x-1/2',
|
|
115
|
+
'bottom-right': 'absolute bottom-0 right-0'
|
|
116
|
+
}[placement],
|
|
117
|
+
classes.root
|
|
118
|
+
)}
|
|
119
|
+
{...$$restProps}
|
|
120
120
|
>
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
121
|
+
<div class={cls('text-[10px] font-semibold', classes.title)}>{title}</div>
|
|
122
|
+
<slot values={tickValues} {scale}>
|
|
123
|
+
<svg
|
|
124
|
+
{width}
|
|
125
|
+
height={height + tickSize + tickFontSize}
|
|
126
|
+
viewBox="0 0 {width} {height + tickSize + tickFontSize}"
|
|
127
|
+
class="overflow-visible"
|
|
128
|
+
>
|
|
129
|
+
<g>
|
|
130
|
+
{#if interpolator}
|
|
131
|
+
<ColorRamp {width} {height} {interpolator} />
|
|
132
|
+
{:else if swatches}
|
|
133
|
+
{#each swatches as swatch, i}
|
|
134
|
+
<rect {...swatch} />
|
|
135
|
+
{/each}
|
|
136
|
+
{/if}
|
|
137
|
+
</g>
|
|
138
138
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
139
|
+
<g>
|
|
140
|
+
{#each tickValues ?? xScale?.ticks?.(ticks) ?? [] as tick, i}
|
|
141
|
+
<text
|
|
142
|
+
text-anchor="middle"
|
|
143
|
+
x={xScale(tick) + tickLabelOffset}
|
|
144
|
+
y={height + tickSize + tickFontSize}
|
|
145
|
+
style:font-size={tickFontSize}
|
|
146
|
+
class={classes.label}
|
|
147
|
+
>
|
|
148
|
+
{tickFormat ? format(tick, tickFormat) : tick}
|
|
149
|
+
</text>
|
|
150
150
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
151
|
+
{#if tickLine}
|
|
152
|
+
<line
|
|
153
|
+
x1={xScale(tick)}
|
|
154
|
+
y1={0}
|
|
155
|
+
x2={xScale(tick)}
|
|
156
|
+
y2={height + tickSize}
|
|
157
|
+
class={cls('stroke-black', classes.tick)}
|
|
158
|
+
/>
|
|
159
|
+
{/if}
|
|
160
|
+
{/each}
|
|
161
|
+
</g>
|
|
162
|
+
</svg>
|
|
163
|
+
</slot>
|
|
164
164
|
</div>
|
|
@@ -12,7 +12,7 @@ declare const __propDef: {
|
|
|
12
12
|
tickValues?: any[] | undefined;
|
|
13
13
|
tickFontSize?: number | undefined;
|
|
14
14
|
tickSize?: number | undefined;
|
|
15
|
-
placement?: ("
|
|
15
|
+
placement?: ("top" | "bottom" | "left" | "right" | "center" | "top-left" | "top-right" | "bottom-left" | "bottom-right") | undefined;
|
|
16
16
|
classes?: {
|
|
17
17
|
root?: string | undefined;
|
|
18
18
|
title?: string | undefined;
|
|
@@ -16,12 +16,12 @@ $: tweened_y2.set(y2);
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<line
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
x1={$tweened_x1}
|
|
20
|
+
y1={$tweened_y1}
|
|
21
|
+
x2={$tweened_x2}
|
|
22
|
+
y2={$tweened_y2}
|
|
23
|
+
{...$$restProps}
|
|
24
|
+
on:click
|
|
25
|
+
on:mousemove
|
|
26
|
+
on:mouseleave
|
|
27
27
|
/>
|