@rokkit/chart 1.0.0-next.151 → 1.0.0-next.155
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/PlotState.svelte.d.ts +26 -0
- package/dist/index.d.ts +6 -1
- package/dist/lib/brewing/BoxBrewer.svelte.d.ts +3 -5
- package/dist/lib/brewing/QuartileBrewer.svelte.d.ts +9 -0
- package/dist/lib/brewing/ViolinBrewer.svelte.d.ts +3 -4
- package/dist/lib/brewing/colors.d.ts +10 -1
- package/dist/lib/brewing/marks/points.d.ts +17 -2
- package/dist/lib/keyboard-nav.d.ts +15 -0
- package/dist/lib/plot/preset.d.ts +1 -1
- package/dist/lib/preset.d.ts +30 -0
- package/package.json +2 -1
- package/src/AnimatedPlot.svelte +375 -207
- package/src/Chart.svelte +81 -84
- package/src/ChartProvider.svelte +10 -0
- package/src/FacetPlot/Panel.svelte +30 -16
- package/src/FacetPlot.svelte +100 -76
- package/src/Plot/Area.svelte +26 -19
- package/src/Plot/Axis.svelte +81 -59
- package/src/Plot/Bar.svelte +47 -89
- package/src/Plot/Grid.svelte +23 -19
- package/src/Plot/Legend.svelte +213 -147
- package/src/Plot/Line.svelte +31 -21
- package/src/Plot/Point.svelte +35 -22
- package/src/Plot/Root.svelte +46 -91
- package/src/Plot/Timeline.svelte +82 -82
- package/src/Plot/Tooltip.svelte +68 -62
- package/src/Plot.svelte +290 -174
- package/src/PlotState.svelte.js +338 -265
- package/src/Sparkline.svelte +95 -56
- package/src/charts/AreaChart.svelte +22 -20
- package/src/charts/BarChart.svelte +23 -21
- package/src/charts/BoxPlot.svelte +15 -15
- package/src/charts/BubbleChart.svelte +17 -17
- package/src/charts/LineChart.svelte +20 -20
- package/src/charts/PieChart.svelte +30 -20
- package/src/charts/ScatterPlot.svelte +20 -19
- package/src/charts/ViolinPlot.svelte +15 -15
- package/src/crossfilter/CrossFilter.svelte +33 -29
- package/src/crossfilter/FilterBar.svelte +17 -25
- package/src/crossfilter/FilterHistogram.svelte +290 -0
- package/src/crossfilter/FilterSlider.svelte +69 -65
- package/src/crossfilter/createCrossFilter.svelte.js +94 -90
- package/src/geoms/Arc.svelte +114 -69
- package/src/geoms/Area.svelte +67 -39
- package/src/geoms/Bar.svelte +184 -126
- package/src/geoms/Box.svelte +101 -91
- package/src/geoms/LabelPill.svelte +11 -11
- package/src/geoms/Line.svelte +110 -86
- package/src/geoms/Point.svelte +130 -90
- package/src/geoms/Violin.svelte +51 -41
- package/src/geoms/lib/areas.js +122 -99
- package/src/geoms/lib/bars.js +195 -144
- package/src/index.js +21 -14
- package/src/lib/brewing/BoxBrewer.svelte.js +8 -50
- package/src/lib/brewing/CartesianBrewer.svelte.js +11 -7
- package/src/lib/brewing/PieBrewer.svelte.js +5 -5
- package/src/lib/brewing/QuartileBrewer.svelte.js +51 -0
- package/src/lib/brewing/ViolinBrewer.svelte.js +8 -49
- package/src/lib/brewing/brewer.svelte.js +242 -195
- package/src/lib/brewing/colors.js +34 -5
- package/src/lib/brewing/marks/arcs.js +28 -28
- package/src/lib/brewing/marks/areas.js +54 -41
- package/src/lib/brewing/marks/bars.js +34 -34
- package/src/lib/brewing/marks/boxes.js +51 -51
- package/src/lib/brewing/marks/lines.js +37 -30
- package/src/lib/brewing/marks/points.js +74 -26
- package/src/lib/brewing/marks/violins.js +57 -57
- package/src/lib/brewing/patterns.js +25 -11
- package/src/lib/brewing/scales.js +17 -17
- package/src/lib/brewing/stats.js +37 -29
- package/src/lib/brewing/symbols.js +1 -1
- package/src/lib/chart.js +2 -1
- package/src/lib/keyboard-nav.js +37 -0
- package/src/lib/plot/crossfilter.js +5 -5
- package/src/lib/plot/facet.js +30 -30
- package/src/lib/plot/frames.js +30 -29
- package/src/lib/plot/helpers.js +4 -4
- package/src/lib/plot/preset.js +48 -34
- package/src/lib/plot/scales.js +64 -39
- package/src/lib/plot/stat.js +47 -47
- package/src/lib/preset.js +41 -0
- package/src/patterns/DefinePatterns.svelte +24 -24
- package/src/patterns/README.md +3 -0
- package/src/patterns/patterns.js +328 -176
- package/src/patterns/scale.js +61 -32
- package/src/spec/chart-spec.js +64 -21
package/src/spec/chart-spec.js
CHANGED
|
@@ -1,29 +1,72 @@
|
|
|
1
1
|
export class ChartSpec {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
constructor(data) {
|
|
3
|
+
this.data = data ?? []
|
|
4
|
+
this.channels = {}
|
|
5
|
+
this.layers = []
|
|
6
|
+
this.options = {}
|
|
7
|
+
}
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
x(f) {
|
|
10
|
+
this.channels.x = f
|
|
11
|
+
return this
|
|
12
|
+
}
|
|
13
|
+
y(f) {
|
|
14
|
+
this.channels.y = f
|
|
15
|
+
return this
|
|
16
|
+
}
|
|
17
|
+
color(f) {
|
|
18
|
+
this.channels.color = f
|
|
19
|
+
return this
|
|
20
|
+
}
|
|
21
|
+
pattern(f) {
|
|
22
|
+
this.channels.pattern = f
|
|
23
|
+
return this
|
|
24
|
+
}
|
|
25
|
+
aes(ch) {
|
|
26
|
+
Object.assign(this.channels, ch)
|
|
27
|
+
return this
|
|
28
|
+
}
|
|
14
29
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
30
|
+
bar(opts = {}) {
|
|
31
|
+
this.layers.push({ type: 'bar', ...opts })
|
|
32
|
+
return this
|
|
33
|
+
}
|
|
34
|
+
line(opts = {}) {
|
|
35
|
+
this.layers.push({ type: 'line', ...opts })
|
|
36
|
+
return this
|
|
37
|
+
}
|
|
38
|
+
area(opts = {}) {
|
|
39
|
+
this.layers.push({ type: 'area', ...opts })
|
|
40
|
+
return this
|
|
41
|
+
}
|
|
42
|
+
arc(opts = {}) {
|
|
43
|
+
this.layers.push({ type: 'arc', ...opts })
|
|
44
|
+
return this
|
|
45
|
+
}
|
|
46
|
+
point(opts = {}) {
|
|
47
|
+
this.layers.push({ type: 'point', ...opts })
|
|
48
|
+
return this
|
|
49
|
+
}
|
|
20
50
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
51
|
+
grid(opts = {}) {
|
|
52
|
+
this.options.grid = opts
|
|
53
|
+
return this
|
|
54
|
+
}
|
|
55
|
+
legend(opts = {}) {
|
|
56
|
+
this.options.legend = opts
|
|
57
|
+
return this
|
|
58
|
+
}
|
|
59
|
+
axis(type, opts = {}) {
|
|
60
|
+
this.options[`axis_${type}`] = opts
|
|
61
|
+
return this
|
|
62
|
+
}
|
|
63
|
+
size(w, h) {
|
|
64
|
+
this.options.width = w
|
|
65
|
+
this.options.height = h
|
|
66
|
+
return this
|
|
67
|
+
}
|
|
25
68
|
}
|
|
26
69
|
|
|
27
70
|
export function chart(data, channels = {}) {
|
|
28
|
-
|
|
71
|
+
return new ChartSpec(data).aes(channels)
|
|
29
72
|
}
|