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