svelteplot 0.10.3 → 0.11.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/Mark.svelte +42 -25
- package/dist/Mark.svelte.d.ts +111 -32
- package/dist/Plot.svelte +21 -15
- package/dist/core/Facet.svelte +1 -1
- package/dist/core/FacetAxes.svelte +13 -8
- package/dist/core/FacetGrid.svelte +4 -4
- package/dist/core/Plot.svelte +41 -35
- package/dist/helpers/autoScales.d.ts +3 -3
- package/dist/helpers/autoScales.js +28 -18
- package/dist/helpers/autoTicks.js +2 -0
- package/dist/helpers/callWithProps.d.ts +1 -2
- package/dist/helpers/facets.js +0 -1
- package/dist/helpers/index.js +1 -1
- package/dist/helpers/mergeDeep.d.ts +1 -3
- package/dist/helpers/mergeDeep.js +15 -16
- package/dist/helpers/projection.d.ts +4 -3
- package/dist/helpers/projection.js +17 -5
- package/dist/helpers/reduce.d.ts +4 -4
- package/dist/helpers/reduce.js +6 -4
- package/dist/helpers/regressionLoess.js +2 -1
- package/dist/helpers/resolve.d.ts +6 -3
- package/dist/helpers/resolve.js +25 -16
- package/dist/helpers/scales.d.ts +10 -10
- package/dist/helpers/scales.js +43 -13
- package/dist/helpers/time.d.ts +10 -3
- package/dist/helpers/time.js +2 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/plotDefaults.d.ts +3 -1
- package/dist/hooks/plotDefaults.js +33 -1
- package/dist/hooks/usePlot.svelte.d.ts +10 -25
- package/dist/hooks/usePlot.svelte.js +8 -7
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -3
- package/dist/marks/Area.svelte +24 -13
- package/dist/marks/Area.svelte.d.ts +118 -34
- package/dist/marks/AreaX.svelte +42 -8
- package/dist/marks/AreaX.svelte.d.ts +154 -71
- package/dist/marks/AreaY.svelte +42 -8
- package/dist/marks/AreaY.svelte.d.ts +154 -71
- package/dist/marks/Arrow.svelte +42 -23
- package/dist/marks/Arrow.svelte.d.ts +114 -35
- package/dist/marks/AxisX.svelte +43 -28
- package/dist/marks/AxisX.svelte.d.ts +125 -40
- package/dist/marks/AxisY.svelte +43 -26
- package/dist/marks/AxisY.svelte.d.ts +127 -40
- package/dist/marks/BarX.svelte +12 -10
- package/dist/marks/BarX.svelte.d.ts +104 -32
- package/dist/marks/BarY.svelte +11 -10
- package/dist/marks/BarY.svelte.d.ts +106 -34
- package/dist/marks/BollingerX.svelte +4 -7
- package/dist/marks/BollingerX.svelte.d.ts +105 -30
- package/dist/marks/BollingerY.svelte +3 -0
- package/dist/marks/BollingerY.svelte.d.ts +105 -30
- package/dist/marks/BoxX.svelte +3 -3
- package/dist/marks/BoxY.svelte +12 -9
- package/dist/marks/BoxY.svelte.d.ts +128 -53
- package/dist/marks/Brush.svelte +26 -21
- package/dist/marks/Brush.svelte.d.ts +119 -60
- package/dist/marks/Cell.svelte +13 -9
- package/dist/marks/Cell.svelte.d.ts +105 -30
- package/dist/marks/CellX.svelte +2 -1
- package/dist/marks/CellX.svelte.d.ts +105 -32
- package/dist/marks/CellY.svelte +2 -1
- package/dist/marks/CellY.svelte.d.ts +105 -32
- package/dist/marks/ColorLegend.svelte +24 -13
- package/dist/marks/ColorLegend.svelte.d.ts +1 -0
- package/dist/marks/CustomMark.svelte +16 -10
- package/dist/marks/CustomMark.svelte.d.ts +112 -31
- package/dist/marks/CustomMarkHTML.svelte +8 -2
- package/dist/marks/CustomMarkHTML.svelte.d.ts +8 -2
- package/dist/marks/DifferenceY.svelte +31 -20
- package/dist/marks/DifferenceY.svelte.d.ts +134 -55
- package/dist/marks/Dot.svelte +21 -11
- package/dist/marks/Dot.svelte.d.ts +117 -38
- package/dist/marks/DotX.svelte +2 -0
- package/dist/marks/DotX.svelte.d.ts +136 -62
- package/dist/marks/DotY.svelte +1 -0
- package/dist/marks/DotY.svelte.d.ts +135 -62
- package/dist/marks/Frame.svelte +47 -9
- package/dist/marks/Frame.svelte.d.ts +124 -41
- package/dist/marks/Geo.svelte +21 -12
- package/dist/marks/Geo.svelte.d.ts +105 -30
- package/dist/marks/Graticule.svelte +3 -0
- package/dist/marks/Graticule.svelte.d.ts +3 -0
- package/dist/marks/GridX.svelte +31 -16
- package/dist/marks/GridX.svelte.d.ts +108 -32
- package/dist/marks/GridY.svelte +30 -15
- package/dist/marks/GridY.svelte.d.ts +108 -32
- package/dist/marks/HTMLTooltip.svelte +14 -7
- package/dist/marks/HTMLTooltip.svelte.d.ts +7 -0
- package/dist/marks/Image.svelte +50 -25
- package/dist/marks/Image.svelte.d.ts +117 -35
- package/dist/marks/Line.svelte +67 -44
- package/dist/marks/Line.svelte.d.ts +119 -30
- package/dist/marks/LineX.svelte +2 -1
- package/dist/marks/LineX.svelte.d.ts +142 -69
- package/dist/marks/LineY.svelte +2 -1
- package/dist/marks/LineY.svelte.d.ts +142 -69
- package/dist/marks/Link.svelte +70 -46
- package/dist/marks/Link.svelte.d.ts +126 -41
- package/dist/marks/Pointer.svelte +24 -15
- package/dist/marks/Pointer.svelte.d.ts +7 -0
- package/dist/marks/Rect.svelte +13 -5
- package/dist/marks/Rect.svelte.d.ts +116 -35
- package/dist/marks/RectX.svelte +6 -3
- package/dist/marks/RectX.svelte.d.ts +158 -12
- package/dist/marks/RectY.svelte +6 -3
- package/dist/marks/RectY.svelte.d.ts +158 -12
- package/dist/marks/RegressionX.svelte +13 -6
- package/dist/marks/RegressionX.svelte.d.ts +8 -3
- package/dist/marks/RegressionY.svelte +13 -6
- package/dist/marks/RegressionY.svelte.d.ts +8 -3
- package/dist/marks/RuleX.svelte +18 -11
- package/dist/marks/RuleX.svelte.d.ts +112 -32
- package/dist/marks/RuleY.svelte +19 -12
- package/dist/marks/RuleY.svelte.d.ts +114 -34
- package/dist/marks/Spike.svelte +11 -5
- package/dist/marks/Spike.svelte.d.ts +146 -68
- package/dist/marks/Text.svelte +24 -7
- package/dist/marks/Text.svelte.d.ts +253 -75
- package/dist/marks/TickX.svelte +56 -48
- package/dist/marks/TickX.svelte.d.ts +114 -40
- package/dist/marks/TickY.svelte +59 -51
- package/dist/marks/TickY.svelte.d.ts +117 -43
- package/dist/marks/Trail.svelte +25 -13
- package/dist/marks/Trail.svelte.d.ts +116 -33
- package/dist/marks/Vector.svelte +20 -11
- package/dist/marks/Vector.svelte.d.ts +116 -35
- package/dist/marks/WaffleX.svelte +18 -16
- package/dist/marks/WaffleX.svelte.d.ts +131 -57
- package/dist/marks/WaffleY.svelte +16 -15
- package/dist/marks/WaffleY.svelte.d.ts +129 -56
- package/dist/marks/helpers/Anchor.svelte +17 -2
- package/dist/marks/helpers/Anchor.svelte.d.ts +16 -1
- package/dist/marks/helpers/AreaCanvas.svelte +8 -8
- package/dist/marks/helpers/BaseAxisX.svelte +38 -41
- package/dist/marks/helpers/BaseAxisX.svelte.d.ts +11 -17
- package/dist/marks/helpers/BaseAxisY.svelte +35 -35
- package/dist/marks/helpers/BaseAxisY.svelte.d.ts +12 -15
- package/dist/marks/helpers/Box.svelte +35 -28
- package/dist/marks/helpers/Box.svelte.d.ts +122 -50
- package/dist/marks/helpers/DotCanvas.svelte +11 -9
- package/dist/marks/helpers/GeoCanvas.svelte +7 -6
- package/dist/marks/helpers/LineCanvas.svelte +7 -7
- package/dist/marks/helpers/LinearGradientX.svelte +2 -2
- package/dist/marks/helpers/LinearGradientX.svelte.d.ts +1 -1
- package/dist/marks/helpers/LinearGradientY.svelte +2 -2
- package/dist/marks/helpers/LinearGradientY.svelte.d.ts +1 -1
- package/dist/marks/helpers/Marker.svelte +2 -2
- package/dist/marks/helpers/MarkerPath.svelte +15 -12
- package/dist/marks/helpers/MarkerPath.svelte.d.ts +105 -32
- package/dist/marks/helpers/MultilineText.svelte +24 -17
- package/dist/marks/helpers/MultilineText.svelte.d.ts +1 -1
- package/dist/marks/helpers/RectCanvas.svelte +31 -26
- package/dist/marks/helpers/RectPath.svelte +2 -2
- package/dist/marks/helpers/Regression.svelte +176 -86
- package/dist/marks/helpers/Regression.svelte.d.ts +20 -8
- package/dist/marks/helpers/RuleCanvas.svelte +9 -6
- package/dist/marks/helpers/TextCanvas.svelte +13 -9
- package/dist/marks/helpers/TextCanvas.svelte.d.ts +6 -6
- package/dist/marks/helpers/TickCanvas.svelte +6 -5
- package/dist/marks/helpers/TrailCanvas.svelte +16 -18
- package/dist/marks/helpers/TrailCanvas.svelte.d.ts +3 -5
- package/dist/marks/helpers/canvas.js +16 -9
- package/dist/marks/helpers/events.d.ts +2 -2
- package/dist/marks/helpers/events.js +14 -7
- package/dist/marks/helpers/waffle.d.ts +3 -3
- package/dist/marks/helpers/waffle.js +6 -4
- package/dist/regression/polynomial.d.ts +1 -1
- package/dist/regression/polynomial.js +5 -5
- package/dist/regression/utils/determination.d.ts +1 -1
- package/dist/regression/utils/determination.js +1 -1
- package/dist/regression/utils/geometry.d.ts +1 -1
- package/dist/regression/utils/interpose.d.ts +1 -1
- package/dist/regression/utils/interpose.js +1 -1
- package/dist/regression/utils/points.d.ts +1 -1
- package/dist/transforms/bin.d.ts +3 -3
- package/dist/transforms/bin.js +29 -20
- package/dist/transforms/bollinger.d.ts +8 -0
- package/dist/transforms/bollinger.js +9 -1
- package/dist/transforms/centroid.d.ts +4 -0
- package/dist/transforms/centroid.js +4 -0
- package/dist/transforms/density.d.ts +4 -4
- package/dist/transforms/density.js +20 -13
- package/dist/transforms/dodge.d.ts +12 -1
- package/dist/transforms/dodge.js +15 -6
- package/dist/transforms/group.d.ts +141 -4
- package/dist/transforms/group.js +4 -1
- package/dist/transforms/interval.d.ts +204 -60
- package/dist/transforms/jitter.d.ts +421 -4
- package/dist/transforms/jitter.js +10 -1
- package/dist/transforms/map.d.ts +412 -4
- package/dist/transforms/map.js +3 -3
- package/dist/transforms/normalize.d.ts +276 -5
- package/dist/transforms/normalize.js +5 -3
- package/dist/transforms/recordize.d.ts +17 -5
- package/dist/transforms/recordize.js +13 -9
- package/dist/transforms/rename.d.ts +11 -4
- package/dist/transforms/rename.js +7 -2
- package/dist/transforms/select.d.ts +722 -210
- package/dist/transforms/select.js +13 -1
- package/dist/transforms/shift.d.ts +8 -0
- package/dist/transforms/shift.js +20 -6
- package/dist/transforms/sort.d.ts +13 -258
- package/dist/transforms/sort.js +13 -10
- package/dist/transforms/stack.d.ts +58 -9
- package/dist/transforms/stack.js +27 -11
- package/dist/transforms/window.d.ts +221 -66
- package/dist/transforms/window.js +8 -2
- package/dist/types/axes.d.ts +43 -0
- package/dist/types/axes.js +1 -0
- package/dist/types/channel.d.ts +30 -2
- package/dist/types/data.d.ts +14 -1
- package/dist/types/facet.d.ts +5 -0
- package/dist/types/index.d.ts +33 -8
- package/dist/types/index.js +11 -7
- package/dist/types/mark.d.ts +124 -35
- package/dist/types/plot.d.ts +118 -16
- package/dist/types/scale.d.ts +125 -8
- package/package.json +178 -175
- package/dist/helpers/autoTicks.d.ts +0 -12
|
@@ -1,85 +1,158 @@
|
|
|
1
|
-
import type { DataRecord, ChannelAccessor, LinkableMarkProps } from '../types';
|
|
2
|
-
import { type WaffleOptions } from './helpers/waffle';
|
|
1
|
+
import type { DataRecord, ChannelAccessor, LinkableMarkProps } from '../types/index.js';
|
|
2
|
+
import { type WaffleOptions } from './helpers/waffle.js';
|
|
3
3
|
declare function $$render<Datum extends DataRecord>(): {
|
|
4
4
|
props: Partial<{
|
|
5
|
-
filter: import("../types").ConstantAccessor<boolean, Datum>;
|
|
5
|
+
filter: import("../types/index.js").ConstantAccessor<boolean, Datum>;
|
|
6
6
|
facet: "auto" | "include" | "exclude";
|
|
7
7
|
fx: ChannelAccessor<Datum>;
|
|
8
8
|
fy: ChannelAccessor<Datum>;
|
|
9
|
-
dx: import("../types").ConstantAccessor<number, Datum>;
|
|
10
|
-
dy: import("../types").ConstantAccessor<number, Datum>;
|
|
11
|
-
dodgeX: import("../transforms/dodge").DodgeXOptions;
|
|
12
|
-
dodgeY: import("../transforms/dodge").DodgeYOptions;
|
|
9
|
+
dx: import("../types/index.js").ConstantAccessor<number, Datum>;
|
|
10
|
+
dy: import("../types/index.js").ConstantAccessor<number, Datum>;
|
|
11
|
+
dodgeX: import("../transforms/dodge.js").DodgeXOptions;
|
|
12
|
+
dodgeY: import("../transforms/dodge.js").DodgeYOptions;
|
|
13
13
|
fill: ChannelAccessor<Datum>;
|
|
14
|
-
fillOpacity: import("../types").ConstantAccessor<number, Datum>;
|
|
15
|
-
|
|
14
|
+
fillOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
|
|
15
|
+
fontFamily: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontFamily, Datum>;
|
|
16
|
+
fontSize: import("../types/index.js").ConstantAccessor<number | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "math" | (string & {}) | "large" | "medium" | "small" | "x-large" | "x-small" | "xx-large" | "xx-small" | "xxx-large" | "larger" | "smaller", Datum>;
|
|
17
|
+
fontStyle: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontStyle, Datum>;
|
|
18
|
+
fontVariant: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontVariant, Datum>;
|
|
19
|
+
fontWeight: import("../types/index.js").ConstantAccessor<import("csstype").Property.FontWeight, Datum>;
|
|
20
|
+
letterSpacing: import("../types/index.js").ConstantAccessor<import("csstype").Property.LetterSpacing<0 | (string & {})>, Datum>;
|
|
21
|
+
wordSpacing: import("../types/index.js").ConstantAccessor<import("csstype").Property.WordSpacing<0 | (string & {})>, Datum>;
|
|
22
|
+
textAnchor: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextAnchor, Datum>;
|
|
23
|
+
textTransform: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextTransform, Datum>;
|
|
24
|
+
textDecoration: import("../types/index.js").ConstantAccessor<import("csstype").Property.TextDecoration<0 | (string & {})>, Datum>;
|
|
25
|
+
sort: ((a: import("../types/index.js").RawValue, b: import("../types/index.js").RawValue) => number) | {
|
|
16
26
|
channel: string;
|
|
17
27
|
order?: "ascending" | "descending";
|
|
18
|
-
} | import("../types").ConstantAccessor<import("../types").RawValue, Datum>;
|
|
28
|
+
} | import("../types/index.js").ConstantAccessor<import("../types/index.js").RawValue, Datum>;
|
|
19
29
|
stroke: ChannelAccessor<Datum>;
|
|
20
|
-
strokeWidth: import("../types").ConstantAccessor<number, Datum>;
|
|
21
|
-
strokeOpacity: import("../types").ConstantAccessor<number, Datum>;
|
|
22
|
-
strokeLinejoin: import("../types").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
|
|
23
|
-
strokeLinecap: import("../types").ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
|
|
24
|
-
strokeMiterlimit: import("../types").ConstantAccessor<number, Datum>;
|
|
30
|
+
strokeWidth: import("../types/index.js").ConstantAccessor<number, Datum>;
|
|
31
|
+
strokeOpacity: import("../types/index.js").ConstantAccessor<number, Datum>;
|
|
32
|
+
strokeLinejoin: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinejoin, Datum>;
|
|
33
|
+
strokeLinecap: import("../types/index.js").ConstantAccessor<import("csstype").Property.StrokeLinecap, Datum>;
|
|
34
|
+
strokeMiterlimit: import("../types/index.js").ConstantAccessor<number, Datum>;
|
|
25
35
|
opacity: ChannelAccessor<Datum>;
|
|
26
|
-
strokeDasharray: import("../types").ConstantAccessor<string, Datum>;
|
|
27
|
-
strokeDashoffset: import("../types").ConstantAccessor<number, Datum>;
|
|
28
|
-
|
|
36
|
+
strokeDasharray: import("../types/index.js").ConstantAccessor<string, Datum>;
|
|
37
|
+
strokeDashoffset: import("../types/index.js").ConstantAccessor<number, Datum>;
|
|
38
|
+
blend: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
|
|
39
|
+
mixBlendMode: import("../types/index.js").ConstantAccessor<import("csstype").Property.MixBlendMode, Datum>;
|
|
29
40
|
clipPath: string;
|
|
30
41
|
mask: string;
|
|
31
|
-
imageFilter: import("../types").ConstantAccessor<string, Datum>;
|
|
32
|
-
shapeRendering: import("../types").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
|
|
33
|
-
paintOrder: import("../types").ConstantAccessor<string, Datum>;
|
|
34
|
-
onclick:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
42
|
+
imageFilter: import("../types/index.js").ConstantAccessor<string, Datum>;
|
|
43
|
+
shapeRendering: import("../types/index.js").ConstantAccessor<import("csstype").Property.ShapeRendering, Datum>;
|
|
44
|
+
paintOrder: import("../types/index.js").ConstantAccessor<string, Datum>;
|
|
45
|
+
onclick: (event: Event & {
|
|
46
|
+
currentTarget: SVGPathElement;
|
|
47
|
+
}, datum: Datum, index: number) => void;
|
|
48
|
+
ondblclick: (event: Event & {
|
|
49
|
+
currentTarget: SVGPathElement;
|
|
50
|
+
}, datum: Datum, index: number) => void;
|
|
51
|
+
onmouseup: (event: Event & {
|
|
52
|
+
currentTarget: SVGPathElement;
|
|
53
|
+
}, datum: Datum, index: number) => void;
|
|
54
|
+
onmousedown: (event: Event & {
|
|
55
|
+
currentTarget: SVGPathElement;
|
|
56
|
+
}, datum: Datum, index: number) => void;
|
|
57
|
+
onmouseenter: (event: Event & {
|
|
58
|
+
currentTarget: SVGPathElement;
|
|
59
|
+
}, datum: Datum, index: number) => void;
|
|
60
|
+
onmousemove: (event: Event & {
|
|
61
|
+
currentTarget: SVGPathElement;
|
|
62
|
+
}, datum: Datum, index: number) => void;
|
|
63
|
+
onmouseleave: (event: Event & {
|
|
64
|
+
currentTarget: SVGPathElement;
|
|
65
|
+
}, datum: Datum, index: number) => void;
|
|
66
|
+
onmouseout: (event: Event & {
|
|
67
|
+
currentTarget: SVGPathElement;
|
|
68
|
+
}, datum: Datum, index: number) => void;
|
|
69
|
+
onmouseover: (event: Event & {
|
|
70
|
+
currentTarget: SVGPathElement;
|
|
71
|
+
}, datum: Datum, index: number) => void;
|
|
72
|
+
onpointercancel: (event: Event & {
|
|
73
|
+
currentTarget: SVGPathElement;
|
|
74
|
+
}, datum: Datum, index: number) => void;
|
|
75
|
+
onpointerdown: (event: Event & {
|
|
76
|
+
currentTarget: SVGPathElement;
|
|
77
|
+
}, datum: Datum, index: number) => void;
|
|
78
|
+
onpointerup: (event: Event & {
|
|
79
|
+
currentTarget: SVGPathElement;
|
|
80
|
+
}, datum: Datum, index: number) => void;
|
|
81
|
+
onpointerenter: (event: Event & {
|
|
82
|
+
currentTarget: SVGPathElement;
|
|
83
|
+
}, datum: Datum, index: number) => void;
|
|
84
|
+
onpointerleave: (event: Event & {
|
|
85
|
+
currentTarget: SVGPathElement;
|
|
86
|
+
}, datum: Datum, index: number) => void;
|
|
87
|
+
onpointermove: (event: Event & {
|
|
88
|
+
currentTarget: SVGPathElement;
|
|
89
|
+
}, datum: Datum, index: number) => void;
|
|
90
|
+
onpointerover: (event: Event & {
|
|
91
|
+
currentTarget: SVGPathElement;
|
|
92
|
+
}, datum: Datum, index: number) => void;
|
|
93
|
+
onpointerout: (event: Event & {
|
|
94
|
+
currentTarget: SVGPathElement;
|
|
95
|
+
}, datum: Datum, index: number) => void;
|
|
96
|
+
ondrag: (event: Event & {
|
|
97
|
+
currentTarget: SVGPathElement;
|
|
98
|
+
}, datum: Datum, index: number) => void;
|
|
99
|
+
ondrop: (event: Event & {
|
|
100
|
+
currentTarget: SVGPathElement;
|
|
101
|
+
}, datum: Datum, index: number) => void;
|
|
102
|
+
ondragstart: (event: Event & {
|
|
103
|
+
currentTarget: SVGPathElement;
|
|
104
|
+
}, datum: Datum, index: number) => void;
|
|
105
|
+
ondragenter: (event: Event & {
|
|
106
|
+
currentTarget: SVGPathElement;
|
|
107
|
+
}, datum: Datum, index: number) => void;
|
|
108
|
+
ondragleave: (event: Event & {
|
|
109
|
+
currentTarget: SVGPathElement;
|
|
110
|
+
}, datum: Datum, index: number) => void;
|
|
111
|
+
ondragover: (event: Event & {
|
|
112
|
+
currentTarget: SVGPathElement;
|
|
113
|
+
}, datum: Datum, index: number) => void;
|
|
114
|
+
ondragend: (event: Event & {
|
|
115
|
+
currentTarget: SVGPathElement;
|
|
116
|
+
}, datum: Datum, index: number) => void;
|
|
117
|
+
ontouchstart: (event: Event & {
|
|
118
|
+
currentTarget: SVGPathElement;
|
|
119
|
+
}, datum: Datum, index: number) => void;
|
|
120
|
+
ontouchmove: (event: Event & {
|
|
121
|
+
currentTarget: SVGPathElement;
|
|
122
|
+
}, datum: Datum, index: number) => void;
|
|
123
|
+
ontouchend: (event: Event & {
|
|
124
|
+
currentTarget: SVGPathElement;
|
|
125
|
+
}, datum: Datum, index: number) => void;
|
|
126
|
+
ontouchcancel: (event: Event & {
|
|
127
|
+
currentTarget: SVGPathElement;
|
|
128
|
+
}, datum: Datum, index: number) => void;
|
|
129
|
+
oncontextmenu: (event: Event & {
|
|
130
|
+
currentTarget: SVGPathElement;
|
|
131
|
+
}, datum: Datum, index: number) => void;
|
|
132
|
+
onwheel: (event: Event & {
|
|
133
|
+
currentTarget: SVGPathElement;
|
|
134
|
+
}, datum: Datum, index: number) => void;
|
|
64
135
|
class: string;
|
|
65
136
|
style: string;
|
|
66
|
-
cursor: import("../types").ConstantAccessor<import("csstype").Property.Cursor, Datum>;
|
|
137
|
+
cursor: import("../types/index.js").ConstantAccessor<import("csstype").Property.Cursor, Datum>;
|
|
138
|
+
title: import("../types/index.js").ConstantAccessor<string, Datum>;
|
|
67
139
|
}> & LinkableMarkProps<Datum> & WaffleOptions<Datum> & {
|
|
140
|
+
/** the input data array */
|
|
68
141
|
data?: Datum[];
|
|
69
142
|
/**
|
|
70
|
-
* bound to a
|
|
143
|
+
* the horizontal position channel; bound to a band scale
|
|
71
144
|
*/
|
|
72
145
|
x?: ChannelAccessor<Datum>;
|
|
73
146
|
/**
|
|
74
|
-
* bound to a quantitative scale
|
|
147
|
+
* the vertical position channel; bound to a quantitative scale
|
|
75
148
|
*/
|
|
76
149
|
y?: ChannelAccessor<Datum>;
|
|
77
150
|
/**
|
|
78
|
-
* bound to a quantitative scale
|
|
151
|
+
* the starting vertical position; bound to a quantitative scale
|
|
79
152
|
*/
|
|
80
153
|
y1?: ChannelAccessor<Datum>;
|
|
81
154
|
/**
|
|
82
|
-
* bound to a quantitative scale
|
|
155
|
+
* the ending vertical position; bound to a quantitative scale
|
|
83
156
|
*/
|
|
84
157
|
y2?: ChannelAccessor<Datum>;
|
|
85
158
|
};
|
|
@@ -1,21 +1,36 @@
|
|
|
1
1
|
<script lang="ts" generics="Datum extends Record<string, any>">
|
|
2
2
|
import { resolveProp } from '../../helpers/resolve.js';
|
|
3
|
-
import type { ConstantAccessor } from '../../types';
|
|
3
|
+
import type { ConstantAccessor } from '../../types/index.js';
|
|
4
4
|
|
|
5
5
|
interface AnchorProps {
|
|
6
6
|
datum?: Datum;
|
|
7
7
|
options?: {
|
|
8
|
+
/**
|
|
9
|
+
* The URL or URL fragment the hyperlink points to.
|
|
10
|
+
*/
|
|
8
11
|
href?: ConstantAccessor<string, Datum>;
|
|
12
|
+
/**
|
|
13
|
+
* Where to display the linked URL, e.g. _self, _blank
|
|
14
|
+
*/
|
|
9
15
|
target?: ConstantAccessor<string, Datum>;
|
|
16
|
+
/**
|
|
17
|
+
* The relationship of the target object to the link object.
|
|
18
|
+
*/
|
|
10
19
|
rel?: ConstantAccessor<string, Datum>;
|
|
20
|
+
/**
|
|
21
|
+
* A MIME type for the linked URL.
|
|
22
|
+
*/
|
|
11
23
|
type?: ConstantAccessor<string, Datum>;
|
|
24
|
+
/**
|
|
25
|
+
* Instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file.
|
|
26
|
+
*/
|
|
12
27
|
download?: ConstantAccessor<string, Datum>;
|
|
13
28
|
[key: string]: any;
|
|
14
29
|
};
|
|
15
30
|
children?: () => any;
|
|
16
31
|
}
|
|
17
32
|
|
|
18
|
-
let { datum = {}, options = {}, children }: AnchorProps = $props();
|
|
33
|
+
let { datum = {} as Datum, options = {}, children }: AnchorProps = $props();
|
|
19
34
|
|
|
20
35
|
const href = $derived(resolveProp(options.href, datum, null));
|
|
21
36
|
const target = $derived(resolveProp(options.target, datum, null));
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
import type { ConstantAccessor } from '../../types';
|
|
1
|
+
import type { ConstantAccessor } from '../../types/index.js';
|
|
2
2
|
declare function $$render<Datum extends Record<string, any>>(): {
|
|
3
3
|
props: {
|
|
4
4
|
datum?: Datum;
|
|
5
5
|
options?: {
|
|
6
|
+
/**
|
|
7
|
+
* The URL or URL fragment the hyperlink points to.
|
|
8
|
+
*/
|
|
6
9
|
href?: ConstantAccessor<string, Datum>;
|
|
10
|
+
/**
|
|
11
|
+
* Where to display the linked URL, e.g. _self, _blank
|
|
12
|
+
*/
|
|
7
13
|
target?: ConstantAccessor<string, Datum>;
|
|
14
|
+
/**
|
|
15
|
+
* The relationship of the target object to the link object.
|
|
16
|
+
*/
|
|
8
17
|
rel?: ConstantAccessor<string, Datum>;
|
|
18
|
+
/**
|
|
19
|
+
* A MIME type for the linked URL.
|
|
20
|
+
*/
|
|
9
21
|
type?: ConstantAccessor<string, Datum>;
|
|
22
|
+
/**
|
|
23
|
+
* Instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a local file.
|
|
24
|
+
*/
|
|
10
25
|
download?: ConstantAccessor<string, Datum>;
|
|
11
26
|
[key: string]: any;
|
|
12
27
|
};
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
const firstPoint = group[0];
|
|
48
48
|
if (!firstPoint || !firstPoint.valid) continue;
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
const { fill, stroke, ...restStyles } = resolveScaledStyleProps(
|
|
51
51
|
firstPoint.datum,
|
|
52
52
|
mark.options,
|
|
53
53
|
usedScales,
|
|
54
54
|
plot,
|
|
55
55
|
'fill'
|
|
56
|
-
);
|
|
56
|
+
) as { fill: string; stroke: string } & Record<string, unknown>;
|
|
57
57
|
|
|
58
58
|
const opacity = maybeOpacity(restStyles['opacity']);
|
|
59
59
|
const fillOpacity = maybeOpacity(restStyles['fill-opacity']);
|
|
@@ -65,23 +65,23 @@
|
|
|
65
65
|
0
|
|
66
66
|
) as number;
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
const fillStyle = resolveColor(fill || 'currentColor', canvas);
|
|
69
|
+
const strokeStyle = resolveColor(stroke, canvas);
|
|
70
70
|
|
|
71
71
|
// Start drawing the area
|
|
72
72
|
context.beginPath();
|
|
73
73
|
areaPath(group);
|
|
74
74
|
|
|
75
75
|
// Fill the area
|
|
76
|
-
if (
|
|
77
|
-
context.fillStyle =
|
|
76
|
+
if (fillStyle && fillStyle !== 'none') {
|
|
77
|
+
context.fillStyle = fillStyle;
|
|
78
78
|
context.globalAlpha = opacity * fillOpacity;
|
|
79
79
|
context.fill();
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
// Stroke the area outline if strokeWidth > 0
|
|
83
|
-
if (
|
|
84
|
-
context.strokeStyle =
|
|
83
|
+
if (strokeStyle && strokeStyle !== 'none' && strokeWidth > 0) {
|
|
84
|
+
context.strokeStyle = strokeStyle;
|
|
85
85
|
context.lineWidth = strokeWidth;
|
|
86
86
|
context.globalAlpha = opacity * strokeOpacity;
|
|
87
87
|
context.stroke();
|
|
@@ -5,42 +5,38 @@
|
|
|
5
5
|
import removeIdenticalLines from '../../helpers/removeIdenticalLines.js';
|
|
6
6
|
import type {
|
|
7
7
|
AutoMarginStores,
|
|
8
|
-
ChannelAccessor,
|
|
9
8
|
ConstantAccessor,
|
|
10
9
|
PlotState,
|
|
10
|
+
PlotScaleFunction,
|
|
11
11
|
RawValue,
|
|
12
12
|
ScaledDataRecord,
|
|
13
13
|
ScaleType
|
|
14
14
|
} from '../../types/index.js';
|
|
15
|
+
import type { AxisTickDatum, AxisXTick, BaseAxisXOptions } from '../../types/axes.js';
|
|
15
16
|
import { resolveProp, resolveStyles } from '../../helpers/resolve.js';
|
|
16
17
|
import { max } from 'd3-array';
|
|
17
18
|
import { randomId, testFilter } from '../../helpers/index.js';
|
|
18
|
-
import { INDEX } from '../../constants';
|
|
19
|
-
import { RAW_VALUE } from '../../transforms/recordize';
|
|
20
|
-
import wordwrap from '../../helpers/wordwrap';
|
|
19
|
+
import { INDEX } from '../../constants.js';
|
|
20
|
+
import { RAW_VALUE } from '../../transforms/recordize.js';
|
|
21
|
+
import wordwrap from '../../helpers/wordwrap.js';
|
|
22
|
+
type AxisDatum = AxisTickDatum<typeof RAW_VALUE, typeof INDEX>;
|
|
23
|
+
type AxisTick = AxisXTick<AxisDatum>;
|
|
21
24
|
|
|
22
25
|
type BaseAxisXProps = {
|
|
23
|
-
scaleFn:
|
|
26
|
+
scaleFn: PlotScaleFunction;
|
|
24
27
|
scaleType: ScaleType;
|
|
25
28
|
ticks: RawValue[];
|
|
26
29
|
tickFormat: (d: RawValue, i: number, ticks: RawValue[]) => string | string[];
|
|
27
|
-
anchor
|
|
28
|
-
tickSize
|
|
29
|
-
tickPadding
|
|
30
|
-
tickFontSize
|
|
31
|
-
tickClass
|
|
30
|
+
anchor?: 'top' | 'bottom';
|
|
31
|
+
tickSize?: number;
|
|
32
|
+
tickPadding?: number;
|
|
33
|
+
tickFontSize?: ConstantAccessor<number>;
|
|
34
|
+
tickClass?: ConstantAccessor<string>;
|
|
32
35
|
marginTop: number;
|
|
33
36
|
height: number;
|
|
34
|
-
title: string;
|
|
35
|
-
options:
|
|
36
|
-
|
|
37
|
-
dy: ConstantAccessor<number>;
|
|
38
|
-
filter: ChannelAccessor;
|
|
39
|
-
wordwrap: boolean;
|
|
40
|
-
textAnchor: ConstantAccessor<'start' | 'middle' | 'end'> | 'auto';
|
|
41
|
-
removeDuplicateTicks: boolean;
|
|
42
|
-
};
|
|
43
|
-
text: boolean;
|
|
37
|
+
title: string | null;
|
|
38
|
+
options: BaseAxisXOptions;
|
|
39
|
+
text?: boolean | null;
|
|
44
40
|
plot: PlotState;
|
|
45
41
|
class: string | undefined;
|
|
46
42
|
};
|
|
@@ -50,16 +46,16 @@
|
|
|
50
46
|
scaleType,
|
|
51
47
|
ticks,
|
|
52
48
|
tickFormat,
|
|
53
|
-
anchor,
|
|
54
|
-
tickSize,
|
|
55
|
-
tickPadding,
|
|
56
|
-
tickFontSize,
|
|
57
|
-
tickClass,
|
|
49
|
+
anchor = 'bottom',
|
|
50
|
+
tickSize = 6,
|
|
51
|
+
tickPadding = 3,
|
|
52
|
+
tickFontSize = 11,
|
|
53
|
+
tickClass = null,
|
|
58
54
|
marginTop,
|
|
59
55
|
height,
|
|
60
56
|
options,
|
|
61
57
|
plot,
|
|
62
|
-
title,
|
|
58
|
+
title = null,
|
|
63
59
|
class: className = 'axis-x',
|
|
64
60
|
text = true
|
|
65
61
|
}: BaseAxisXProps = $props();
|
|
@@ -74,7 +70,7 @@
|
|
|
74
70
|
? wordwrap(tick, {
|
|
75
71
|
maxLineWidth: bandWidth * 0.9,
|
|
76
72
|
minCharactersPerLine: 4,
|
|
77
|
-
fontSize:
|
|
73
|
+
fontSize: Number(resolveProp(tickFontSize, null, 11) ?? 11),
|
|
78
74
|
monospace: false
|
|
79
75
|
})
|
|
80
76
|
: [tick];
|
|
@@ -92,23 +88,24 @@
|
|
|
92
88
|
const { autoMarginTop, autoMarginBottom, autoMarginLeft, autoMarginRight } =
|
|
93
89
|
getContext<AutoMarginStores>('svelteplot/autoMargins');
|
|
94
90
|
|
|
95
|
-
let tickTextElements = $state([] as SVGTextElement[]);
|
|
91
|
+
let tickTextElements = $state([] as (SVGTextElement | undefined)[]);
|
|
92
|
+
const toScaledDatum = (tick: AxisTick) => ({ datum: tick }) as unknown as ScaledDataRecord;
|
|
96
93
|
|
|
97
94
|
const positionedTicks = $derived.by(() => {
|
|
98
95
|
let tickObjects = removeIdenticalLines(
|
|
99
96
|
ticks.map((tick, i) => {
|
|
100
|
-
const datum = { [RAW_VALUE]: tick, [INDEX]: i };
|
|
97
|
+
const datum: AxisDatum = { [RAW_VALUE]: tick, [INDEX]: i };
|
|
101
98
|
return {
|
|
102
99
|
...datum,
|
|
103
100
|
hidden: false,
|
|
104
|
-
dx:
|
|
105
|
-
dy:
|
|
106
|
-
x: scaleFn(tick) + (
|
|
101
|
+
dx: Number(resolveProp(options.dx, datum, 0) ?? 0),
|
|
102
|
+
dy: Number(resolveProp(options.dy, datum, 0) ?? 0),
|
|
103
|
+
x: scaleFn(tick) + (isBandScale ? scaleFn.bandwidth() * 0.5 : 0),
|
|
107
104
|
text: splitTick(tickFormat(tick, i, ticks)),
|
|
108
105
|
element: null as SVGTextElement | null
|
|
109
106
|
};
|
|
110
107
|
})
|
|
111
|
-
);
|
|
108
|
+
) as AxisTick[];
|
|
112
109
|
const T = tickObjects.length;
|
|
113
110
|
if (text) {
|
|
114
111
|
for (let i = 0; i < T; i++) {
|
|
@@ -123,7 +120,7 @@
|
|
|
123
120
|
}
|
|
124
121
|
}
|
|
125
122
|
}
|
|
126
|
-
return tickObjects
|
|
123
|
+
return tickObjects;
|
|
127
124
|
});
|
|
128
125
|
|
|
129
126
|
$effect(() => {
|
|
@@ -153,7 +150,7 @@
|
|
|
153
150
|
return tickTextElements[i].getBoundingClientRect().height;
|
|
154
151
|
return 0;
|
|
155
152
|
}) as number[]
|
|
156
|
-
)
|
|
153
|
+
) ?? 0
|
|
157
154
|
) +
|
|
158
155
|
Math.max(0, tickPadding + tickSize) +
|
|
159
156
|
(title ? 15 : 0);
|
|
@@ -182,7 +179,7 @@
|
|
|
182
179
|
{#each positionedTicks as tick, t (tick[RAW_VALUE])}
|
|
183
180
|
{#if testFilter(tick, options) && !tick.hidden}
|
|
184
181
|
{@const tickClass_ = resolveProp(tickClass, tick)}
|
|
185
|
-
{@const tickFontSize_ =
|
|
182
|
+
{@const tickFontSize_ = Number(resolveProp(tickFontSize, tick, 10) ?? 10)}
|
|
186
183
|
<g
|
|
187
184
|
class="tick {tickClass_ || ''}"
|
|
188
185
|
transform="translate({tick.x + tick.dx}, {tickY + tick.dy})"
|
|
@@ -190,10 +187,10 @@
|
|
|
190
187
|
{#if tickSize}
|
|
191
188
|
{@const [tickLineStyle, tickLineClass] = resolveStyles(
|
|
192
189
|
plot,
|
|
193
|
-
|
|
190
|
+
toScaledDatum(tick),
|
|
194
191
|
options,
|
|
195
192
|
'stroke',
|
|
196
|
-
{ x: true },
|
|
193
|
+
{ x: true } as any,
|
|
197
194
|
true
|
|
198
195
|
)}
|
|
199
196
|
<line
|
|
@@ -204,14 +201,14 @@
|
|
|
204
201
|
|
|
205
202
|
{#if text}
|
|
206
203
|
{@const textLines = tick.text}
|
|
207
|
-
{@const prevTextLines = t
|
|
204
|
+
{@const prevTextLines = t > 0 ? positionedTicks[t - 1].text : null}
|
|
208
205
|
|
|
209
206
|
{@const moveDown =
|
|
210
207
|
(tickSize + tickPadding + (tickRotate !== 0 ? tickFontSize_ * 0.35 : 0)) *
|
|
211
208
|
(anchor === 'bottom' ? 1 : -1)}
|
|
212
209
|
{@const [textStyle, textClass] = resolveStyles(
|
|
213
210
|
plot,
|
|
214
|
-
|
|
211
|
+
toScaledDatum(tick),
|
|
215
212
|
{
|
|
216
213
|
fontVariant: isQuantitative ? 'tabular-nums' : 'normal',
|
|
217
214
|
...options,
|
|
@@ -228,7 +225,7 @@
|
|
|
228
225
|
stroke: null
|
|
229
226
|
},
|
|
230
227
|
'fill',
|
|
231
|
-
{ x: true },
|
|
228
|
+
{ x: true } as any,
|
|
232
229
|
true
|
|
233
230
|
)}
|
|
234
231
|
<text
|
|
@@ -1,26 +1,20 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ConstantAccessor, PlotState, PlotScaleFunction, RawValue, ScaleType } from '../../types/index.js';
|
|
2
|
+
import type { BaseAxisXOptions } from '../../types/axes.js';
|
|
2
3
|
type BaseAxisXProps = {
|
|
3
|
-
scaleFn:
|
|
4
|
+
scaleFn: PlotScaleFunction;
|
|
4
5
|
scaleType: ScaleType;
|
|
5
6
|
ticks: RawValue[];
|
|
6
7
|
tickFormat: (d: RawValue, i: number, ticks: RawValue[]) => string | string[];
|
|
7
|
-
anchor
|
|
8
|
-
tickSize
|
|
9
|
-
tickPadding
|
|
10
|
-
tickFontSize
|
|
11
|
-
tickClass
|
|
8
|
+
anchor?: 'top' | 'bottom';
|
|
9
|
+
tickSize?: number;
|
|
10
|
+
tickPadding?: number;
|
|
11
|
+
tickFontSize?: ConstantAccessor<number>;
|
|
12
|
+
tickClass?: ConstantAccessor<string>;
|
|
12
13
|
marginTop: number;
|
|
13
14
|
height: number;
|
|
14
|
-
title: string;
|
|
15
|
-
options:
|
|
16
|
-
|
|
17
|
-
dy: ConstantAccessor<number>;
|
|
18
|
-
filter: ChannelAccessor;
|
|
19
|
-
wordwrap: boolean;
|
|
20
|
-
textAnchor: ConstantAccessor<'start' | 'middle' | 'end'> | 'auto';
|
|
21
|
-
removeDuplicateTicks: boolean;
|
|
22
|
-
};
|
|
23
|
-
text: boolean;
|
|
15
|
+
title: string | null;
|
|
16
|
+
options: BaseAxisXOptions;
|
|
17
|
+
text?: boolean | null;
|
|
24
18
|
plot: PlotState;
|
|
25
19
|
class: string | undefined;
|
|
26
20
|
};
|