@rokkit/chart 1.0.0-next.150 → 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 (90) hide show
  1. package/dist/PlotState.svelte.d.ts +31 -3
  2. package/dist/crossfilter/createCrossFilter.svelte.d.ts +13 -15
  3. package/dist/index.d.ts +6 -1
  4. package/dist/lib/brewing/BoxBrewer.svelte.d.ts +3 -5
  5. package/dist/lib/brewing/QuartileBrewer.svelte.d.ts +9 -0
  6. package/dist/lib/brewing/ViolinBrewer.svelte.d.ts +3 -4
  7. package/dist/lib/brewing/brewer.svelte.d.ts +5 -36
  8. package/dist/lib/brewing/colors.d.ts +10 -1
  9. package/dist/lib/brewing/marks/points.d.ts +17 -2
  10. package/dist/lib/brewing/stats.d.ts +5 -13
  11. package/dist/lib/chart.d.ts +5 -7
  12. package/dist/lib/keyboard-nav.d.ts +15 -0
  13. package/dist/lib/plot/preset.d.ts +1 -1
  14. package/dist/lib/preset.d.ts +30 -0
  15. package/package.json +2 -1
  16. package/src/AnimatedPlot.svelte +375 -206
  17. package/src/Chart.svelte +81 -87
  18. package/src/ChartProvider.svelte +10 -0
  19. package/src/FacetPlot/Panel.svelte +30 -16
  20. package/src/FacetPlot.svelte +100 -76
  21. package/src/Plot/Area.svelte +26 -19
  22. package/src/Plot/Axis.svelte +81 -59
  23. package/src/Plot/Bar.svelte +47 -89
  24. package/src/Plot/Grid.svelte +23 -19
  25. package/src/Plot/Legend.svelte +213 -147
  26. package/src/Plot/Line.svelte +31 -21
  27. package/src/Plot/Point.svelte +35 -22
  28. package/src/Plot/Root.svelte +46 -91
  29. package/src/Plot/Timeline.svelte +82 -82
  30. package/src/Plot/Tooltip.svelte +68 -62
  31. package/src/Plot.svelte +290 -182
  32. package/src/PlotState.svelte.js +339 -267
  33. package/src/Sparkline.svelte +95 -56
  34. package/src/charts/AreaChart.svelte +22 -20
  35. package/src/charts/BarChart.svelte +23 -21
  36. package/src/charts/BoxPlot.svelte +15 -15
  37. package/src/charts/BubbleChart.svelte +17 -17
  38. package/src/charts/LineChart.svelte +20 -20
  39. package/src/charts/PieChart.svelte +30 -20
  40. package/src/charts/ScatterPlot.svelte +20 -19
  41. package/src/charts/ViolinPlot.svelte +15 -15
  42. package/src/crossfilter/CrossFilter.svelte +33 -29
  43. package/src/crossfilter/FilterBar.svelte +17 -25
  44. package/src/crossfilter/FilterHistogram.svelte +290 -0
  45. package/src/crossfilter/FilterSlider.svelte +69 -65
  46. package/src/crossfilter/createCrossFilter.svelte.js +100 -89
  47. package/src/geoms/Arc.svelte +114 -69
  48. package/src/geoms/Area.svelte +67 -39
  49. package/src/geoms/Bar.svelte +184 -126
  50. package/src/geoms/Box.svelte +102 -90
  51. package/src/geoms/LabelPill.svelte +11 -11
  52. package/src/geoms/Line.svelte +110 -87
  53. package/src/geoms/Point.svelte +132 -87
  54. package/src/geoms/Violin.svelte +45 -33
  55. package/src/geoms/lib/areas.js +122 -99
  56. package/src/geoms/lib/bars.js +195 -144
  57. package/src/index.js +21 -14
  58. package/src/lib/brewing/BoxBrewer.svelte.js +8 -50
  59. package/src/lib/brewing/CartesianBrewer.svelte.js +12 -7
  60. package/src/lib/brewing/PieBrewer.svelte.js +5 -5
  61. package/src/lib/brewing/QuartileBrewer.svelte.js +51 -0
  62. package/src/lib/brewing/ViolinBrewer.svelte.js +8 -49
  63. package/src/lib/brewing/brewer.svelte.js +249 -201
  64. package/src/lib/brewing/colors.js +34 -5
  65. package/src/lib/brewing/marks/arcs.js +28 -28
  66. package/src/lib/brewing/marks/areas.js +54 -41
  67. package/src/lib/brewing/marks/bars.js +34 -34
  68. package/src/lib/brewing/marks/boxes.js +51 -51
  69. package/src/lib/brewing/marks/lines.js +37 -30
  70. package/src/lib/brewing/marks/points.js +74 -26
  71. package/src/lib/brewing/marks/violins.js +57 -57
  72. package/src/lib/brewing/patterns.js +25 -11
  73. package/src/lib/brewing/scales.js +20 -20
  74. package/src/lib/brewing/stats.js +40 -28
  75. package/src/lib/brewing/symbols.js +1 -1
  76. package/src/lib/chart.js +12 -4
  77. package/src/lib/keyboard-nav.js +37 -0
  78. package/src/lib/plot/crossfilter.js +5 -5
  79. package/src/lib/plot/facet.js +30 -30
  80. package/src/lib/plot/frames.js +30 -29
  81. package/src/lib/plot/helpers.js +4 -4
  82. package/src/lib/plot/preset.js +48 -34
  83. package/src/lib/plot/scales.js +64 -39
  84. package/src/lib/plot/stat.js +47 -47
  85. package/src/lib/preset.js +41 -0
  86. package/src/patterns/DefinePatterns.svelte +24 -24
  87. package/src/patterns/PatternDef.svelte +1 -1
  88. package/src/patterns/patterns.js +328 -176
  89. package/src/patterns/scale.js +61 -32
  90. 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
  }