svelteplot 0.3.4 → 0.3.5-pr-121.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 +25 -27
- package/dist/Mark.svelte.d.ts +87 -17
- package/dist/Plot.svelte +1 -2
- package/dist/Plot.svelte.d.ts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/core/Facet.svelte +1 -1
- package/dist/core/Facet.svelte.d.ts +1 -1
- package/dist/core/FacetAxes.svelte +3 -1
- package/dist/core/FacetGrid.svelte +1 -1
- package/dist/core/FacetGrid.svelte.d.ts +1 -1
- package/dist/core/Plot.svelte +1 -1
- package/dist/core/Plot.svelte.d.ts +1 -1
- package/dist/helpers/autoScales.d.ts +1 -1
- package/dist/helpers/autoTicks.d.ts +1 -1
- package/dist/helpers/autoTicks.js +1 -1
- package/dist/helpers/callWithProps.d.ts +1 -1
- package/dist/helpers/colors.d.ts +2 -2
- package/dist/helpers/curves.d.ts +1 -1
- package/dist/helpers/facets.d.ts +1 -1
- package/dist/helpers/getBaseStyles.d.ts +2 -2
- package/dist/helpers/group.d.ts +1 -1
- package/dist/helpers/index.d.ts +3 -3
- package/dist/helpers/isDataRecord.d.ts +1 -1
- package/dist/helpers/isRawValue.d.ts +1 -1
- package/dist/helpers/projection.d.ts +1 -1
- package/dist/helpers/reduce.d.ts +1 -1
- package/dist/helpers/regressionLoess.d.ts +1 -1
- package/dist/helpers/resolve.d.ts +3 -3
- package/dist/helpers/scales.d.ts +2 -2
- package/dist/helpers/typeChecks.d.ts +5 -5
- package/dist/marks/Area.svelte +14 -17
- package/dist/marks/Area.svelte.d.ts +91 -19
- package/dist/marks/AreaX.svelte +15 -12
- package/dist/marks/AreaX.svelte.d.ts +94 -3
- package/dist/marks/AreaY.svelte +15 -15
- package/dist/marks/AreaY.svelte.d.ts +94 -3
- package/dist/marks/Arrow.svelte +16 -19
- package/dist/marks/Arrow.svelte.d.ts +110 -38
- package/dist/marks/AxisX.svelte +60 -56
- package/dist/marks/AxisX.svelte.d.ts +98 -25
- package/dist/marks/AxisY.svelte +73 -54
- package/dist/marks/AxisY.svelte.d.ts +100 -27
- package/dist/marks/BarX.svelte +28 -30
- package/dist/marks/BarX.svelte.d.ts +89 -17
- package/dist/marks/BarY.svelte +27 -27
- package/dist/marks/BarY.svelte.d.ts +88 -16
- package/dist/marks/BollingerX.svelte +21 -16
- package/dist/marks/BollingerX.svelte.d.ts +17 -16
- package/dist/marks/BollingerY.svelte +21 -16
- package/dist/marks/BollingerY.svelte.d.ts +17 -16
- package/dist/marks/BoxX.svelte +5 -7
- package/dist/marks/BoxX.svelte.d.ts +5 -3
- package/dist/marks/BoxY.svelte +13 -16
- package/dist/marks/BoxY.svelte.d.ts +41 -28
- package/dist/marks/Brush.svelte +27 -30
- package/dist/marks/Brush.svelte.d.ts +20 -15
- package/dist/marks/BrushX.svelte +9 -7
- package/dist/marks/BrushX.svelte.d.ts +5 -2
- package/dist/marks/BrushY.svelte +9 -7
- package/dist/marks/BrushY.svelte.d.ts +5 -2
- package/dist/marks/Cell.svelte +17 -18
- package/dist/marks/Cell.svelte.d.ts +80 -8
- package/dist/marks/CellX.svelte +12 -8
- package/dist/marks/CellX.svelte.d.ts +5 -2
- package/dist/marks/CellY.svelte +12 -8
- package/dist/marks/CellY.svelte.d.ts +5 -2
- package/dist/marks/ColorLegend.svelte +5 -8
- package/dist/marks/ColorLegend.svelte.d.ts +2 -2
- package/dist/marks/CustomMark.svelte +23 -16
- package/dist/marks/CustomMark.svelte.d.ts +17 -14
- package/dist/marks/CustomMarkHTML.svelte +20 -18
- package/dist/marks/CustomMarkHTML.svelte.d.ts +29 -15
- package/dist/marks/DifferenceY.svelte +54 -18
- package/dist/marks/DifferenceY.svelte.d.ts +59 -28
- package/dist/marks/Dot.svelte +13 -14
- package/dist/marks/Dot.svelte.d.ts +84 -12
- package/dist/marks/DotX.svelte +9 -9
- package/dist/marks/DotX.svelte.d.ts +86 -4
- package/dist/marks/DotY.svelte +10 -9
- package/dist/marks/DotY.svelte.d.ts +87 -5
- package/dist/marks/Frame.svelte +20 -27
- package/dist/marks/Frame.svelte.d.ts +24 -10
- package/dist/marks/Geo.svelte +22 -15
- package/dist/marks/Geo.svelte.d.ts +97 -13
- package/dist/marks/Graticule.svelte +16 -19
- package/dist/marks/Graticule.svelte.d.ts +3 -3
- package/dist/marks/GridX.svelte +5 -8
- package/dist/marks/GridX.svelte.d.ts +79 -7
- package/dist/marks/GridY.svelte +5 -8
- package/dist/marks/GridY.svelte.d.ts +79 -7
- package/dist/marks/HTMLTooltip.svelte +9 -14
- package/dist/marks/HTMLTooltip.svelte.d.ts +25 -12
- package/dist/marks/Line.svelte +24 -29
- package/dist/marks/Line.svelte.d.ts +97 -25
- package/dist/marks/LineX.svelte +9 -4
- package/dist/marks/LineX.svelte.d.ts +99 -3
- package/dist/marks/LineY.svelte +11 -5
- package/dist/marks/LineY.svelte.d.ts +100 -4
- package/dist/marks/Link.svelte +35 -19
- package/dist/marks/Link.svelte.d.ts +107 -18
- package/dist/marks/Pointer.svelte +13 -18
- package/dist/marks/Pointer.svelte.d.ts +34 -21
- package/dist/marks/Rect.svelte +19 -19
- package/dist/marks/Rect.svelte.d.ts +86 -13
- package/dist/marks/RectX.svelte +10 -9
- package/dist/marks/RectX.svelte.d.ts +22 -6
- package/dist/marks/RectY.svelte +9 -10
- package/dist/marks/RectY.svelte.d.ts +22 -6
- package/dist/marks/RegressionX.svelte +1 -1
- package/dist/marks/RegressionX.svelte.d.ts +1 -1
- package/dist/marks/RegressionY.svelte +1 -1
- package/dist/marks/RegressionY.svelte.d.ts +1 -1
- package/dist/marks/RuleX.svelte +14 -16
- package/dist/marks/RuleX.svelte.d.ts +84 -12
- package/dist/marks/RuleY.svelte +12 -15
- package/dist/marks/RuleY.svelte.d.ts +84 -12
- package/dist/marks/Sphere.svelte +6 -7
- package/dist/marks/Sphere.svelte.d.ts +3 -2
- package/dist/marks/Spike.svelte +17 -9
- package/dist/marks/Spike.svelte.d.ts +94 -4
- package/dist/marks/SymbolLegend.svelte +1 -1
- package/dist/marks/Text.svelte +25 -23
- package/dist/marks/Text.svelte.d.ts +101 -25
- package/dist/marks/TickX.svelte +12 -13
- package/dist/marks/TickX.svelte.d.ts +92 -20
- package/dist/marks/TickY.svelte +11 -14
- package/dist/marks/TickY.svelte.d.ts +92 -20
- package/dist/marks/Vector.svelte +19 -23
- package/dist/marks/Vector.svelte.d.ts +93 -21
- package/dist/marks/helpers/AreaCanvas.svelte +1 -1
- package/dist/marks/helpers/AreaCanvas.svelte.d.ts +1 -1
- package/dist/marks/helpers/BaseAxisX.svelte +5 -3
- package/dist/marks/helpers/BaseAxisX.svelte.d.ts +1 -1
- package/dist/marks/helpers/BaseAxisY.svelte +10 -8
- package/dist/marks/helpers/BaseAxisY.svelte.d.ts +3 -1
- package/dist/marks/helpers/CanvasLayer.svelte +1 -1
- package/dist/marks/helpers/DotCanvas.svelte +1 -1
- package/dist/marks/helpers/DotCanvas.svelte.d.ts +1 -1
- package/dist/marks/helpers/GeoCanvas.svelte +1 -1
- package/dist/marks/helpers/GeoCanvas.svelte.d.ts +1 -1
- package/dist/marks/helpers/LineCanvas.svelte +1 -1
- package/dist/marks/helpers/LineCanvas.svelte.d.ts +1 -1
- package/dist/marks/helpers/LinearGradientX.svelte +1 -1
- package/dist/marks/helpers/LinearGradientX.svelte.d.ts +1 -1
- package/dist/marks/helpers/LinearGradientY.svelte +1 -1
- package/dist/marks/helpers/LinearGradientY.svelte.d.ts +1 -1
- package/dist/marks/helpers/MarkerPath.svelte +1 -1
- package/dist/marks/helpers/MarkerPath.svelte.d.ts +1 -41
- package/dist/marks/helpers/MultilineText.svelte +1 -1
- package/dist/marks/helpers/MultilineText.svelte.d.ts +1 -1
- package/dist/marks/helpers/RectPath.svelte +29 -26
- package/dist/marks/helpers/RectPath.svelte.d.ts +39 -26
- package/dist/marks/helpers/Regression.svelte +7 -2
- package/dist/marks/helpers/Regression.svelte.d.ts +2 -5
- package/dist/marks/helpers/events.d.ts +1 -1
- package/dist/transforms/bin.d.ts +2 -2
- package/dist/transforms/bollinger.d.ts +2 -67
- package/dist/transforms/centroid.d.ts +8 -66
- package/dist/transforms/centroid.js +10 -7
- package/dist/transforms/filter.d.ts +1 -1
- package/dist/transforms/group.d.ts +5 -13
- package/dist/transforms/interval.d.ts +3 -123
- package/dist/transforms/jitter.d.ts +1 -1
- package/dist/transforms/map.d.ts +4 -184
- package/dist/transforms/normalize.d.ts +3 -123
- package/dist/transforms/recordize.d.ts +1 -1
- package/dist/transforms/rename.d.ts +2 -2
- package/dist/transforms/select.d.ts +8 -428
- package/dist/transforms/shift.d.ts +1 -1
- package/dist/transforms/sort.d.ts +4 -243
- package/dist/transforms/stack.d.ts +1 -1
- package/dist/transforms/window.d.ts +3 -131
- package/dist/types/channel.d.ts +11 -0
- package/dist/types/channel.js +1 -0
- package/dist/types/colorScheme.d.ts +1 -0
- package/dist/types/colorScheme.js +1 -0
- package/dist/types/data.d.ts +13 -0
- package/dist/types/data.js +1 -0
- package/dist/types/facet.d.ts +50 -0
- package/dist/types/facet.js +1 -0
- package/dist/types/index.d.ts +58 -0
- package/dist/types/index.js +7 -0
- package/dist/types/mark.d.ts +123 -0
- package/dist/types/mark.js +1 -0
- package/dist/types/plot.d.ts +459 -0
- package/dist/types/plot.js +1 -0
- package/dist/types/scale.d.ts +143 -0
- package/dist/types/scale.js +1 -0
- package/dist/types.d.ts +120 -127
- package/package.json +125 -120
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export type Mark<T> = {
|
|
2
|
+
id: symbol;
|
|
3
|
+
type: MarkType;
|
|
4
|
+
channels: ScaledChannelName[];
|
|
5
|
+
scales: Set<ScaleName>;
|
|
6
|
+
data: DataRecord<T>[];
|
|
7
|
+
options: T;
|
|
8
|
+
};
|
|
9
|
+
export type MarkType = 'area' | 'arrow' | 'barX' | 'barY' | 'cell' | 'dot' | 'vector' | 'frame' | 'geo' | 'gridX' | 'gridY' | 'line' | 'rect' | 'regression' | 'ruleX' | 'ruleY' | 'swoopyArrow' | 'text' | 'tickX' | 'tickY';
|
|
10
|
+
export type MarkStyleProps = 'strokeDasharray' | 'strokeLinejoin' | 'strokeLinecap' | 'opacity' | 'cursor' | 'pointerEvents' | 'blend' | 'fill' | 'fillOpacity' | 'fontWeight' | 'fontVariant' | 'fontSize' | 'fontStyle' | 'stroke' | 'strokeWidth' | 'strokeOpacity' | 'x' | 'y' | 'clipPath' | 'mask' | 'filter' | 'angle' | 'radius' | 'symbol' | 'textAnchor' | 'width';
|
|
11
|
+
import type { MouseEventHandler } from 'svelte/elements';
|
|
12
|
+
import type { ChannelAccessor, ConstantAccessor, DataRecord, RawValue } from '.';
|
|
13
|
+
import type * as CSS from 'csstype';
|
|
14
|
+
import type { ScaledChannelName, ScaleName } from './scale';
|
|
15
|
+
export type BaseMarkProps<T> = Partial<{
|
|
16
|
+
/**
|
|
17
|
+
* Filter the data without modifying the inferred scales
|
|
18
|
+
*/
|
|
19
|
+
filter?: ConstantAccessor<boolean, T>;
|
|
20
|
+
facet?: 'auto' | 'include' | 'exclude';
|
|
21
|
+
fx: ChannelAccessor<T>;
|
|
22
|
+
fy: ChannelAccessor<T>;
|
|
23
|
+
dx: ConstantAccessor<number, T>;
|
|
24
|
+
dy: ConstantAccessor<number, T>;
|
|
25
|
+
fill: ChannelAccessor<T>;
|
|
26
|
+
fillOpacity: ConstantAccessor<number, T>;
|
|
27
|
+
sort: string | ConstantAccessor<RawValue, T> | ((a: RawValue, b: RawValue) => number) | {
|
|
28
|
+
/** sort data using an already defined channel */
|
|
29
|
+
channel: string;
|
|
30
|
+
/** sort order */
|
|
31
|
+
order?: 'ascending' | 'descending';
|
|
32
|
+
};
|
|
33
|
+
stroke: ChannelAccessor<T>;
|
|
34
|
+
strokeWidth: ConstantAccessor<number, T>;
|
|
35
|
+
strokeOpacity: ConstantAccessor<number, T>;
|
|
36
|
+
strokeLinejoin: ConstantAccessor<CSS.Property.StrokeLinejoin, T>;
|
|
37
|
+
strokeLinecap: ConstantAccessor<CSS.Property.StrokeLinecap, T>;
|
|
38
|
+
strokeMiterlimit: ConstantAccessor<number, T>;
|
|
39
|
+
opacity: ChannelAccessor<T>;
|
|
40
|
+
strokeDasharray: ConstantAccessor<string, T>;
|
|
41
|
+
strokeDashoffset: ConstantAccessor<number, T>;
|
|
42
|
+
mixBlendMode: ConstantAccessor<CSS.Property.MixBlendMode, T>;
|
|
43
|
+
clipPath: string;
|
|
44
|
+
imageFilter: ConstantAccessor<string, T>;
|
|
45
|
+
shapeRendering: ConstantAccessor<CSS.Property.ShapeRendering, T>;
|
|
46
|
+
paintOrder: ConstantAccessor<string, T>;
|
|
47
|
+
onclick?: MouseEventHandler<SVGPathElement>;
|
|
48
|
+
ondblclick?: MouseEventHandler<SVGPathElement>;
|
|
49
|
+
onmouseup?: MouseEventHandler<SVGPathElement>;
|
|
50
|
+
onmousedown?: MouseEventHandler<SVGPathElement>;
|
|
51
|
+
onmouseenter?: MouseEventHandler<SVGPathElement>;
|
|
52
|
+
onmousemove?: MouseEventHandler<SVGPathElement>;
|
|
53
|
+
onmouseleave?: MouseEventHandler<SVGPathElement>;
|
|
54
|
+
onmouseout?: MouseEventHandler<SVGPathElement>;
|
|
55
|
+
onmouseover?: MouseEventHandler<SVGPathElement>;
|
|
56
|
+
onpointercancel?: MouseEventHandler<SVGPathElement>;
|
|
57
|
+
onpointerdown?: MouseEventHandler<SVGPathElement>;
|
|
58
|
+
onpointerup?: MouseEventHandler<SVGPathElement>;
|
|
59
|
+
onpointerenter?: MouseEventHandler<SVGPathElement>;
|
|
60
|
+
onpointerleave?: MouseEventHandler<SVGPathElement>;
|
|
61
|
+
onpointermove?: MouseEventHandler<SVGPathElement>;
|
|
62
|
+
onpointerover?: MouseEventHandler<SVGPathElement>;
|
|
63
|
+
onpointerout?: MouseEventHandler<SVGPathElement>;
|
|
64
|
+
ondrag?: MouseEventHandler<SVGPathElement>;
|
|
65
|
+
ondrop?: MouseEventHandler<SVGPathElement>;
|
|
66
|
+
ondragstart?: MouseEventHandler<SVGPathElement>;
|
|
67
|
+
ondragenter?: MouseEventHandler<SVGPathElement>;
|
|
68
|
+
ondragleave?: MouseEventHandler<SVGPathElement>;
|
|
69
|
+
ondragover?: MouseEventHandler<SVGPathElement>;
|
|
70
|
+
ondragend?: MouseEventHandler<SVGPathElement>;
|
|
71
|
+
ontouchstart?: MouseEventHandler<SVGPathElement>;
|
|
72
|
+
ontouchmove?: MouseEventHandler<SVGPathElement>;
|
|
73
|
+
ontouchend?: MouseEventHandler<SVGPathElement>;
|
|
74
|
+
ontouchcancel?: MouseEventHandler<SVGPathElement>;
|
|
75
|
+
oncontextmenu?: MouseEventHandler<SVGPathElement>;
|
|
76
|
+
onwheel?: MouseEventHandler<SVGPathElement>;
|
|
77
|
+
/**
|
|
78
|
+
* if you want to give your mark element an extra CSS class
|
|
79
|
+
*/
|
|
80
|
+
class: string | null;
|
|
81
|
+
cursor: ConstantAccessor<CSS.Property.Cursor, T>;
|
|
82
|
+
}>;
|
|
83
|
+
export type LinkableMarkProps<T> = {
|
|
84
|
+
/**
|
|
85
|
+
* if set, the mark element will be wrapped in a <a> link element
|
|
86
|
+
*/
|
|
87
|
+
href?: ConstantAccessor<string, T>;
|
|
88
|
+
/**
|
|
89
|
+
* the relationship of the target object to the link object (e.g. "noopener")
|
|
90
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a#rel
|
|
91
|
+
*/
|
|
92
|
+
rel?: ConstantAccessor<string, T>;
|
|
93
|
+
/**
|
|
94
|
+
* the link target mime type, e.g. "text/csv"
|
|
95
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a#type
|
|
96
|
+
*/
|
|
97
|
+
type?: ConstantAccessor<string, T>;
|
|
98
|
+
/**
|
|
99
|
+
* the target of the link, e.g. "_blank" or "_self"
|
|
100
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a#target
|
|
101
|
+
*/
|
|
102
|
+
target?: ConstantAccessor<'_self' | '_blank' | '_parent' | '_top' | string, T>;
|
|
103
|
+
/**
|
|
104
|
+
* if set to true, the link will be downloaded instead of navigating to it
|
|
105
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#download
|
|
106
|
+
*/
|
|
107
|
+
download?: ConstantAccessor<boolean, T>;
|
|
108
|
+
[key: `data-sveltekit-${string}`]: string | boolean | undefined;
|
|
109
|
+
};
|
|
110
|
+
export type BorderRadius = number | {
|
|
111
|
+
topLeft?: number;
|
|
112
|
+
topRight?: number;
|
|
113
|
+
bottomRight?: number;
|
|
114
|
+
bottomLeft?: number;
|
|
115
|
+
};
|
|
116
|
+
export type BaseRectMarkProps<T> = {
|
|
117
|
+
inset?: ConstantAccessor<number, T>;
|
|
118
|
+
insetLeft?: ConstantAccessor<number, T>;
|
|
119
|
+
insetTop?: ConstantAccessor<number, T>;
|
|
120
|
+
insetRight?: ConstantAccessor<number, T>;
|
|
121
|
+
insetBottom?: ConstantAccessor<number, T>;
|
|
122
|
+
borderRadius?: BorderRadius;
|
|
123
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
import type { ComponentProps } from 'svelte';
|
|
2
|
+
import type { ColorScheme } from './colorScheme';
|
|
3
|
+
import type { GeoProjection } from 'd3-geo';
|
|
4
|
+
import type { ChannelAccessor, ChannelName, ColorScaleOptions, DataRecord, LegendScaleOptions, PlotScales, ScaleOptions, XScaleOptions, YScaleOptions } from '.';
|
|
5
|
+
import type { Snippet } from 'svelte';
|
|
6
|
+
import type { Area, AreaX, AreaY, Arrow, AxisX, AxisY, BarX, BarY, BoxX, BoxY, Brush, BrushX, BrushY, Cell, DifferenceY, Dot, Frame, Geo, Graticule, GridX, GridY, Line, Link, Pointer, Rect, RectX, RectY, RuleX, RuleY, Sphere, Spike, Text, TickX, TickY, Vector } from '../marks';
|
|
7
|
+
export type PlotState = {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
options: PlotOptions;
|
|
11
|
+
facetWidth: number;
|
|
12
|
+
facetHeight: number;
|
|
13
|
+
plotWidth: number;
|
|
14
|
+
plotHeight: number;
|
|
15
|
+
scales: PlotScales;
|
|
16
|
+
body: HTMLDivElement;
|
|
17
|
+
/**
|
|
18
|
+
* True if there's a color scale and a symbol scale and both are bound to the same
|
|
19
|
+
* single channel accessor.
|
|
20
|
+
*/
|
|
21
|
+
colorSymbolRedundant: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* True if the plot is using filled dot marks.
|
|
24
|
+
*/
|
|
25
|
+
hasFilledDotMarks: boolean;
|
|
26
|
+
css: ((d: string) => string) | null;
|
|
27
|
+
};
|
|
28
|
+
export type PlotContext = {
|
|
29
|
+
/**
|
|
30
|
+
* Registers a mark with the Plot component along with its
|
|
31
|
+
* data and the channel mappings.
|
|
32
|
+
*/
|
|
33
|
+
addMark: (mark: Mark<GenericMarkOptions>) => Mark<GenericMarkOptions>;
|
|
34
|
+
/**
|
|
35
|
+
* Updates a mark after either the data or the channel mappings
|
|
36
|
+
* have been updated.
|
|
37
|
+
*/
|
|
38
|
+
updateMark: (mark: Mark<GenericMarkOptions>) => void;
|
|
39
|
+
/**
|
|
40
|
+
* Unregister a mark from the Plot component after the mark
|
|
41
|
+
* component has been destroyed.
|
|
42
|
+
*/
|
|
43
|
+
removeMark: (mark: Mark<GenericMarkOptions>) => void;
|
|
44
|
+
getPlotState: () => PlotState;
|
|
45
|
+
getTopLevelFacet: () => PlotOptions['facet'];
|
|
46
|
+
/**
|
|
47
|
+
* Updates the plots internal facetWidth and facetHeight dimensions
|
|
48
|
+
* which are used as range for the positional scales x and y.
|
|
49
|
+
*/
|
|
50
|
+
updateDimensions: (width: number, height: number) => void;
|
|
51
|
+
};
|
|
52
|
+
type IgnoreDefaults = 'data' | 'facet' | ChannelName | 'title' | 'automatic' | 'children';
|
|
53
|
+
/**
|
|
54
|
+
* these are the default options for the plot marks that can be set using
|
|
55
|
+
* the 'svelteplot/defaults' context.
|
|
56
|
+
*/
|
|
57
|
+
export type PlotDefaults = {
|
|
58
|
+
/**
|
|
59
|
+
* default plot height
|
|
60
|
+
*/
|
|
61
|
+
height: number;
|
|
62
|
+
/**
|
|
63
|
+
* default plot inset
|
|
64
|
+
*/
|
|
65
|
+
inset: number;
|
|
66
|
+
/**
|
|
67
|
+
* default color scheme
|
|
68
|
+
*/
|
|
69
|
+
colorScheme: ColorScheme;
|
|
70
|
+
categoricalColorScheme: ColorScheme | string[];
|
|
71
|
+
/**
|
|
72
|
+
* fallback color to be used for null/NA
|
|
73
|
+
*/
|
|
74
|
+
unknown: string;
|
|
75
|
+
/**
|
|
76
|
+
* optional @emotion/css function to style the plot
|
|
77
|
+
*/
|
|
78
|
+
css: (d: string) => string | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* for computing the automatic height based on the number of
|
|
81
|
+
* domain items in a point scale
|
|
82
|
+
*/
|
|
83
|
+
pointScaleHeight: number;
|
|
84
|
+
/**
|
|
85
|
+
* for computing the automatic height based on the number of
|
|
86
|
+
* domain items in a band scale
|
|
87
|
+
*/
|
|
88
|
+
bandScaleHeight: number;
|
|
89
|
+
/**
|
|
90
|
+
* initial width of the plot before measuring the actual width
|
|
91
|
+
*/
|
|
92
|
+
initialWidth: number;
|
|
93
|
+
/**
|
|
94
|
+
* locale, used for automatic axis ticks
|
|
95
|
+
*/
|
|
96
|
+
locale: string;
|
|
97
|
+
/**
|
|
98
|
+
* default number format for axis ticks
|
|
99
|
+
*/
|
|
100
|
+
numberFormat: Intl.NumberFormatOptions;
|
|
101
|
+
/**
|
|
102
|
+
* default dot radius for line markers, used in dot, circle, and circle-stroke markers
|
|
103
|
+
*/
|
|
104
|
+
markerDotRadius: number;
|
|
105
|
+
/**
|
|
106
|
+
* default props for area marks, applied to area, areaX, and areaY marks
|
|
107
|
+
*/
|
|
108
|
+
area: Partial<Omit<ComponentProps<typeof Area>, IgnoreDefaults>>;
|
|
109
|
+
/**
|
|
110
|
+
* default props for areaX marks
|
|
111
|
+
*/
|
|
112
|
+
areaX: Partial<Omit<ComponentProps<typeof AreaX>, IgnoreDefaults>>;
|
|
113
|
+
/**
|
|
114
|
+
* default props for areaY marks
|
|
115
|
+
*/
|
|
116
|
+
areaY: Partial<Omit<ComponentProps<typeof AreaY>, IgnoreDefaults>>;
|
|
117
|
+
/**
|
|
118
|
+
* default props for arrow marks
|
|
119
|
+
*/
|
|
120
|
+
arrow: Partial<Omit<ComponentProps<typeof Arrow>, IgnoreDefaults>>;
|
|
121
|
+
/**
|
|
122
|
+
* default props for axis marks, applied to both axisX and axisY marks
|
|
123
|
+
*/
|
|
124
|
+
axis: Partial<Omit<ComponentProps<typeof AxisX>, 'data' | 'facet' | ChannelName | 'facetAnchor' | 'labelAnchor' | 'anchor'> & {
|
|
125
|
+
implicit: boolean;
|
|
126
|
+
}>;
|
|
127
|
+
/**
|
|
128
|
+
* default props for axisX marks
|
|
129
|
+
*/
|
|
130
|
+
axisX: Partial<Omit<ComponentProps<typeof AxisX>, IgnoreDefaults> & {
|
|
131
|
+
implicit: boolean;
|
|
132
|
+
}>;
|
|
133
|
+
/**
|
|
134
|
+
* default props for axisY marks
|
|
135
|
+
*/
|
|
136
|
+
axisY: Partial<Omit<ComponentProps<typeof AxisY>, IgnoreDefaults> & {
|
|
137
|
+
implicit: boolean;
|
|
138
|
+
}>;
|
|
139
|
+
/**
|
|
140
|
+
* default props for bar marks, applied to both barX and barY marks
|
|
141
|
+
*/
|
|
142
|
+
bar: Partial<Omit<ComponentProps<typeof BarX>, IgnoreDefaults>>;
|
|
143
|
+
/**
|
|
144
|
+
* default props for barX marks
|
|
145
|
+
*/
|
|
146
|
+
barX: Partial<Omit<ComponentProps<typeof BarX>, IgnoreDefaults>>;
|
|
147
|
+
/**
|
|
148
|
+
* default props for barY marks
|
|
149
|
+
*/
|
|
150
|
+
barY: Partial<Omit<ComponentProps<typeof BarY>, IgnoreDefaults>>;
|
|
151
|
+
/**
|
|
152
|
+
* default props for box marks, applied to boxX and boxY marks
|
|
153
|
+
*/
|
|
154
|
+
box: Partial<Omit<ComponentProps<typeof BoxX>, IgnoreDefaults>>;
|
|
155
|
+
/**
|
|
156
|
+
* default props for boxX marks
|
|
157
|
+
*/
|
|
158
|
+
boxX: Partial<Omit<ComponentProps<typeof BoxX>, IgnoreDefaults>>;
|
|
159
|
+
/**
|
|
160
|
+
* default props for boxY marks
|
|
161
|
+
*/
|
|
162
|
+
boxY: Partial<Omit<ComponentProps<typeof BoxY>, IgnoreDefaults>>;
|
|
163
|
+
/**
|
|
164
|
+
* default props for brush marks, applied to brush, brushX and brushY marks
|
|
165
|
+
*/
|
|
166
|
+
brush: Partial<Omit<ComponentProps<typeof Brush>, IgnoreDefaults | 'limitDimension'>>;
|
|
167
|
+
/**
|
|
168
|
+
* default props for brushX marks
|
|
169
|
+
*/
|
|
170
|
+
brushX: Partial<Omit<ComponentProps<typeof BrushX>, IgnoreDefaults>>;
|
|
171
|
+
/**
|
|
172
|
+
* default props for brushY marks
|
|
173
|
+
*/
|
|
174
|
+
brushY: Partial<Omit<ComponentProps<typeof BrushY>, IgnoreDefaults>>;
|
|
175
|
+
/**
|
|
176
|
+
* default props for cell marks
|
|
177
|
+
*/
|
|
178
|
+
cell: Partial<Omit<ComponentProps<typeof Cell>, IgnoreDefaults>>;
|
|
179
|
+
/**
|
|
180
|
+
* default props for dot marks
|
|
181
|
+
*/
|
|
182
|
+
dot: Partial<Omit<ComponentProps<typeof Dot>, IgnoreDefaults>>;
|
|
183
|
+
/**
|
|
184
|
+
* default props for differenceY marks
|
|
185
|
+
*/
|
|
186
|
+
differenceY: Partial<Omit<ComponentProps<typeof DifferenceY>, IgnoreDefaults>>;
|
|
187
|
+
/**
|
|
188
|
+
* default props for frame marks
|
|
189
|
+
*/
|
|
190
|
+
frame: Partial<ComponentProps<typeof Frame> & {
|
|
191
|
+
implicit: boolean;
|
|
192
|
+
}>;
|
|
193
|
+
/**
|
|
194
|
+
* default props for geo marks
|
|
195
|
+
*/
|
|
196
|
+
geo: Partial<Omit<ComponentProps<typeof Geo>, IgnoreDefaults>>;
|
|
197
|
+
/**
|
|
198
|
+
* default props for graticule marks
|
|
199
|
+
*/
|
|
200
|
+
graticule: Partial<Omit<ComponentProps<typeof Graticule>, IgnoreDefaults>>;
|
|
201
|
+
/**
|
|
202
|
+
* default props for grid marks, applied to both gridX and gridY marks
|
|
203
|
+
*/
|
|
204
|
+
grid: Partial<Omit<ComponentProps<typeof GridX>, IgnoreDefaults> & {
|
|
205
|
+
implicit: boolean;
|
|
206
|
+
}>;
|
|
207
|
+
/**
|
|
208
|
+
* default props for gridX marks
|
|
209
|
+
*/
|
|
210
|
+
gridX: Partial<Omit<ComponentProps<typeof GridX>, IgnoreDefaults> & {
|
|
211
|
+
implicit: boolean;
|
|
212
|
+
}>;
|
|
213
|
+
/**
|
|
214
|
+
* default props for gridY marks
|
|
215
|
+
*/
|
|
216
|
+
gridY: Partial<Omit<ComponentProps<typeof GridY>, IgnoreDefaults> & {
|
|
217
|
+
implicit: boolean;
|
|
218
|
+
}>;
|
|
219
|
+
/**
|
|
220
|
+
* default props for line marks
|
|
221
|
+
*/
|
|
222
|
+
line: Partial<Omit<ComponentProps<typeof Line>, IgnoreDefaults>>;
|
|
223
|
+
/**
|
|
224
|
+
* default props for link marks
|
|
225
|
+
*/
|
|
226
|
+
link: Partial<Omit<ComponentProps<typeof Link>, IgnoreDefaults>>;
|
|
227
|
+
/**
|
|
228
|
+
* default props for pointer marks
|
|
229
|
+
*/
|
|
230
|
+
pointer: Partial<Omit<ComponentProps<typeof Pointer>, IgnoreDefaults>>;
|
|
231
|
+
/**
|
|
232
|
+
* default props for rect marks, applied to rect and rectX marks
|
|
233
|
+
*/
|
|
234
|
+
rect: Partial<Omit<ComponentProps<typeof Rect>, IgnoreDefaults>>;
|
|
235
|
+
/**
|
|
236
|
+
* default props for rectX marks
|
|
237
|
+
*/
|
|
238
|
+
rectX: Partial<Omit<ComponentProps<typeof RectX>, IgnoreDefaults>>;
|
|
239
|
+
/**
|
|
240
|
+
* default props for rectY marks
|
|
241
|
+
*/
|
|
242
|
+
rectY: Partial<Omit<ComponentProps<typeof RectY>, IgnoreDefaults>>;
|
|
243
|
+
/**
|
|
244
|
+
* default props for rule marks
|
|
245
|
+
*/
|
|
246
|
+
rule: Partial<Omit<ComponentProps<typeof RuleX>, IgnoreDefaults>>;
|
|
247
|
+
/**
|
|
248
|
+
* default props for rule marks
|
|
249
|
+
*/
|
|
250
|
+
ruleX: Partial<Omit<ComponentProps<typeof RuleX>, IgnoreDefaults>>;
|
|
251
|
+
/**
|
|
252
|
+
* default props for rule marks
|
|
253
|
+
*/
|
|
254
|
+
ruleY: Partial<Omit<ComponentProps<typeof RuleY>, IgnoreDefaults>>;
|
|
255
|
+
/**
|
|
256
|
+
* default props for sphere marks
|
|
257
|
+
*/
|
|
258
|
+
sphere: Partial<ComponentProps<typeof Sphere>>;
|
|
259
|
+
/**
|
|
260
|
+
* default props for spike marks
|
|
261
|
+
*/
|
|
262
|
+
spike: Partial<Omit<ComponentProps<typeof Spike>, IgnoreDefaults>>;
|
|
263
|
+
/**
|
|
264
|
+
* default props for text marks
|
|
265
|
+
*/
|
|
266
|
+
text: Partial<Omit<ComponentProps<typeof Text>, IgnoreDefaults>>;
|
|
267
|
+
/**
|
|
268
|
+
* default props for tick marks, applied to tickX and tickY marks
|
|
269
|
+
*/
|
|
270
|
+
tick: Partial<Omit<ComponentProps<typeof TickX>, IgnoreDefaults>>;
|
|
271
|
+
/**
|
|
272
|
+
* default props for tickX marks
|
|
273
|
+
*/
|
|
274
|
+
tickX: Partial<Omit<ComponentProps<typeof TickX>, IgnoreDefaults>>;
|
|
275
|
+
/**
|
|
276
|
+
* default props for tickY marks
|
|
277
|
+
*/
|
|
278
|
+
tickY: Partial<Omit<ComponentProps<typeof TickY>, IgnoreDefaults>>;
|
|
279
|
+
/**
|
|
280
|
+
* default props for vector marks
|
|
281
|
+
*/
|
|
282
|
+
vector: Partial<Omit<ComponentProps<typeof Vector>, IgnoreDefaults>>;
|
|
283
|
+
};
|
|
284
|
+
export type PlotOptions = {
|
|
285
|
+
/**
|
|
286
|
+
* The plot title, rendered as H2 tag above the SVG element. Instead of
|
|
287
|
+
* using the title, you can also pass a "header" snippet and render your
|
|
288
|
+
* own custom title markup.
|
|
289
|
+
*/
|
|
290
|
+
title: string;
|
|
291
|
+
/**
|
|
292
|
+
* The plot subtitle, rendered as H3 tag above the SVG element. Instead of
|
|
293
|
+
* using the subtitle, you can also pass a "header" snippet and render your
|
|
294
|
+
* own custom title markup.
|
|
295
|
+
*/
|
|
296
|
+
subtitle: string;
|
|
297
|
+
/**
|
|
298
|
+
* The plot caption, rendered as FIGCAPTION tag below the SVG element. Instead of
|
|
299
|
+
* using the caption, you can also pass a "footer" snippet and render your
|
|
300
|
+
* own custom title markup.
|
|
301
|
+
*/
|
|
302
|
+
caption: string;
|
|
303
|
+
/**
|
|
304
|
+
* By default, the plot will extend to fit 100% of the parent container width. By
|
|
305
|
+
* setting the maxWidth style property you can limit the width of your plot.
|
|
306
|
+
*/
|
|
307
|
+
maxWidth?: string;
|
|
308
|
+
/**
|
|
309
|
+
* force the plot into a fixed width
|
|
310
|
+
*/
|
|
311
|
+
width?: number;
|
|
312
|
+
/**
|
|
313
|
+
* force the plot into a fixed height
|
|
314
|
+
*/
|
|
315
|
+
height: 'auto' | number | ((d: number) => number);
|
|
316
|
+
/**
|
|
317
|
+
* Convenience option for setting all four margins at once, in px.
|
|
318
|
+
*/
|
|
319
|
+
margin: number | {
|
|
320
|
+
top?: number;
|
|
321
|
+
right?: number;
|
|
322
|
+
bottom?: number;
|
|
323
|
+
left?: number;
|
|
324
|
+
};
|
|
325
|
+
/**
|
|
326
|
+
* Left margin of the plot, in px.
|
|
327
|
+
*/
|
|
328
|
+
marginLeft: number;
|
|
329
|
+
/**
|
|
330
|
+
* Right margin of the plot, in px.
|
|
331
|
+
*/
|
|
332
|
+
marginRight: number;
|
|
333
|
+
/**
|
|
334
|
+
* Top margin of the plot, in px.
|
|
335
|
+
*/
|
|
336
|
+
marginTop: number;
|
|
337
|
+
/**
|
|
338
|
+
* Bottom margin of the plot, in px.
|
|
339
|
+
*/
|
|
340
|
+
marginBottom: number;
|
|
341
|
+
/**
|
|
342
|
+
* Activates the implicit GridX and GridY marks.
|
|
343
|
+
*/
|
|
344
|
+
grid: boolean;
|
|
345
|
+
/**
|
|
346
|
+
* Activates the implicit AxisX and AxisY marks.
|
|
347
|
+
*/
|
|
348
|
+
axes: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Activates the implicit frame marks
|
|
351
|
+
*/
|
|
352
|
+
frame: boolean;
|
|
353
|
+
/**
|
|
354
|
+
* Convenience shortcut for setting both the x and y scale insets.
|
|
355
|
+
*/
|
|
356
|
+
inset: number;
|
|
357
|
+
/**
|
|
358
|
+
* Convenience shortcut for setting both the x and y scale paddings
|
|
359
|
+
*/
|
|
360
|
+
padding: number;
|
|
361
|
+
/**
|
|
362
|
+
* Geo-projection
|
|
363
|
+
*/
|
|
364
|
+
projection: string | null | {
|
|
365
|
+
type?: string;
|
|
366
|
+
rotate?: [number, number] | [number, number, number];
|
|
367
|
+
domain?: object;
|
|
368
|
+
inset?: number;
|
|
369
|
+
clip?: Clip;
|
|
370
|
+
} | {
|
|
371
|
+
type: (d: {
|
|
372
|
+
width: number;
|
|
373
|
+
height: number;
|
|
374
|
+
}) => GeoProjection;
|
|
375
|
+
};
|
|
376
|
+
/**
|
|
377
|
+
* if not null, computes a default height such that a variation of one
|
|
378
|
+
* unit in the x dimension is represented by the corresponding number
|
|
379
|
+
* of pixels as a variation in the y dimension of one unit.
|
|
380
|
+
*/
|
|
381
|
+
aspectRatio: number | null;
|
|
382
|
+
/**
|
|
383
|
+
* Top-level faceting options
|
|
384
|
+
*/
|
|
385
|
+
facet: Partial<{
|
|
386
|
+
/**
|
|
387
|
+
* The data to facet by. Turns on automatic faceting for all marks that
|
|
388
|
+
* use the exact same data (===)
|
|
389
|
+
*/
|
|
390
|
+
data: DataRecord<any>[];
|
|
391
|
+
x: ChannelAccessor;
|
|
392
|
+
y: ChannelAccessor;
|
|
393
|
+
}>;
|
|
394
|
+
/**
|
|
395
|
+
* Options for the shared x scale.
|
|
396
|
+
*/
|
|
397
|
+
x: Partial<XScaleOptions>;
|
|
398
|
+
/**
|
|
399
|
+
* Options for the shared y scale
|
|
400
|
+
*/
|
|
401
|
+
y: Partial<YScaleOptions>;
|
|
402
|
+
/**
|
|
403
|
+
* Options for the shared radius scale
|
|
404
|
+
*/
|
|
405
|
+
r: Partial<ScaleOptions>;
|
|
406
|
+
color: Partial<ColorScaleOptions>;
|
|
407
|
+
opacity: Partial<ScaleOptions>;
|
|
408
|
+
symbol: Partial<LegendScaleOptions>;
|
|
409
|
+
length: Partial<ScaleOptions>;
|
|
410
|
+
fx: Partial<ScaleOptions>;
|
|
411
|
+
fy: Partial<ScaleOptions>;
|
|
412
|
+
children: Snippet<[
|
|
413
|
+
{
|
|
414
|
+
width: number;
|
|
415
|
+
height: number;
|
|
416
|
+
options: PlotOptions;
|
|
417
|
+
scales: PlotScales;
|
|
418
|
+
}
|
|
419
|
+
]>;
|
|
420
|
+
/**
|
|
421
|
+
* You can use the header snippet to render a custom title and subtitle for
|
|
422
|
+
* your plot, or place a legend above the visualization.
|
|
423
|
+
*/
|
|
424
|
+
header: Snippet;
|
|
425
|
+
footer: Snippet;
|
|
426
|
+
/**
|
|
427
|
+
* The underlay snippet is useful for adding a layer of custom HTML markup
|
|
428
|
+
* behind the SVG body of your plot, e.g. for a watermark or background image.
|
|
429
|
+
*/
|
|
430
|
+
underlay: Snippet<[PlotOptions]>;
|
|
431
|
+
/**
|
|
432
|
+
* The overlay snippet is useful for adding a layer of custom HTML markup
|
|
433
|
+
* in front of the SVG body of your plot, e.g. for HTML tooltips.
|
|
434
|
+
*/
|
|
435
|
+
overlay: Snippet;
|
|
436
|
+
facetAxes: Snippet;
|
|
437
|
+
/**
|
|
438
|
+
* if you set testid, the plot container will get a data-testid attribute which
|
|
439
|
+
* can be useful for automatic testing
|
|
440
|
+
*/
|
|
441
|
+
testid: string;
|
|
442
|
+
/**
|
|
443
|
+
* in case you want to give your Plot element an extra CSS class
|
|
444
|
+
*/
|
|
445
|
+
class: string | null;
|
|
446
|
+
/**
|
|
447
|
+
* if set to true, the plot will use the implicit scales
|
|
448
|
+
*/
|
|
449
|
+
implicitScales: boolean;
|
|
450
|
+
/**
|
|
451
|
+
* locale used for automatic axis ticks
|
|
452
|
+
*/
|
|
453
|
+
locale: string;
|
|
454
|
+
/**
|
|
455
|
+
* pass a @emotion/css function to style plot using dynamic classes
|
|
456
|
+
*/
|
|
457
|
+
css: (d: string) => string | undefined;
|
|
458
|
+
};
|
|
459
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|