@swiftplot/vue 0.7.0 → 0.8.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/README.md CHANGED
@@ -60,9 +60,9 @@ Each point comes from profiling uPlot, the fastest of the other twelve libraries
60
60
 
61
61
  - **Axis text is DOM, not canvas text.** uPlot's axis drawing cost 17–21 ms at 4× CPU slowdown at every data size.
62
62
  - **Each mark has its own x column.** No aligned table, so no join step.
63
- - **Step lines and bands are reduced to one min/max per pixel column** before the path is built.
63
+ - **Lines and areas are reduced to one min/max per pixel column** before the path is built, and only the rows the window shows are read.
64
64
  - **Typed-array columns in, scale maths inlined** in the draw loops.
65
- - **Scatter switches to WebGL2 at 20,000 points, bars, error bars, box plots and candlesticks at 10,000, and a sankey at 1,000 nodes and links together.** WebGL2 set-up costs about 4 ms, so a scatter on Canvas 2D mounts sooner below roughly 20,000 points. When the browser takes a WebGL context away, as it does with many WebGL charts on one page, that chart falls back to Canvas 2D.
65
+ - **Scatter switches to WebGL2 at 20,000 points, bars, error bars, box plots and candlesticks at 10,000, and a sankey at 1,000 nodes and links together.** Setting WebGL2 up has a fixed cost, so a scatter on Canvas 2D mounts sooner below roughly 20,000 points. Points are drawn as point sprites from one buffer in one draw call, and rectangles are instanced. When the browser takes a WebGL context away, as it does with many WebGL charts on one page, that chart falls back to Canvas 2D.
66
66
  - **Paths and GPU buffers are kept,** so a hover repaint never touches the data again.
67
67
 
68
68
  ## Measured
@@ -100,14 +100,14 @@ Gzip size of the minified bundle of each entry in `site/scripts/size/`, built fr
100
100
 
101
101
  | entry | imports | KB |
102
102
  | ------------------ | ------------------------------------------------------- | ---: |
103
- | plot-line | `plot` and `line` from `swiftplot` | 15.7 |
104
- | plot-line-features | the same with `tooltip`, `legend`, `zoom` and `animate` | 21.5 |
105
- | line-chart | `lineChart` from `swiftplot/charts` | 45.1 |
106
- | all-charts | every chart of `swiftplot/charts` | 64.0 |
107
- | react-line-chart | `LineChart` from `@swiftplot/react`, React not counted | 47.0 |
108
- | vue-line-chart | `LineChart` from `@swiftplot/vue`, Vue not counted | 47.7 |
109
- | element-line | `define` from `swiftplot/element` with `lineChart` | 46.7 |
110
- | element-all | `swiftplot/element/all`, every chart as `<swift-plot>` | 65.8 |
103
+ | plot-line | `plot` and `line` from `swiftplot` | 16.9 |
104
+ | plot-line-features | the same with `tooltip`, `legend`, `zoom` and `animate` | 22.8 |
105
+ | line-chart | `lineChart` from `swiftplot/charts` | 48.3 |
106
+ | all-charts | every chart of `swiftplot/charts` | 67.6 |
107
+ | react-line-chart | `LineChart` from `@swiftplot/react`, React not counted | 50.3 |
108
+ | vue-line-chart | `LineChart` from `@swiftplot/vue`, Vue not counted | 51.0 |
109
+ | element-line | `define` from `swiftplot/element` with `lineChart` | 50.0 |
110
+ | element-all | `swiftplot/element/all`, every chart as `<swift-plot>` | 69.4 |
111
111
 
112
112
  On chart-bench's page, which bundles `plot`, `line`, `area`, `ticks`, `dots`, `tooltip` and `animate`, swiftplot 0.5.0 adds 19.3 KB and uPlot 23.9 KB (`results/bundle.json`: the arm's page less the same page with no chart). uPlot ships more in its size: it is one module that comes whole, with its legend, cursor, selection and series types whether a page uses them or not.
113
113
 
package/dist/bind.d.ts CHANGED
@@ -3,6 +3,7 @@ import { type Component, type Prop } from 'vue';
3
3
  export type Mount<P> = (el: HTMLElement, props: P) => {
4
4
  update(partial: Partial<P>): void;
5
5
  destroy(): void;
6
+ refresh(): void;
6
7
  readonly overlay: HTMLElement;
7
8
  };
8
9
  /** Rendered over the chart, in its overlay, from its layout and what the pointer is over. */
package/dist/bind.js CHANGED
@@ -178,6 +178,7 @@ export function bind(chart, declared) {
178
178
  }
179
179
  return bound ? host.value : null;
180
180
  },
181
+ refresh: () => bound?.refresh(),
181
182
  };
182
183
  for (const k of Object.keys(props))
183
184
  Object.defineProperty(exposed, k, { get: () => props[k], enumerable: true });
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ const base = {
23
23
  selected: null,
24
24
  pointer: null,
25
25
  };
26
- const axes = { xAxis: null, yAxis: null, zoom: flag, view: null };
26
+ const axes = { xAxis: null, yAxis: null, grid: bool, zoom: flag, view: null };
27
27
  const overlays = { rules: null, zones: null, brush: flag };
28
28
  const xy = { ...base, ...axes, ...overlays, x: null, y: null, y2: null, series: null, y2Axis: null };
29
29
  export const LineChart = /*#__PURE__*/ bind(lineChart, () => ({
@@ -46,6 +46,8 @@ export const BarChart = /*#__PURE__*/ bind(barChart, () => ({
46
46
  stack: bool,
47
47
  cumulative: bool,
48
48
  errorBars: null,
49
+ text: { type: [Boolean, Function], default: undefined },
50
+ horizontal: bool,
49
51
  }));
50
52
  export const ScatterChart = /*#__PURE__*/ bind(scatterChart, () => ({
51
53
  ...xy,
@@ -94,6 +96,7 @@ export const HeatmapChart = /*#__PURE__*/ bind(heatmapChart, () => ({
94
96
  color: null,
95
97
  xAxis: null,
96
98
  yAxis: null,
99
+ grid: bool,
97
100
  }));
98
101
  export const HistogramChart = /*#__PURE__*/ bind(histogramChart, () => ({
99
102
  ...base,
@@ -109,6 +112,7 @@ export const BoxPlotChart = /*#__PURE__*/ bind(boxPlotChart, () => ({
109
112
  fill: null,
110
113
  xAxis: null,
111
114
  yAxis: null,
115
+ grid: bool,
112
116
  }));
113
117
  export const CandlestickChart = /*#__PURE__*/ bind(candlestickChart, () => ({
114
118
  ...base,
@@ -159,6 +163,8 @@ export const Plot = /*#__PURE__*/ bind(mount, () => ({
159
163
  x: null,
160
164
  y: null,
161
165
  y2: null,
166
+ grid: bool,
167
+ valueAxis: null,
162
168
  frame: null,
163
169
  marks: null,
164
170
  use: null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swiftplot/vue",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Vue components for swiftplot charts",
5
5
  "keywords": [
6
6
  "chart",
@@ -38,7 +38,7 @@
38
38
  ],
39
39
  "peerDependencies": {
40
40
  "vue": "^3.4",
41
- "swiftplot": "^0.7.0"
41
+ "swiftplot": "^0.8.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/node": "^24.19.2",
@@ -50,7 +50,7 @@
50
50
  "vitest": "^5.1.1",
51
51
  "vue": "^3.5.46",
52
52
  "vue-tsc": "^3.3.14",
53
- "swiftplot": "0.7.0"
53
+ "swiftplot": "0.8.0"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "tsc -p tsconfig.build.json",