svelteplot 0.10.2 → 0.10.3-pr-370.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/LICENSE.md +1 -1
- package/dist/Mark.svelte.d.ts +4 -4
- package/dist/constants.d.ts +1 -1
- package/dist/helpers/colors.d.ts +8 -11
- package/dist/helpers/curves.d.ts +2 -2
- package/dist/helpers/facets.d.ts +1 -1
- package/dist/helpers/getBaseStyles.d.ts +2 -4
- package/dist/helpers/index.d.ts +1 -1
- package/dist/helpers/reduce.d.ts +1 -1
- package/dist/helpers/scales.d.ts +7 -7
- package/dist/helpers/symbols.d.ts +1 -1
- package/dist/helpers/time.d.ts +3 -3
- package/dist/helpers/typeChecks.d.ts +4 -4
- package/dist/marks/Area.svelte.d.ts +5 -4
- package/dist/marks/AreaX.svelte.d.ts +4 -4
- package/dist/marks/AreaY.svelte.d.ts +4 -4
- package/dist/marks/Arrow.svelte.d.ts +5 -4
- package/dist/marks/AxisX.svelte +13 -0
- package/dist/marks/AxisX.svelte.d.ts +19 -5
- package/dist/marks/AxisY.svelte +15 -0
- package/dist/marks/AxisY.svelte.d.ts +21 -5
- package/dist/marks/BarX.svelte.d.ts +4 -4
- package/dist/marks/BarY.svelte.d.ts +5 -4
- package/dist/marks/BollingerX.svelte +3 -0
- package/dist/marks/BollingerX.svelte.d.ts +2 -77
- package/dist/marks/BollingerY.svelte +3 -0
- package/dist/marks/BollingerY.svelte.d.ts +2 -77
- package/dist/marks/BoxY.svelte +3 -0
- package/dist/marks/BoxY.svelte.d.ts +4 -64
- package/dist/marks/Brush.svelte +4 -0
- package/dist/marks/Brush.svelte.d.ts +5 -64
- package/dist/marks/Cell.svelte.d.ts +5 -4
- package/dist/marks/CellX.svelte.d.ts +30 -30
- package/dist/marks/CellY.svelte.d.ts +30 -30
- package/dist/marks/ColorLegend.svelte +1 -0
- package/dist/marks/ColorLegend.svelte.d.ts +1 -0
- package/dist/marks/CustomMark.svelte +11 -0
- package/dist/marks/CustomMark.svelte.d.ts +2 -85
- package/dist/marks/CustomMarkHTML.svelte +6 -0
- package/dist/marks/CustomMarkHTML.svelte.d.ts +6 -0
- package/dist/marks/DifferenceY.svelte +5 -1
- package/dist/marks/DifferenceY.svelte.d.ts +8 -64
- package/dist/marks/Dot.svelte.d.ts +5 -4
- package/dist/marks/DotX.svelte.d.ts +5 -5
- package/dist/marks/DotY.svelte.d.ts +5 -5
- package/dist/marks/Frame.svelte +11 -0
- package/dist/marks/Frame.svelte.d.ts +17 -5
- package/dist/marks/Geo.svelte +3 -0
- package/dist/marks/Geo.svelte.d.ts +8 -4
- package/dist/marks/Graticule.svelte +3 -0
- package/dist/marks/Graticule.svelte.d.ts +3 -0
- package/dist/marks/GridX.svelte +4 -0
- package/dist/marks/GridX.svelte.d.ts +9 -4
- package/dist/marks/GridY.svelte +4 -0
- package/dist/marks/GridY.svelte.d.ts +9 -4
- package/dist/marks/HTMLTooltip.svelte +7 -0
- package/dist/marks/HTMLTooltip.svelte.d.ts +7 -0
- package/dist/marks/Image.svelte.d.ts +5 -4
- package/dist/marks/Line.svelte.d.ts +4 -4
- package/dist/marks/LineX.svelte.d.ts +6 -6
- package/dist/marks/LineY.svelte.d.ts +6 -6
- package/dist/marks/Link.svelte +3 -1
- package/dist/marks/Link.svelte.d.ts +8 -4
- package/dist/marks/Pointer.svelte +7 -0
- package/dist/marks/Pointer.svelte.d.ts +7 -0
- package/dist/marks/Rect.svelte.d.ts +5 -4
- package/dist/marks/RuleX.svelte.d.ts +5 -4
- package/dist/marks/RuleY.svelte.d.ts +5 -4
- package/dist/marks/Spike.svelte +6 -0
- package/dist/marks/Spike.svelte.d.ts +11 -5
- package/dist/marks/Text.svelte.d.ts +9 -8
- package/dist/marks/TickX.svelte +2 -0
- package/dist/marks/TickX.svelte.d.ts +7 -4
- package/dist/marks/TickY.svelte +5 -3
- package/dist/marks/TickY.svelte.d.ts +10 -7
- package/dist/marks/Trail.svelte +11 -0
- package/dist/marks/Trail.svelte.d.ts +12 -64
- package/dist/marks/Vector.svelte +9 -0
- package/dist/marks/Vector.svelte.d.ts +14 -4
- package/dist/marks/WaffleX.svelte +6 -4
- package/dist/marks/WaffleX.svelte.d.ts +2 -86
- package/dist/marks/WaffleY.svelte +5 -4
- package/dist/marks/WaffleY.svelte.d.ts +10 -8
- package/dist/marks/helpers/Box.svelte.d.ts +1 -64
- package/dist/marks/helpers/MarkerPath.svelte.d.ts +2 -107
- package/dist/marks/helpers/Regression.svelte +6 -3
- package/dist/marks/helpers/Regression.svelte.d.ts +6 -0
- package/dist/transforms/bollinger.d.ts +8 -0
- package/dist/transforms/bollinger.js +8 -0
- package/dist/transforms/centroid.d.ts +5 -4
- package/dist/transforms/centroid.js +4 -0
- package/dist/transforms/dodge.d.ts +11 -0
- package/dist/transforms/dodge.js +6 -0
- package/dist/transforms/interval.d.ts +8 -8
- package/dist/transforms/jitter.d.ts +9 -0
- package/dist/transforms/jitter.js +9 -0
- package/dist/transforms/recordize.d.ts +16 -7
- package/dist/transforms/recordize.js +10 -6
- package/dist/transforms/rename.d.ts +5 -1
- package/dist/transforms/rename.js +4 -0
- package/dist/transforms/select.d.ts +36 -28
- package/dist/transforms/select.js +8 -0
- package/dist/transforms/shift.d.ts +8 -0
- package/dist/transforms/shift.js +6 -0
- package/dist/transforms/sort.d.ts +18 -19
- package/dist/transforms/sort.js +4 -0
- package/dist/transforms/stack.d.ts +32 -12
- package/dist/transforms/stack.js +14 -0
- package/dist/transforms/window.d.ts +13 -136
- package/dist/transforms/window.js +6 -0
- package/dist/types/channel.d.ts +12 -0
- package/dist/types/data.d.ts +13 -0
- package/dist/types/facet.d.ts +5 -0
- package/dist/types/index.d.ts +18 -0
- package/dist/types/mark.d.ts +62 -0
- package/dist/types/plot.d.ts +31 -0
- package/dist/types/scale.d.ts +98 -0
- package/package.json +13 -5
package/dist/types/mark.d.ts
CHANGED
|
@@ -19,65 +19,120 @@ export type BaseMarkProps<T> = Partial<{
|
|
|
19
19
|
* Filter the data without modifying the inferred scales
|
|
20
20
|
*/
|
|
21
21
|
filter: ConstantAccessor<boolean, T>;
|
|
22
|
+
/** controls whether this mark participates in faceting; "exclude" to ignore facet filters, "include" to require matching facet values */
|
|
22
23
|
facet: 'auto' | 'include' | 'exclude';
|
|
24
|
+
/** the horizontal facet channel */
|
|
23
25
|
fx: ChannelAccessor<T>;
|
|
26
|
+
/** the vertical facet channel */
|
|
24
27
|
fy: ChannelAccessor<T>;
|
|
28
|
+
/** a horizontal offset in pixels applied after scaling */
|
|
25
29
|
dx: ConstantAccessor<number, T>;
|
|
30
|
+
/** a vertical offset in pixels applied after scaling */
|
|
26
31
|
dy: ConstantAccessor<number, T>;
|
|
32
|
+
/** options for horizontal dodge positioning to avoid overlapping marks */
|
|
27
33
|
dodgeX: DodgeXOptions;
|
|
34
|
+
/** options for vertical dodge positioning to avoid overlapping marks */
|
|
28
35
|
dodgeY: DodgeYOptions;
|
|
36
|
+
/** the fill color; can be a fixed CSS color string or a channel accessor bound to the color scale */
|
|
29
37
|
fill: ChannelAccessor<T>;
|
|
38
|
+
/** the fill opacity; a number between 0 and 1 */
|
|
30
39
|
fillOpacity: ConstantAccessor<number, T>;
|
|
40
|
+
/** how to sort the mark data before rendering; can be a channel name string, an accessor, a comparator, or an object with channel and order */
|
|
31
41
|
sort: string | ConstantAccessor<RawValue, T> | ((a: RawValue, b: RawValue) => number) | {
|
|
32
42
|
/** sort data using an already defined channel */
|
|
33
43
|
channel: string;
|
|
34
44
|
/** sort order */
|
|
35
45
|
order?: 'ascending' | 'descending';
|
|
36
46
|
};
|
|
47
|
+
/** the stroke color; can be a fixed CSS color string or a channel accessor bound to the color scale */
|
|
37
48
|
stroke: ChannelAccessor<T>;
|
|
49
|
+
/** the stroke width in pixels */
|
|
38
50
|
strokeWidth: ConstantAccessor<number, T>;
|
|
51
|
+
/** the stroke opacity; a number between 0 and 1 */
|
|
39
52
|
strokeOpacity: ConstantAccessor<number, T>;
|
|
53
|
+
/** the SVG stroke line join style (e.g. "round", "bevel") */
|
|
40
54
|
strokeLinejoin: ConstantAccessor<CSS.Property.StrokeLinejoin, T>;
|
|
55
|
+
/** the SVG stroke line cap style (e.g. "round", "butt") */
|
|
41
56
|
strokeLinecap: ConstantAccessor<CSS.Property.StrokeLinecap, T>;
|
|
57
|
+
/** the SVG stroke miter limit */
|
|
42
58
|
strokeMiterlimit: ConstantAccessor<number, T>;
|
|
59
|
+
/** the overall element opacity; can be a fixed number or a channel accessor bound to the opacity scale */
|
|
43
60
|
opacity: ChannelAccessor<T>;
|
|
61
|
+
/** the SVG stroke dash pattern (e.g. "4 2") */
|
|
44
62
|
strokeDasharray: ConstantAccessor<string, T>;
|
|
63
|
+
/** the SVG stroke dash offset in pixels */
|
|
45
64
|
strokeDashoffset: ConstantAccessor<number, T>;
|
|
65
|
+
/** the CSS mix-blend-mode for compositing (e.g. "multiply", "screen") */
|
|
46
66
|
mixBlendMode: ConstantAccessor<CSS.Property.MixBlendMode, T>;
|
|
67
|
+
/** a CSS clip-path to clip the mark element */
|
|
47
68
|
clipPath: string;
|
|
69
|
+
/** a CSS mask to apply to the mark element */
|
|
48
70
|
mask: string;
|
|
71
|
+
/** a CSS filter to apply to the mark element (e.g. "blur(2px)") */
|
|
49
72
|
imageFilter: ConstantAccessor<string, T>;
|
|
73
|
+
/** the SVG shape-rendering attribute (e.g. "crispEdges", "geometricPrecision") */
|
|
50
74
|
shapeRendering: ConstantAccessor<CSS.Property.ShapeRendering, T>;
|
|
75
|
+
/** the SVG paint-order attribute (e.g. "stroke" to render stroke behind fill) */
|
|
51
76
|
paintOrder: ConstantAccessor<string, T>;
|
|
77
|
+
/** fired when the mark element is clicked */
|
|
52
78
|
onclick: MouseEventHandler<SVGPathElement>;
|
|
79
|
+
/** fired when the mark element is double-clicked */
|
|
53
80
|
ondblclick: MouseEventHandler<SVGPathElement>;
|
|
81
|
+
/** fired when a mouse button is released over the mark */
|
|
54
82
|
onmouseup: MouseEventHandler<SVGPathElement>;
|
|
83
|
+
/** fired when a mouse button is pressed over the mark */
|
|
55
84
|
onmousedown: MouseEventHandler<SVGPathElement>;
|
|
85
|
+
/** fired when the pointer enters the mark element */
|
|
56
86
|
onmouseenter: MouseEventHandler<SVGPathElement>;
|
|
87
|
+
/** fired when the pointer moves within the mark element */
|
|
57
88
|
onmousemove: MouseEventHandler<SVGPathElement>;
|
|
89
|
+
/** fired when the pointer leaves the mark element */
|
|
58
90
|
onmouseleave: MouseEventHandler<SVGPathElement>;
|
|
91
|
+
/** fired when the pointer moves out of the mark element */
|
|
59
92
|
onmouseout: MouseEventHandler<SVGPathElement>;
|
|
93
|
+
/** fired when the pointer moves onto the mark element */
|
|
60
94
|
onmouseover: MouseEventHandler<SVGPathElement>;
|
|
95
|
+
/** fired when a pointer event is canceled */
|
|
61
96
|
onpointercancel: MouseEventHandler<SVGPathElement>;
|
|
97
|
+
/** fired when a pointer becomes active over the mark */
|
|
62
98
|
onpointerdown: MouseEventHandler<SVGPathElement>;
|
|
99
|
+
/** fired when a pointer is released over the mark */
|
|
63
100
|
onpointerup: MouseEventHandler<SVGPathElement>;
|
|
101
|
+
/** fired when a pointer enters the mark element */
|
|
64
102
|
onpointerenter: MouseEventHandler<SVGPathElement>;
|
|
103
|
+
/** fired when a pointer leaves the mark element */
|
|
65
104
|
onpointerleave: MouseEventHandler<SVGPathElement>;
|
|
105
|
+
/** fired when a pointer moves within the mark element */
|
|
66
106
|
onpointermove: MouseEventHandler<SVGPathElement>;
|
|
107
|
+
/** fired when a pointer moves onto the mark element */
|
|
67
108
|
onpointerover: MouseEventHandler<SVGPathElement>;
|
|
109
|
+
/** fired when a pointer moves out of the mark element */
|
|
68
110
|
onpointerout: MouseEventHandler<SVGPathElement>;
|
|
111
|
+
/** fired continuously while the mark is being dragged */
|
|
69
112
|
ondrag: MouseEventHandler<SVGPathElement>;
|
|
113
|
+
/** fired when a dragged element is dropped on the mark */
|
|
70
114
|
ondrop: MouseEventHandler<SVGPathElement>;
|
|
115
|
+
/** fired when a drag operation begins on the mark */
|
|
71
116
|
ondragstart: MouseEventHandler<SVGPathElement>;
|
|
117
|
+
/** fired when a dragged element enters the mark */
|
|
72
118
|
ondragenter: MouseEventHandler<SVGPathElement>;
|
|
119
|
+
/** fired when a dragged element leaves the mark */
|
|
73
120
|
ondragleave: MouseEventHandler<SVGPathElement>;
|
|
121
|
+
/** fired when a dragged element is over the mark */
|
|
74
122
|
ondragover: MouseEventHandler<SVGPathElement>;
|
|
123
|
+
/** fired when a drag operation ends */
|
|
75
124
|
ondragend: MouseEventHandler<SVGPathElement>;
|
|
125
|
+
/** fired when a touch point is placed on the mark */
|
|
76
126
|
ontouchstart: MouseEventHandler<SVGPathElement>;
|
|
127
|
+
/** fired when a touch point moves along the mark */
|
|
77
128
|
ontouchmove: MouseEventHandler<SVGPathElement>;
|
|
129
|
+
/** fired when a touch point is removed from the mark */
|
|
78
130
|
ontouchend: MouseEventHandler<SVGPathElement>;
|
|
131
|
+
/** fired when a touch event is canceled */
|
|
79
132
|
ontouchcancel: MouseEventHandler<SVGPathElement>;
|
|
133
|
+
/** fired when the context menu is triggered on the mark */
|
|
80
134
|
oncontextmenu: MouseEventHandler<SVGPathElement>;
|
|
135
|
+
/** fired when the mouse wheel is scrolled over the mark */
|
|
81
136
|
onwheel: MouseEventHandler<SVGPathElement>;
|
|
82
137
|
/**
|
|
83
138
|
* if you want to give your mark element an extra CSS class
|
|
@@ -87,6 +142,7 @@ export type BaseMarkProps<T> = Partial<{
|
|
|
87
142
|
* if you want to give your mark element an extra inline style
|
|
88
143
|
*/
|
|
89
144
|
style: string;
|
|
145
|
+
/** the CSS cursor style when hovering over the mark (e.g. "pointer", "crosshair") */
|
|
90
146
|
cursor: ConstantAccessor<CSS.Property.Cursor, T>;
|
|
91
147
|
}>;
|
|
92
148
|
export type LinkableMarkProps<T> = {
|
|
@@ -123,10 +179,16 @@ export type BorderRadius = number | {
|
|
|
123
179
|
bottomLeft?: number;
|
|
124
180
|
};
|
|
125
181
|
export type BaseRectMarkProps<T> = {
|
|
182
|
+
/** shorthand to inset the rectangle on all sides, in pixels */
|
|
126
183
|
inset?: ConstantAccessor<number, T>;
|
|
184
|
+
/** inset the rectangle from the left edge, in pixels */
|
|
127
185
|
insetLeft?: ConstantAccessor<number, T>;
|
|
186
|
+
/** inset the rectangle from the top edge, in pixels */
|
|
128
187
|
insetTop?: ConstantAccessor<number, T>;
|
|
188
|
+
/** inset the rectangle from the right edge, in pixels */
|
|
129
189
|
insetRight?: ConstantAccessor<number, T>;
|
|
190
|
+
/** inset the rectangle from the bottom edge, in pixels */
|
|
130
191
|
insetBottom?: ConstantAccessor<number, T>;
|
|
192
|
+
/** the border radius of the rectangle; can be a number or a per-corner object */
|
|
131
193
|
borderRadius?: ConstantAccessor<BorderRadius, T>;
|
|
132
194
|
};
|
package/dist/types/plot.d.ts
CHANGED
|
@@ -439,12 +439,36 @@ export type PlotOptions = {
|
|
|
439
439
|
* Options for the shared radius scale
|
|
440
440
|
*/
|
|
441
441
|
r: Partial<ScaleOptions>;
|
|
442
|
+
/**
|
|
443
|
+
* Options for the shared color scale
|
|
444
|
+
*/
|
|
442
445
|
color: Partial<ColorScaleOptions>;
|
|
446
|
+
/**
|
|
447
|
+
* Options for the shared opacity scale
|
|
448
|
+
*/
|
|
443
449
|
opacity: Partial<ScaleOptions>;
|
|
450
|
+
/**
|
|
451
|
+
* Options for the shared symbol scale
|
|
452
|
+
*/
|
|
444
453
|
symbol: Partial<LegendScaleOptions>;
|
|
454
|
+
/**
|
|
455
|
+
* Options for the shared length scale (e.g. for vectors and spikes)
|
|
456
|
+
*/
|
|
445
457
|
length: Partial<ScaleOptions>;
|
|
458
|
+
/**
|
|
459
|
+
* Options for the horizontal facet scale, or false to disable, or an
|
|
460
|
+
* array of domain values
|
|
461
|
+
*/
|
|
446
462
|
fx: Partial<XScaleOptions> | false | RawValue[];
|
|
463
|
+
/**
|
|
464
|
+
* Options for the vertical facet scale, or false to disable, or an
|
|
465
|
+
* array of domain values
|
|
466
|
+
*/
|
|
447
467
|
fy: Partial<YScaleOptions> | false | RawValue[];
|
|
468
|
+
/**
|
|
469
|
+
* The plot content as a Svelte snippet. Receives the plot dimensions,
|
|
470
|
+
* options, and resolved scales as arguments.
|
|
471
|
+
*/
|
|
448
472
|
children: Snippet<[
|
|
449
473
|
{
|
|
450
474
|
width: number;
|
|
@@ -458,6 +482,10 @@ export type PlotOptions = {
|
|
|
458
482
|
* your plot, or place a legend above the visualization.
|
|
459
483
|
*/
|
|
460
484
|
header: Snippet;
|
|
485
|
+
/**
|
|
486
|
+
* The footer snippet is useful for rendering custom markup below the SVG body
|
|
487
|
+
* of your plot, e.g. for a caption or legend.
|
|
488
|
+
*/
|
|
461
489
|
footer: Snippet;
|
|
462
490
|
/**
|
|
463
491
|
* The underlay snippet is useful for adding a layer of custom HTML markup
|
|
@@ -474,6 +502,9 @@ export type PlotOptions = {
|
|
|
474
502
|
options: PlotOptions;
|
|
475
503
|
scales: PlotScales;
|
|
476
504
|
}]>;
|
|
505
|
+
/**
|
|
506
|
+
* snippet for rendering custom facet axes
|
|
507
|
+
*/
|
|
477
508
|
facetAxes: Snippet;
|
|
478
509
|
/**
|
|
479
510
|
* if you set testid, the plot container will get a data-testid attribute which
|
package/dist/types/scale.d.ts
CHANGED
|
@@ -21,8 +21,18 @@ export type ScaleOptions = {
|
|
|
21
21
|
* Reverse the scale.
|
|
22
22
|
*/
|
|
23
23
|
reverse: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* the axis label for this scale, or false to disable the automatic label
|
|
26
|
+
*/
|
|
24
27
|
label: string | false;
|
|
28
|
+
/**
|
|
29
|
+
* the interval for ordinal/temporal scales, e.g. 'day', 'month', or a numeric step
|
|
30
|
+
*/
|
|
25
31
|
interval: string | number;
|
|
32
|
+
/**
|
|
33
|
+
* clamp values outside the domain to the nearest domain boundary
|
|
34
|
+
* (applicable to quantitative scales only)
|
|
35
|
+
*/
|
|
26
36
|
clamp: boolean;
|
|
27
37
|
/**
|
|
28
38
|
* Extend the domain to nice round numbers (applicable to quantitative scales only)
|
|
@@ -32,8 +42,18 @@ export type ScaleOptions = {
|
|
|
32
42
|
* Include zero in the scale domain (applicable to quantitative scales only)
|
|
33
43
|
*/
|
|
34
44
|
zero: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* round interpolated values to integers (applicable to quantitative scales only)
|
|
47
|
+
*/
|
|
35
48
|
round: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* format values as percentages and append (%) to the axis label
|
|
51
|
+
* (applicable to quantitative scales only)
|
|
52
|
+
*/
|
|
36
53
|
percent: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* custom transformation function applied to values before scaling
|
|
56
|
+
*/
|
|
37
57
|
transform?: (d: RawValue) => RawValue;
|
|
38
58
|
/**
|
|
39
59
|
* set the padding for band scales
|
|
@@ -51,22 +71,61 @@ export type ScaleOptions = {
|
|
|
51
71
|
* set the outer padding for band scales
|
|
52
72
|
*/
|
|
53
73
|
paddingOuter: number;
|
|
74
|
+
/**
|
|
75
|
+
* reduce the scale range by this many pixels on the left side
|
|
76
|
+
*/
|
|
54
77
|
insetLeft: number;
|
|
78
|
+
/**
|
|
79
|
+
* reduce the scale range by this many pixels on the right side
|
|
80
|
+
*/
|
|
55
81
|
insetRight: number;
|
|
82
|
+
/**
|
|
83
|
+
* reduce the scale range by this many pixels on the top side
|
|
84
|
+
*/
|
|
56
85
|
insetTop: number;
|
|
86
|
+
/**
|
|
87
|
+
* reduce the scale range by this many pixels on the bottom side
|
|
88
|
+
*/
|
|
57
89
|
insetBottom: number;
|
|
90
|
+
/**
|
|
91
|
+
* explicit tick values to use instead of automatic tick generation
|
|
92
|
+
*/
|
|
58
93
|
ticks: (number | Date)[];
|
|
94
|
+
/**
|
|
95
|
+
* desired pixel distance between ticks for automatic tick generation
|
|
96
|
+
*/
|
|
59
97
|
tickSpacing: number;
|
|
98
|
+
/**
|
|
99
|
+
* the logarithm base for log scales (default 10)
|
|
100
|
+
*/
|
|
60
101
|
base: number;
|
|
102
|
+
/**
|
|
103
|
+
* controls domain ordering for band and point scales; can be a channel
|
|
104
|
+
* accessor, a comparator function, or an object with channel and order
|
|
105
|
+
*/
|
|
61
106
|
sort: ChannelAccessor | ((a: RawValue, b: RawValue) => number) | {
|
|
62
107
|
channel: string;
|
|
63
108
|
order: 'ascending' | 'descending';
|
|
64
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* the constant parameter for symlog scales, controlling the transition
|
|
112
|
+
* between linear and logarithmic behavior near zero (default 1)
|
|
113
|
+
*/
|
|
65
114
|
constant: number;
|
|
66
115
|
};
|
|
67
116
|
export type ColorScaleOptions = ScaleOptions & {
|
|
117
|
+
/**
|
|
118
|
+
* if true, show a color legend for this scale
|
|
119
|
+
*/
|
|
68
120
|
legend: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* the color scale type; extends the base scale types with color-specific
|
|
123
|
+
* types like categorical, sequential, diverging, etc.
|
|
124
|
+
*/
|
|
69
125
|
type: ScaleType | 'categorical' | 'sequential' | 'cyclical' | 'threshold' | 'quantile' | 'quantize' | 'diverging' | 'diverging-log' | 'diverging-pow' | 'diverging-sqrt' | 'diverging-symlog';
|
|
126
|
+
/**
|
|
127
|
+
* the name of the color scheme to use, e.g. 'blues', 'turbo', 'rdylbu'
|
|
128
|
+
*/
|
|
70
129
|
scheme: string;
|
|
71
130
|
/**
|
|
72
131
|
* fallback color used for null/undefined
|
|
@@ -80,6 +139,9 @@ export type ColorScaleOptions = ScaleOptions & {
|
|
|
80
139
|
* number of colors for quantize and quantile-threshold scales
|
|
81
140
|
*/
|
|
82
141
|
n: number;
|
|
142
|
+
/**
|
|
143
|
+
* custom interpolation function for the color scale output
|
|
144
|
+
*/
|
|
83
145
|
interpolate: (d: any) => typeof d;
|
|
84
146
|
/**
|
|
85
147
|
* The tick format for the color scale legend.
|
|
@@ -104,7 +166,14 @@ export type XScaleOptions = ScaleOptions & {
|
|
|
104
166
|
* rotate the axis ticks
|
|
105
167
|
*/
|
|
106
168
|
tickRotate: number;
|
|
169
|
+
/**
|
|
170
|
+
* horizontal position of the axis label
|
|
171
|
+
*/
|
|
107
172
|
labelAnchor: 'auto' | 'left' | 'center' | 'right';
|
|
173
|
+
/**
|
|
174
|
+
* custom tick format; false to hide tick labels, an Intl.NumberFormatOptions
|
|
175
|
+
* object, or a function mapping values to strings
|
|
176
|
+
*/
|
|
108
177
|
tickFormat: false | Intl.NumberFormatOptions | ((d: RawValue) => string);
|
|
109
178
|
/**
|
|
110
179
|
* Enable word wrapping for axis tick labels, default true
|
|
@@ -128,20 +197,42 @@ export type YScaleOptions = ScaleOptions & {
|
|
|
128
197
|
* add an explicit AxisY mark to your plot instead of using the implicit axes.
|
|
129
198
|
*/
|
|
130
199
|
axis: AxisYAnchor | false;
|
|
200
|
+
/**
|
|
201
|
+
* custom tick format; false to hide tick labels, an Intl.NumberFormatOptions
|
|
202
|
+
* object, or a function mapping values to strings
|
|
203
|
+
*/
|
|
131
204
|
tickFormat: false | Intl.NumberFormatOptions | ((d: RawValue) => string);
|
|
132
205
|
/**
|
|
133
206
|
* rotate the axis ticks
|
|
134
207
|
*/
|
|
135
208
|
tickRotate: number;
|
|
209
|
+
/**
|
|
210
|
+
* vertical position of the axis label
|
|
211
|
+
*/
|
|
136
212
|
labelAnchor: 'auto' | 'bottom' | 'middle' | 'top';
|
|
137
213
|
};
|
|
138
214
|
export type LegendScaleOptions = ScaleOptions & {
|
|
215
|
+
/**
|
|
216
|
+
* if true, show a legend for this scale
|
|
217
|
+
*/
|
|
139
218
|
legend: boolean;
|
|
140
219
|
};
|
|
141
220
|
export type PlotScale = {
|
|
221
|
+
/**
|
|
222
|
+
* the resolved scale type
|
|
223
|
+
*/
|
|
142
224
|
type: ScaleType;
|
|
225
|
+
/**
|
|
226
|
+
* the resolved domain of the scale
|
|
227
|
+
*/
|
|
143
228
|
domain: RawValue[];
|
|
229
|
+
/**
|
|
230
|
+
* the resolved range of the scale
|
|
231
|
+
*/
|
|
144
232
|
range: RawValue[];
|
|
233
|
+
/**
|
|
234
|
+
* automatically computed axis label based on data channel names
|
|
235
|
+
*/
|
|
145
236
|
autoTitle?: string;
|
|
146
237
|
/**
|
|
147
238
|
* The number of marks that are using this scale.
|
|
@@ -151,7 +242,14 @@ export type PlotScale = {
|
|
|
151
242
|
* Set of accessors used in channels that are bound to this scale.
|
|
152
243
|
*/
|
|
153
244
|
uniqueScaleProps: Set<ChannelAccessor>;
|
|
245
|
+
/**
|
|
246
|
+
* tracks which marks should skip this scale for specific channels,
|
|
247
|
+
* e.g. when channel values are already in output space
|
|
248
|
+
*/
|
|
154
249
|
skip: Map<ScaledChannelName, Set<symbol>>;
|
|
250
|
+
/**
|
|
251
|
+
* the underlying d3 scale function that maps domain values to range values
|
|
252
|
+
*/
|
|
155
253
|
fn: ScaleLinear<RawValue, number> & ScaleBand<RawValue[]> & ScaleOrdinal<string | Date, number> & ScaleOrdinal<string | Date, string>;
|
|
156
254
|
};
|
|
157
255
|
export type PlotScales = Record<ScaleName, PlotScale>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelteplot",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3-pr-370.1",
|
|
4
4
|
"description": "A Svelte-native data visualization framework based on the layered grammar of graphics principles.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svelte",
|
|
@@ -16,6 +16,10 @@
|
|
|
16
16
|
"bugs": {
|
|
17
17
|
"url": "https://github.com/svelteplot/svelteplot/issues"
|
|
18
18
|
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/svelteplot/svelteplot.git"
|
|
22
|
+
},
|
|
19
23
|
"license": "ISC",
|
|
20
24
|
"author": {
|
|
21
25
|
"name": "Gregor Aisch",
|
|
@@ -61,7 +65,7 @@
|
|
|
61
65
|
"docs:api:marks": "node scripts/generate-api.js --marks && prettier --write .",
|
|
62
66
|
"docs:api:plot": "node scripts/generate-api.js --plot && prettier --write .",
|
|
63
67
|
"docs:api:transforms": "node scripts/generate-api.js --transforms && prettier --write .",
|
|
64
|
-
"format": "prettier --write .",
|
|
68
|
+
"format": "eslint --fix package.json && prettier --write .",
|
|
65
69
|
"lint": "prettier --check src && eslint src package.json",
|
|
66
70
|
"lint:types": "tsc --noEmit",
|
|
67
71
|
"prepack": "npx svelte-package",
|
|
@@ -89,8 +93,7 @@
|
|
|
89
93
|
"es-toolkit": "^1.44.0",
|
|
90
94
|
"fast-equals": "^6.0.0",
|
|
91
95
|
"interval-tree-1d": "^1.0.4",
|
|
92
|
-
"merge-deep": "^3.0.3"
|
|
93
|
-
"svelte": "5"
|
|
96
|
+
"merge-deep": "^3.0.3"
|
|
94
97
|
},
|
|
95
98
|
"devDependencies": {
|
|
96
99
|
"@aitodotai/json-stringify-pretty-compact": "^1.3.0",
|
|
@@ -151,6 +154,7 @@
|
|
|
151
154
|
"resize-observer-polyfill": "^1.5.1",
|
|
152
155
|
"sass": "^1.97.3",
|
|
153
156
|
"shiki": "^3.21.0",
|
|
157
|
+
"svelte": "5",
|
|
154
158
|
"svelte-check": "^4.3.5",
|
|
155
159
|
"svelte-eslint-parser": "1.4.1",
|
|
156
160
|
"svelte-highlight": "^7.9.0",
|
|
@@ -170,5 +174,9 @@
|
|
|
170
174
|
"vitest-matchmedia-mock": "^2.0.3",
|
|
171
175
|
"wx-svelte-grid": "^2.5.0",
|
|
172
176
|
"yoctocolors": "^2.1.2"
|
|
173
|
-
}
|
|
177
|
+
},
|
|
178
|
+
"peerDependencies": {
|
|
179
|
+
"svelte": "^5.43.0"
|
|
180
|
+
},
|
|
181
|
+
"packageManager": "pnpm@10.0.0"
|
|
174
182
|
}
|