@rokkit/chart 1.0.0-next.15 → 1.0.0-next.151
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 +1 -1
- package/README.md +150 -46
- package/dist/Plot/index.d.ts +9 -0
- package/dist/PlotState.svelte.d.ts +49 -0
- package/dist/crossfilter/createCrossFilter.svelte.d.ts +13 -0
- package/dist/elements/index.d.ts +6 -0
- package/dist/geoms/lib/areas.d.ts +52 -0
- package/dist/geoms/lib/bars.d.ts +3 -0
- package/dist/index.d.ts +51 -0
- package/dist/lib/brewer.d.ts +9 -0
- package/dist/lib/brewing/BoxBrewer.svelte.d.ts +10 -0
- package/dist/lib/brewing/CartesianBrewer.svelte.d.ts +8 -0
- package/dist/lib/brewing/PieBrewer.svelte.d.ts +8 -0
- package/dist/lib/brewing/ViolinBrewer.svelte.d.ts +9 -0
- package/dist/lib/brewing/axes.svelte.d.ts +66 -0
- package/dist/lib/brewing/bars.svelte.d.ts +56 -0
- package/dist/lib/brewing/brewer.svelte.d.ts +114 -0
- package/dist/lib/brewing/colors.d.ts +17 -0
- package/dist/lib/brewing/dimensions.svelte.d.ts +35 -0
- package/dist/lib/brewing/index.svelte.d.ts +118 -0
- package/dist/lib/brewing/legends.svelte.d.ts +48 -0
- package/dist/lib/brewing/marks/arcs.d.ts +17 -0
- package/dist/lib/brewing/marks/areas.d.ts +31 -0
- package/dist/lib/brewing/marks/bars.d.ts +1 -0
- package/dist/lib/brewing/marks/boxes.d.ts +24 -0
- package/dist/lib/brewing/marks/lines.d.ts +24 -0
- package/dist/lib/brewing/marks/points.d.ts +40 -0
- package/dist/lib/brewing/marks/violins.d.ts +20 -0
- package/dist/lib/brewing/patterns.d.ts +14 -0
- package/dist/lib/brewing/scales.d.ts +28 -0
- package/dist/lib/brewing/scales.svelte.d.ts +24 -0
- package/dist/lib/brewing/stats.d.ts +23 -0
- package/dist/lib/brewing/symbols.d.ts +7 -0
- package/dist/lib/brewing/types.d.ts +162 -0
- package/dist/lib/chart.d.ts +38 -0
- package/dist/lib/context.d.ts +13 -0
- package/dist/lib/grid.d.ts +72 -0
- package/dist/lib/plot/chartProps.d.ts +177 -0
- package/dist/lib/plot/crossfilter.d.ts +13 -0
- package/dist/lib/plot/facet.d.ts +24 -0
- package/dist/lib/plot/frames.d.ts +47 -0
- package/dist/lib/plot/helpers.d.ts +3 -0
- package/dist/lib/plot/preset.d.ts +29 -0
- package/dist/lib/plot/scales.d.ts +5 -0
- package/dist/lib/plot/stat.d.ts +32 -0
- package/dist/lib/plot/types.d.ts +89 -0
- package/dist/lib/scales.svelte.d.ts +35 -0
- package/dist/lib/swatch.d.ts +12 -0
- package/dist/lib/ticks.d.ts +36 -0
- package/dist/lib/utils.d.ts +61 -0
- package/dist/lib/xscale.d.ts +11 -0
- package/dist/patterns/index.d.ts +4 -0
- package/dist/patterns/patterns.d.ts +72 -0
- package/dist/patterns/scale.d.ts +30 -0
- package/dist/symbols/constants/index.d.ts +1 -0
- package/dist/symbols/index.d.ts +5 -0
- package/package.json +41 -45
- package/src/AnimatedPlot.svelte +215 -0
- package/src/Chart.svelte +98 -0
- package/src/FacetPlot/Panel.svelte +23 -0
- package/src/FacetPlot.svelte +90 -0
- package/src/Plot/Arc.svelte +29 -0
- package/src/Plot/Area.svelte +25 -0
- package/src/Plot/Axis.svelte +73 -0
- package/src/Plot/Bar.svelte +96 -0
- package/src/Plot/Grid.svelte +30 -0
- package/src/Plot/Legend.svelte +167 -0
- package/src/Plot/Line.svelte +27 -0
- package/src/Plot/Point.svelte +27 -0
- package/src/Plot/Root.svelte +107 -0
- package/src/Plot/Timeline.svelte +95 -0
- package/src/Plot/Tooltip.svelte +81 -0
- package/src/Plot/index.js +9 -0
- package/src/Plot.svelte +181 -0
- package/src/PlotState.svelte.js +277 -0
- package/src/Sparkline.svelte +69 -0
- package/src/Symbol.svelte +21 -0
- package/src/Texture.svelte +18 -0
- package/src/charts/AreaChart.svelte +25 -0
- package/src/charts/BarChart.svelte +26 -0
- package/src/charts/BoxPlot.svelte +21 -0
- package/src/charts/BubbleChart.svelte +23 -0
- package/src/charts/LineChart.svelte +26 -0
- package/src/charts/PieChart.svelte +25 -0
- package/src/charts/ScatterPlot.svelte +25 -0
- package/src/charts/ViolinPlot.svelte +21 -0
- package/src/crossfilter/CrossFilter.svelte +38 -0
- package/src/crossfilter/FilterBar.svelte +32 -0
- package/src/crossfilter/FilterSlider.svelte +79 -0
- package/src/crossfilter/createCrossFilter.svelte.js +120 -0
- package/src/elements/Bar.svelte +22 -24
- package/src/elements/ColorRamp.svelte +20 -22
- package/src/elements/ContinuousLegend.svelte +20 -17
- package/src/elements/DefinePatterns.svelte +24 -0
- package/src/elements/DiscreteLegend.svelte +15 -15
- package/src/elements/Label.svelte +4 -8
- package/src/elements/SymbolGrid.svelte +22 -0
- package/src/elements/index.js +6 -0
- package/src/examples/BarChartExample.svelte +81 -0
- package/src/geoms/Arc.svelte +81 -0
- package/src/geoms/Area.svelte +50 -0
- package/src/geoms/Bar.svelte +142 -0
- package/src/geoms/Box.svelte +103 -0
- package/src/geoms/LabelPill.svelte +17 -0
- package/src/geoms/Line.svelte +99 -0
- package/src/geoms/Point.svelte +105 -0
- package/src/geoms/Violin.svelte +46 -0
- package/src/geoms/lib/areas.js +131 -0
- package/src/geoms/lib/bars.js +172 -0
- package/src/index.js +67 -16
- package/src/lib/brewer.js +25 -0
- package/src/lib/brewing/BoxBrewer.svelte.js +56 -0
- package/src/lib/brewing/CartesianBrewer.svelte.js +17 -0
- package/src/lib/brewing/PieBrewer.svelte.js +14 -0
- package/src/lib/brewing/ViolinBrewer.svelte.js +55 -0
- package/src/lib/brewing/axes.svelte.js +270 -0
- package/src/lib/brewing/bars.svelte.js +201 -0
- package/src/lib/brewing/brewer.svelte.js +230 -0
- package/src/lib/brewing/colors.js +22 -0
- package/src/lib/brewing/dimensions.svelte.js +56 -0
- package/src/lib/brewing/index.svelte.js +205 -0
- package/src/lib/brewing/legends.svelte.js +137 -0
- package/src/lib/brewing/marks/arcs.js +43 -0
- package/src/lib/brewing/marks/areas.js +59 -0
- package/src/lib/brewing/marks/bars.js +49 -0
- package/src/lib/brewing/marks/boxes.js +75 -0
- package/src/lib/brewing/marks/lines.js +48 -0
- package/src/lib/brewing/marks/points.js +57 -0
- package/src/lib/brewing/marks/violins.js +90 -0
- package/src/lib/brewing/patterns.js +31 -0
- package/src/lib/brewing/scales.js +51 -0
- package/src/lib/brewing/scales.svelte.js +82 -0
- package/src/lib/brewing/stats.js +66 -0
- package/src/lib/brewing/symbols.js +10 -0
- package/src/lib/brewing/types.js +73 -0
- package/src/lib/chart.js +220 -0
- package/src/lib/context.js +131 -0
- package/src/lib/grid.js +85 -0
- package/src/lib/plot/chartProps.js +76 -0
- package/src/lib/plot/crossfilter.js +16 -0
- package/src/lib/plot/facet.js +58 -0
- package/src/lib/plot/frames.js +80 -0
- package/src/lib/plot/helpers.js +14 -0
- package/src/lib/plot/preset.js +53 -0
- package/src/lib/plot/scales.js +56 -0
- package/src/lib/plot/stat.js +92 -0
- package/src/lib/plot/types.js +65 -0
- package/src/lib/scales.svelte.js +151 -0
- package/src/lib/swatch.js +13 -0
- package/src/lib/ticks.js +46 -0
- package/src/lib/utils.js +111 -118
- package/src/lib/xscale.js +31 -0
- package/src/patterns/DefinePatterns.svelte +32 -0
- package/src/patterns/PatternDef.svelte +27 -0
- package/src/patterns/index.js +4 -0
- package/src/patterns/patterns.js +208 -0
- package/src/patterns/scale.js +87 -0
- package/src/spec/chart-spec.js +29 -0
- package/src/symbols/RoundedSquare.svelte +33 -0
- package/src/symbols/Shape.svelte +37 -0
- package/src/symbols/constants/index.js +4 -0
- package/src/symbols/index.js +9 -0
- package/src/symbols/outline.svelte +60 -0
- package/src/symbols/solid.svelte +60 -0
- package/src/chart/FacetGrid.svelte +0 -51
- package/src/chart/Grid.svelte +0 -34
- package/src/chart/Legend.svelte +0 -16
- package/src/chart/PatternDefs.svelte +0 -13
- package/src/chart/Swatch.svelte +0 -93
- package/src/chart/SwatchButton.svelte +0 -29
- package/src/chart/SwatchGrid.svelte +0 -55
- package/src/chart/Symbol.svelte +0 -37
- package/src/chart/Texture.svelte +0 -16
- package/src/chart/TexturedShape.svelte +0 -27
- package/src/chart/TimelapseChart.svelte +0 -97
- package/src/chart/Timer.svelte +0 -27
- package/src/chart.js +0 -9
- package/src/components/charts/Axis.svelte +0 -66
- package/src/components/charts/Chart.svelte +0 -35
- package/src/components/index.js +0 -23
- package/src/components/lib/axis.js +0 -0
- package/src/components/lib/chart.js +0 -187
- package/src/components/lib/color.js +0 -327
- package/src/components/lib/funnel.js +0 -204
- package/src/components/lib/index.js +0 -19
- package/src/components/lib/pattern.js +0 -190
- package/src/components/lib/rollup.js +0 -55
- package/src/components/lib/shape.js +0 -199
- package/src/components/lib/summary.js +0 -145
- package/src/components/lib/theme.js +0 -23
- package/src/components/lib/timer.js +0 -41
- package/src/components/lib/utils.js +0 -165
- package/src/components/plots/BarPlot.svelte +0 -36
- package/src/components/plots/BoxPlot.svelte +0 -54
- package/src/components/plots/ScatterPlot.svelte +0 -30
- package/src/components/store.js +0 -70
- package/src/constants.js +0 -66
- package/src/elements/PatternDefs.svelte +0 -13
- package/src/elements/PatternMask.svelte +0 -20
- package/src/elements/Symbol.svelte +0 -38
- package/src/elements/Tooltip.svelte +0 -23
- package/src/funnel.svelte +0 -35
- package/src/geom.js +0 -105
- package/src/lib/axis.js +0 -75
- package/src/lib/colors.js +0 -32
- package/src/lib/geom.js +0 -4
- package/src/lib/shapes.js +0 -144
- package/src/lib/timer.js +0 -44
- package/src/lookup.js +0 -29
- package/src/plots/BarPlot.svelte +0 -55
- package/src/plots/BoxPlot.svelte +0 -0
- package/src/plots/FunnelPlot.svelte +0 -33
- package/src/plots/HeatMap.svelte +0 -5
- package/src/plots/HeatMapCalendar.svelte +0 -129
- package/src/plots/LinePlot.svelte +0 -55
- package/src/plots/Plot.svelte +0 -25
- package/src/plots/RankBarPlot.svelte +0 -38
- package/src/plots/ScatterPlot.svelte +0 -20
- package/src/plots/ViolinPlot.svelte +0 -11
- package/src/plots/heatmap.js +0 -70
- package/src/plots/index.js +0 -10
- package/src/swatch.js +0 -11
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
export type ChartMargin = {
|
|
2
|
+
/**
|
|
3
|
+
* - Top margin
|
|
4
|
+
*/
|
|
5
|
+
top: number;
|
|
6
|
+
/**
|
|
7
|
+
* - Right margin
|
|
8
|
+
*/
|
|
9
|
+
right: number;
|
|
10
|
+
/**
|
|
11
|
+
* - Bottom margin
|
|
12
|
+
*/
|
|
13
|
+
bottom: number;
|
|
14
|
+
/**
|
|
15
|
+
* - Left margin
|
|
16
|
+
*/
|
|
17
|
+
left: number;
|
|
18
|
+
};
|
|
19
|
+
export type ChartDimensions = {
|
|
20
|
+
/**
|
|
21
|
+
* - Total chart width
|
|
22
|
+
*/
|
|
23
|
+
width: number;
|
|
24
|
+
/**
|
|
25
|
+
* - Total chart height
|
|
26
|
+
*/
|
|
27
|
+
height: number;
|
|
28
|
+
/**
|
|
29
|
+
* - Chart margins
|
|
30
|
+
*/
|
|
31
|
+
margin: ChartMargin;
|
|
32
|
+
/**
|
|
33
|
+
* - Chart width without margins
|
|
34
|
+
*/
|
|
35
|
+
innerWidth: number;
|
|
36
|
+
/**
|
|
37
|
+
* - Chart height without margins
|
|
38
|
+
*/
|
|
39
|
+
innerHeight: number;
|
|
40
|
+
};
|
|
41
|
+
export type ChartScales = {
|
|
42
|
+
/**
|
|
43
|
+
* - X-axis scale function
|
|
44
|
+
*/
|
|
45
|
+
x: Function;
|
|
46
|
+
/**
|
|
47
|
+
* - Y-axis scale function
|
|
48
|
+
*/
|
|
49
|
+
y: Function;
|
|
50
|
+
/**
|
|
51
|
+
* - Color scale function
|
|
52
|
+
*/
|
|
53
|
+
color: Function;
|
|
54
|
+
};
|
|
55
|
+
export type ScaleFields = {
|
|
56
|
+
/**
|
|
57
|
+
* - X-axis field
|
|
58
|
+
*/
|
|
59
|
+
x: string;
|
|
60
|
+
/**
|
|
61
|
+
* - Y-axis field
|
|
62
|
+
*/
|
|
63
|
+
y: string;
|
|
64
|
+
/**
|
|
65
|
+
* - Color field
|
|
66
|
+
*/
|
|
67
|
+
color: string;
|
|
68
|
+
};
|
|
69
|
+
export type TickData = {
|
|
70
|
+
/**
|
|
71
|
+
* - Tick value
|
|
72
|
+
*/
|
|
73
|
+
value: any;
|
|
74
|
+
/**
|
|
75
|
+
* - Tick position in pixels
|
|
76
|
+
*/
|
|
77
|
+
position: number;
|
|
78
|
+
/**
|
|
79
|
+
* - Formatted tick label
|
|
80
|
+
*/
|
|
81
|
+
formattedValue: string;
|
|
82
|
+
};
|
|
83
|
+
export type AxisData = {
|
|
84
|
+
/**
|
|
85
|
+
* - Tick data
|
|
86
|
+
*/
|
|
87
|
+
ticks: TickData[];
|
|
88
|
+
/**
|
|
89
|
+
* - Axis label
|
|
90
|
+
*/
|
|
91
|
+
label: string;
|
|
92
|
+
/**
|
|
93
|
+
* - SVG transform attribute value
|
|
94
|
+
*/
|
|
95
|
+
transform: string;
|
|
96
|
+
/**
|
|
97
|
+
* - SVG transform for the label
|
|
98
|
+
*/
|
|
99
|
+
labelTransform: string;
|
|
100
|
+
};
|
|
101
|
+
export type BarData = {
|
|
102
|
+
/**
|
|
103
|
+
* - Original data point
|
|
104
|
+
*/
|
|
105
|
+
data: Object;
|
|
106
|
+
/**
|
|
107
|
+
* - X position
|
|
108
|
+
*/
|
|
109
|
+
x: number;
|
|
110
|
+
/**
|
|
111
|
+
* - Y position
|
|
112
|
+
*/
|
|
113
|
+
y: number;
|
|
114
|
+
/**
|
|
115
|
+
* - Width of the bar
|
|
116
|
+
*/
|
|
117
|
+
width: number;
|
|
118
|
+
/**
|
|
119
|
+
* - Height of the bar
|
|
120
|
+
*/
|
|
121
|
+
height: number;
|
|
122
|
+
/**
|
|
123
|
+
* - Color of the bar
|
|
124
|
+
*/
|
|
125
|
+
color: string;
|
|
126
|
+
};
|
|
127
|
+
export type LegendItem = {
|
|
128
|
+
/**
|
|
129
|
+
* - Legend item value
|
|
130
|
+
*/
|
|
131
|
+
value: any;
|
|
132
|
+
/**
|
|
133
|
+
* - Item color
|
|
134
|
+
*/
|
|
135
|
+
color: string;
|
|
136
|
+
/**
|
|
137
|
+
* - Y position
|
|
138
|
+
*/
|
|
139
|
+
y: number;
|
|
140
|
+
/**
|
|
141
|
+
* - Shape type ('rect' or 'circle')
|
|
142
|
+
*/
|
|
143
|
+
shape: string;
|
|
144
|
+
/**
|
|
145
|
+
* - Size of the marker
|
|
146
|
+
*/
|
|
147
|
+
markerSize: number;
|
|
148
|
+
};
|
|
149
|
+
export type LegendData = {
|
|
150
|
+
/**
|
|
151
|
+
* - Legend items
|
|
152
|
+
*/
|
|
153
|
+
items: LegendItem[];
|
|
154
|
+
/**
|
|
155
|
+
* - Legend title
|
|
156
|
+
*/
|
|
157
|
+
title: string;
|
|
158
|
+
/**
|
|
159
|
+
* - SVG transform attribute value
|
|
160
|
+
*/
|
|
161
|
+
transform: string;
|
|
162
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export function chart(data: any, aes: any): Chart;
|
|
2
|
+
declare class Chart {
|
|
3
|
+
constructor(data: any, opts: any);
|
|
4
|
+
width: number | undefined;
|
|
5
|
+
height: number | undefined;
|
|
6
|
+
flipCoords: any;
|
|
7
|
+
x: any;
|
|
8
|
+
y: any;
|
|
9
|
+
value: any;
|
|
10
|
+
valueLabel: any;
|
|
11
|
+
valueFormat: any;
|
|
12
|
+
fill: any;
|
|
13
|
+
color: any;
|
|
14
|
+
shape: any;
|
|
15
|
+
padding(value: any): this;
|
|
16
|
+
spacing: number | undefined;
|
|
17
|
+
margin(value: any): this;
|
|
18
|
+
stat: any;
|
|
19
|
+
domain: any;
|
|
20
|
+
data: any;
|
|
21
|
+
refresh(): this;
|
|
22
|
+
range: {
|
|
23
|
+
x: any[];
|
|
24
|
+
y: any[];
|
|
25
|
+
} | undefined;
|
|
26
|
+
origin: {
|
|
27
|
+
x: any;
|
|
28
|
+
y: any;
|
|
29
|
+
} | undefined;
|
|
30
|
+
scale: {
|
|
31
|
+
x: any;
|
|
32
|
+
y: any;
|
|
33
|
+
} | undefined;
|
|
34
|
+
aggregate(value: any, stat: any): void;
|
|
35
|
+
ticks(axis: any, count: any, fontSize?: number): any;
|
|
36
|
+
#private;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates chart context and provides it to child components
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} options Initial chart options
|
|
5
|
+
* @returns {Object} Chart context with all stores and methods
|
|
6
|
+
*/
|
|
7
|
+
export function createChartContext(options?: Object): Object;
|
|
8
|
+
/**
|
|
9
|
+
* Gets chart context provided by parent component
|
|
10
|
+
*
|
|
11
|
+
* @returns {Object} Chart context
|
|
12
|
+
*/
|
|
13
|
+
export function getChartContext(): Object;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef GridPoint
|
|
3
|
+
* @property {number} x - x-coordinate of the point
|
|
4
|
+
* @property {number} y - y-coordinate of the point
|
|
5
|
+
* @property {number} r - radius of the point
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @typedef SwatchGrid
|
|
9
|
+
* @property {number} width - width of the grid
|
|
10
|
+
* @property {number} height - height of the grid
|
|
11
|
+
* @property {GridPoint[]} data - data points of the grid
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @tyoedef {Object} GridOptions
|
|
15
|
+
* @property {number} [pad=0] - The padding between the items
|
|
16
|
+
* @property {number} [columns=0] - The number of columns
|
|
17
|
+
* @property {number} [rows=0] - The number of rows
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Calculates a grid of centres to fit a list of items of `size` within the number of `columns` and `rows`.
|
|
21
|
+
*
|
|
22
|
+
* - Attempts to find a best fit square if both columns and rows are not specified
|
|
23
|
+
* - Value in columns is prioritized over rows for recalculating the grid
|
|
24
|
+
* - Supports padding between the items
|
|
25
|
+
*
|
|
26
|
+
* @param {number} count - number of items
|
|
27
|
+
* @param {number} size - size of the items
|
|
28
|
+
* @param {GridOptions} options - options for the grid
|
|
29
|
+
* @returns {SwatchGrid}
|
|
30
|
+
*/
|
|
31
|
+
export function swatchGrid(count: number, size: number, options: GridOptions): SwatchGrid;
|
|
32
|
+
/**
|
|
33
|
+
* Spreads values as patterns with colors from a palette
|
|
34
|
+
*
|
|
35
|
+
* @param {number[]} values - values to spread
|
|
36
|
+
* @param {string[]} patterns - patterns to spread
|
|
37
|
+
* @param {string[]} palette - colors to spread
|
|
38
|
+
* @returns {Record<number, { id: string, pattern: string, color: string }>}
|
|
39
|
+
*/
|
|
40
|
+
export function spreadValuesAsPatterns(values: number[], patterns: string[], palette: string[]): Record<number, {
|
|
41
|
+
id: string;
|
|
42
|
+
pattern: string;
|
|
43
|
+
color: string;
|
|
44
|
+
}>;
|
|
45
|
+
export type GridPoint = {
|
|
46
|
+
/**
|
|
47
|
+
* - x-coordinate of the point
|
|
48
|
+
*/
|
|
49
|
+
x: number;
|
|
50
|
+
/**
|
|
51
|
+
* - y-coordinate of the point
|
|
52
|
+
*/
|
|
53
|
+
y: number;
|
|
54
|
+
/**
|
|
55
|
+
* - radius of the point
|
|
56
|
+
*/
|
|
57
|
+
r: number;
|
|
58
|
+
};
|
|
59
|
+
export type SwatchGrid = {
|
|
60
|
+
/**
|
|
61
|
+
* - width of the grid
|
|
62
|
+
*/
|
|
63
|
+
width: number;
|
|
64
|
+
/**
|
|
65
|
+
* - height of the grid
|
|
66
|
+
*/
|
|
67
|
+
height: number;
|
|
68
|
+
/**
|
|
69
|
+
* - data points of the grid
|
|
70
|
+
*/
|
|
71
|
+
data: GridPoint[];
|
|
72
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common props shared by all high-level chart wrappers.
|
|
3
|
+
*/
|
|
4
|
+
export type ChartProps = {
|
|
5
|
+
/**
|
|
6
|
+
* - Data array to visualize
|
|
7
|
+
*/
|
|
8
|
+
data?: Object[] | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* - Field name for the X axis
|
|
11
|
+
*/
|
|
12
|
+
x?: string | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* - Field name for the Y axis
|
|
15
|
+
*/
|
|
16
|
+
y?: string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* - Field name for fill color grouping (alias for color)
|
|
19
|
+
*/
|
|
20
|
+
fill?: string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* - Field name for color grouping
|
|
23
|
+
*/
|
|
24
|
+
color?: string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* - Field name for pattern fill grouping
|
|
27
|
+
*/
|
|
28
|
+
pattern?: string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* - Aggregation stat: 'identity' | 'sum' | 'mean' | 'count' | 'min' | 'max' | 'median' | 'boxplot'
|
|
31
|
+
*/
|
|
32
|
+
stat?: string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* - SVG width in pixels
|
|
35
|
+
*/
|
|
36
|
+
width?: number | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* - SVG height in pixels
|
|
39
|
+
*/
|
|
40
|
+
height?: number | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* - Color mode: 'light' | 'dark'
|
|
43
|
+
*/
|
|
44
|
+
mode?: string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* - Whether to show grid lines
|
|
47
|
+
*/
|
|
48
|
+
grid?: boolean | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* - Whether to show the legend
|
|
51
|
+
*/
|
|
52
|
+
legend?: boolean | undefined;
|
|
53
|
+
};
|
|
54
|
+
export type BarChartProps = Object;
|
|
55
|
+
export type PieChartProps = {
|
|
56
|
+
/**
|
|
57
|
+
* - Data array to visualize
|
|
58
|
+
*/
|
|
59
|
+
data?: Object[] | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* - Field name for slice labels (drives color key)
|
|
62
|
+
*/
|
|
63
|
+
label?: string | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* - Field name for slice values (theta)
|
|
66
|
+
*/
|
|
67
|
+
y?: string | undefined;
|
|
68
|
+
/**
|
|
69
|
+
* - Alternative to label for color grouping
|
|
70
|
+
*/
|
|
71
|
+
fill?: string | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* - Inner radius as fraction of outer (0=pie, 0.5=donut)
|
|
74
|
+
*/
|
|
75
|
+
innerRadius?: number | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* - Aggregation stat (default sum for pie charts)
|
|
78
|
+
*/
|
|
79
|
+
stat?: string | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* - SVG width in pixels
|
|
82
|
+
*/
|
|
83
|
+
width?: number | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* - SVG height in pixels
|
|
86
|
+
*/
|
|
87
|
+
height?: number | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* - Color mode: 'light' | 'dark'
|
|
90
|
+
*/
|
|
91
|
+
mode?: string | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* - Whether to show the legend
|
|
94
|
+
*/
|
|
95
|
+
legend?: boolean | undefined;
|
|
96
|
+
};
|
|
97
|
+
export type BoxViolinChartProps = {
|
|
98
|
+
/**
|
|
99
|
+
* - Data array to visualize
|
|
100
|
+
*/
|
|
101
|
+
data?: Object[] | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* - Field name for the category axis (groups)
|
|
104
|
+
*/
|
|
105
|
+
x?: string | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* - Field name for the value axis (raw observations)
|
|
108
|
+
*/
|
|
109
|
+
y?: string | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* - Field name for fill color; when different from x, sub-groups within each x-band (like grouped bars); lighter shade used for body, darker shade for whiskers/outline
|
|
112
|
+
*/
|
|
113
|
+
fill?: string | undefined;
|
|
114
|
+
/**
|
|
115
|
+
* - SVG width in pixels
|
|
116
|
+
*/
|
|
117
|
+
width?: number | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* - SVG height in pixels
|
|
120
|
+
*/
|
|
121
|
+
height?: number | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* - Color mode: 'light' | 'dark'
|
|
124
|
+
*/
|
|
125
|
+
mode?: string | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* - Whether to show grid lines
|
|
128
|
+
*/
|
|
129
|
+
grid?: boolean | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* - Whether to show the legend
|
|
132
|
+
*/
|
|
133
|
+
legend?: boolean | undefined;
|
|
134
|
+
};
|
|
135
|
+
export type ScatterBubbleChartProps = {
|
|
136
|
+
/**
|
|
137
|
+
* - Data array to visualize
|
|
138
|
+
*/
|
|
139
|
+
data?: Object[] | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* - Field name for X position
|
|
142
|
+
*/
|
|
143
|
+
x?: string | undefined;
|
|
144
|
+
/**
|
|
145
|
+
* - Field name for Y position
|
|
146
|
+
*/
|
|
147
|
+
y?: string | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* - Field name for color grouping
|
|
150
|
+
*/
|
|
151
|
+
color?: string | undefined;
|
|
152
|
+
/**
|
|
153
|
+
* - Field name for point radius (BubbleChart: required)
|
|
154
|
+
*/
|
|
155
|
+
size?: string | undefined;
|
|
156
|
+
/**
|
|
157
|
+
* - SVG width in pixels
|
|
158
|
+
*/
|
|
159
|
+
width?: number | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* - SVG height in pixels
|
|
162
|
+
*/
|
|
163
|
+
height?: number | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* - Color mode: 'light' | 'dark'
|
|
166
|
+
*/
|
|
167
|
+
mode?: string | undefined;
|
|
168
|
+
/**
|
|
169
|
+
* - Whether to show grid lines
|
|
170
|
+
*/
|
|
171
|
+
grid?: boolean | undefined;
|
|
172
|
+
/**
|
|
173
|
+
* - Whether to show the legend
|
|
174
|
+
*/
|
|
175
|
+
legend?: boolean | undefined;
|
|
176
|
+
};
|
|
177
|
+
export type LineAreaChartProps = Object;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies dimming state to data rows using crossfilter instance.
|
|
3
|
+
* Maps each row to { data: row, dimmed: boolean }.
|
|
4
|
+
*
|
|
5
|
+
* @param {Object[]} data - raw data array
|
|
6
|
+
* @param {Object} cf - crossfilter instance (from createCrossFilter)
|
|
7
|
+
* @param {Object} channels - { x, y, color, ... } field name mapping
|
|
8
|
+
* @returns {{ data: Object, dimmed: boolean }[]}
|
|
9
|
+
*/
|
|
10
|
+
export function applyDimming(data: Object[], cf: Object, channels: Object): {
|
|
11
|
+
data: Object;
|
|
12
|
+
dimmed: boolean;
|
|
13
|
+
}[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Splits data into a Map of panels keyed by facet field value.
|
|
3
|
+
* Preserves insertion order of first occurrence.
|
|
4
|
+
*
|
|
5
|
+
* @param {Object[]} data
|
|
6
|
+
* @param {string} field
|
|
7
|
+
* @returns {Map<unknown, Object[]>}
|
|
8
|
+
*/
|
|
9
|
+
export function splitByField(data: Object[], field: string): Map<unknown, Object[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Computes x/y domains for each panel.
|
|
12
|
+
*
|
|
13
|
+
* @param {Map<unknown, Object[]>} panels
|
|
14
|
+
* @param {{ x: string, y: string }} channels
|
|
15
|
+
* @param {'fixed'|'free'|'free_x'|'free_y'} scalesMode
|
|
16
|
+
* @returns {Map<unknown, { xDomain: unknown[], yDomain: [number, number] }>}
|
|
17
|
+
*/
|
|
18
|
+
export function getFacetDomains(panels: Map<unknown, Object[]>, channels: {
|
|
19
|
+
x: string;
|
|
20
|
+
y: string;
|
|
21
|
+
}, scalesMode?: "fixed" | "free" | "free_x" | "free_y"): Map<unknown, {
|
|
22
|
+
xDomain: unknown[];
|
|
23
|
+
yDomain: [number, number];
|
|
24
|
+
}>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts animation frames from data, keyed by time field value.
|
|
3
|
+
* Preserves insertion order of time values.
|
|
4
|
+
*
|
|
5
|
+
* @param {Object[]} data
|
|
6
|
+
* @param {string} timeField
|
|
7
|
+
* @returns {Map<unknown, Object[]>}
|
|
8
|
+
*/
|
|
9
|
+
export function extractFrames(data: Object[], timeField: string): Map<unknown, Object[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Ensures all frame values (byField) appear for every (x, color?) combination.
|
|
12
|
+
* Uses dataset alignBy to fill missing frame-value combos with y=0 so bars
|
|
13
|
+
* animate smoothly rather than disappearing between frames.
|
|
14
|
+
*
|
|
15
|
+
* Call after pre-aggregation. The result can be split directly by extractFrames
|
|
16
|
+
* with no further per-frame normalization needed.
|
|
17
|
+
*
|
|
18
|
+
* @param {Object[]} data - pre-aggregated rows, one per (x, color?, byField)
|
|
19
|
+
* @param {{ x?: string, y: string, color?: string }} channels
|
|
20
|
+
* @param {string} byField - the frame field (e.g. 'year')
|
|
21
|
+
* @returns {Object[]}
|
|
22
|
+
*/
|
|
23
|
+
export function completeFrames(data: Object[], channels: {
|
|
24
|
+
x?: string;
|
|
25
|
+
y: string;
|
|
26
|
+
color?: string;
|
|
27
|
+
}, byField: string): Object[];
|
|
28
|
+
/**
|
|
29
|
+
* Computes static x/y domains from the full (pre-split) data array.
|
|
30
|
+
* These domains stay constant throughout the animation so values are
|
|
31
|
+
* always comparable across frames.
|
|
32
|
+
*
|
|
33
|
+
* NOTE: y domain is pinned to [0, max] — assumes bar chart semantics.
|
|
34
|
+
* Pass an explicit yDomain override for scatter/line charts where y can
|
|
35
|
+
* be negative.
|
|
36
|
+
*
|
|
37
|
+
* @param {Object[]} data - full dataset (before frame extraction)
|
|
38
|
+
* @param {{ x: string, y: string }} channels
|
|
39
|
+
* @returns {{ xDomain: unknown[], yDomain: [number, number] }}
|
|
40
|
+
*/
|
|
41
|
+
export function computeStaticDomains(data: Object[], channels: {
|
|
42
|
+
x: string;
|
|
43
|
+
y: string;
|
|
44
|
+
}): {
|
|
45
|
+
xDomain: unknown[];
|
|
46
|
+
yDomain: [number, number];
|
|
47
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function resolvePreset(name: any, helpers?: {}): {
|
|
2
|
+
colors: any;
|
|
3
|
+
patterns: any;
|
|
4
|
+
symbols: any;
|
|
5
|
+
};
|
|
6
|
+
export namespace DEFAULT_PRESET {
|
|
7
|
+
export let colors: string[];
|
|
8
|
+
export { PATTERN_ORDER as patterns };
|
|
9
|
+
export { SYMBOL_ORDER as symbols };
|
|
10
|
+
}
|
|
11
|
+
export namespace ACCESSIBLE_PRESET {
|
|
12
|
+
let colors_1: string[];
|
|
13
|
+
export { colors_1 as colors };
|
|
14
|
+
export { PATTERN_ORDER as patterns };
|
|
15
|
+
export { SYMBOL_ORDER as symbols };
|
|
16
|
+
}
|
|
17
|
+
export namespace PRINT_PRESET {
|
|
18
|
+
let colors_2: string[];
|
|
19
|
+
export { colors_2 as colors };
|
|
20
|
+
export let patterns: string[];
|
|
21
|
+
export { SYMBOL_ORDER as symbols };
|
|
22
|
+
}
|
|
23
|
+
export type PlotPreset = {
|
|
24
|
+
colors: string[];
|
|
25
|
+
patterns: string[];
|
|
26
|
+
symbols: string[];
|
|
27
|
+
};
|
|
28
|
+
import { PATTERN_ORDER } from '../brewing/patterns.js';
|
|
29
|
+
import { SYMBOL_ORDER } from '../brewing/symbols.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export function inferFieldType(data: any, field: any): "continuous" | "band";
|
|
2
|
+
export function inferOrientation(xType: any, yType: any): "none" | "vertical" | "horizontal";
|
|
3
|
+
export function buildUnifiedXScale(datasets: any, field: any, width: any, opts?: {}): any;
|
|
4
|
+
export function buildUnifiedYScale(datasets: any, field: any, height: any, opts?: {}): any;
|
|
5
|
+
export function inferColorScaleType(data: any, field: any, spec?: {}): any;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves a stat name to an aggregation function.
|
|
3
|
+
* Checks built-ins first, then helpers.stats, then warns and falls back to identity.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} name
|
|
6
|
+
* @param {Object} helpers
|
|
7
|
+
* @returns {Function}
|
|
8
|
+
*/
|
|
9
|
+
export function resolveStat(name: string, helpers?: Object): Function;
|
|
10
|
+
/**
|
|
11
|
+
* Infers group-by fields from channels by excluding value fields.
|
|
12
|
+
* valueFields may contain channel keys (e.g. ['y', 'size']) OR field values (e.g. ['cty']).
|
|
13
|
+
* A channel's field is excluded if either the channel key OR the field value is in valueFields.
|
|
14
|
+
*
|
|
15
|
+
* @param {Record<string, string|undefined>} channels
|
|
16
|
+
* @param {string[]} valueFields
|
|
17
|
+
* @returns {string[]}
|
|
18
|
+
*/
|
|
19
|
+
export function inferGroupByFields(channels: Record<string, string | undefined>, valueFields: string[]): string[];
|
|
20
|
+
/**
|
|
21
|
+
* Applies a stat aggregation to data based on a geom config.
|
|
22
|
+
* Returns data unchanged for identity stat.
|
|
23
|
+
*
|
|
24
|
+
* @param {Object[]} data
|
|
25
|
+
* @param {{ stat?: string, channels?: Record<string, string> }} geomConfig
|
|
26
|
+
* @param {Object} helpers
|
|
27
|
+
* @returns {Object[]}
|
|
28
|
+
*/
|
|
29
|
+
export function applyGeomStat(data: Object[], geomConfig: {
|
|
30
|
+
stat?: string;
|
|
31
|
+
channels?: Record<string, string>;
|
|
32
|
+
}, helpers?: Object): Object[];
|