@wick-charts/vue 0.6.3 → 0.7.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.
Files changed (67) hide show
  1. package/README.md +6 -6
  2. package/dist/BandSeries.vue.js +52 -0
  3. package/dist/BandSeries.vue2.js +4 -0
  4. package/dist/BarSeries.vue.js +15 -13
  5. package/dist/CandlestickSeries.vue.js +31 -29
  6. package/dist/ChartContainer.vue.js +75 -68
  7. package/dist/LineSeries.vue.js +19 -17
  8. package/dist/composables.js +46 -36
  9. package/dist/core/dist/animation/config.js +92 -75
  10. package/dist/core/dist/animation/viewport-engine.js +155 -96
  11. package/dist/core/dist/axis/dom-labels.js +56 -51
  12. package/dist/core/dist/chart/badge-animator.js +30 -22
  13. package/dist/core/dist/chart/edge-indicators.js +22 -21
  14. package/dist/core/dist/chart/last-value.js +33 -26
  15. package/dist/core/dist/chart/scale-guards.js +23 -5
  16. package/dist/core/dist/chart/x-guards.js +37 -0
  17. package/dist/core/dist/chart.js +1286 -842
  18. package/dist/core/dist/data/decimation.js +58 -39
  19. package/dist/core/dist/data/sync.js +37 -31
  20. package/dist/core/dist/navigator/controller.js +41 -41
  21. package/dist/core/dist/perf/perf-hud.js +3 -3
  22. package/dist/core/dist/scales/tick-tracker.js +2 -2
  23. package/dist/core/dist/scales/x-scale.js +167 -53
  24. package/dist/core/dist/scales/y-scale.js +36 -34
  25. package/dist/core/dist/series/band.js +723 -0
  26. package/dist/core/dist/series/bar.js +297 -291
  27. package/dist/core/dist/series/base-multi-layer.js +283 -237
  28. package/dist/core/dist/series/candlestick.js +32 -31
  29. package/dist/core/dist/series/heatmap.js +5 -5
  30. package/dist/core/dist/series/line-intro.js +47 -37
  31. package/dist/core/dist/series/line.js +489 -448
  32. package/dist/core/dist/series/painters/builtins.js +4 -4
  33. package/dist/core/dist/series/painters/canvas-path.js +64 -52
  34. package/dist/core/dist/series/register-builtins.js +9 -8
  35. package/dist/core/dist/snapshots.js +59 -46
  36. package/dist/core/dist/utils/point.js +10 -0
  37. package/dist/index.d.ts +552 -129
  38. package/dist/index.js +195 -191
  39. package/dist/ui/Crosshair.vue.js +51 -27
  40. package/dist/ui/InfoBar.vue.js +98 -79
  41. package/dist/ui/Marker.vue.js +14 -11
  42. package/dist/ui/Navigator.vue.js +23 -23
  43. package/dist/ui/ReferenceLine.vue.js +19 -16
  44. package/dist/ui/Tooltip.vue.js +116 -84
  45. package/dist/ui/XAxis.vue.js +48 -0
  46. package/dist/ui/XAxis.vue2.js +4 -0
  47. package/dist/ui/YAxis.vue.js +44 -28
  48. package/dist/ui/YLabel.vue.js +82 -85
  49. package/package.json +2 -2
  50. package/src/BandSeries.vue +92 -0
  51. package/src/BarSeries.vue +13 -6
  52. package/src/CandlestickSeries.vue +9 -5
  53. package/src/ChartContainer.vue +20 -0
  54. package/src/LineSeries.vue +13 -6
  55. package/src/composables.ts +23 -4
  56. package/src/index.ts +16 -1
  57. package/src/ui/Crosshair.vue +41 -1
  58. package/src/ui/InfoBar.vue +22 -2
  59. package/src/ui/Marker.vue +5 -1
  60. package/src/ui/Navigator.vue +2 -1
  61. package/src/ui/ReferenceLine.vue +5 -1
  62. package/src/ui/Tooltip.vue +43 -6
  63. package/src/ui/{TimeAxis.vue → XAxis.vue} +18 -5
  64. package/src/ui/YAxis.vue +66 -12
  65. package/src/ui/YLabel.vue +37 -18
  66. package/dist/ui/TimeAxis.vue.js +0 -44
  67. package/dist/ui/TimeAxis.vue2.js +0 -4
@@ -1,32 +1,39 @@
1
- import { isTimeSeriesRenderer as c } from "../series/types.js";
2
- const a = (e) => "close" in e ? e.close : e.value;
3
- function d(e, s, i) {
4
- const t = s.find((f) => f.id === e);
1
+ import { isTimeSeriesRenderer as d } from "../series/types.js";
2
+ import { isBandPoint as g, pointValue as m } from "../utils/point.js";
3
+ function o(n) {
4
+ return g(n) ? null : m(n);
5
+ }
6
+ function L(n, i, u) {
7
+ const t = i.find((l) => l.id === n);
5
8
  if (!t) return null;
6
- const n = t.renderer;
7
- if (!c(n)) return null;
8
- const r = n.getLastDataPoint();
9
- if (!r) return null;
10
- const { from: u, to: o } = i;
11
- if (r.time >= u && r.time <= o)
12
- return { value: a(r), isLive: !0 };
13
- const l = n.getVisibleDataPoints(u, o);
14
- return l.length === 0 ? null : { value: a(l[l.length - 1]), isLive: !1 };
9
+ const r = t.renderer;
10
+ if (!d(r)) return null;
11
+ const e = r.getLastDataPoint();
12
+ if (!e) return null;
13
+ const { from: a, to: c } = u;
14
+ if (e.time >= a && e.time <= c) {
15
+ const l = o(e);
16
+ return l === null ? null : { value: l, isLive: !0 };
17
+ }
18
+ const s = r.getVisibleDataPoints(a, c);
19
+ if (s.length === 0) return null;
20
+ const f = o(s[s.length - 1]);
21
+ return f === null ? null : { value: f, isLive: !1 };
15
22
  }
16
- function v(e, s, i) {
17
- const t = s.find((r) => r.id === e);
18
- return t ? t.renderer.getStackedLastValue?.() || d(e, s, i) : null;
23
+ function p(n, i, u) {
24
+ const t = i.find((e) => e.id === n);
25
+ return t ? t.renderer.getStackedLastValue?.() || L(n, i, u) : null;
19
26
  }
20
- function L(e, s) {
21
- const i = s.find((r) => r.id === e);
22
- if (!i) return null;
23
- const t = i.renderer;
24
- if (!c(t)) return null;
25
- const n = t.getSecondLastDataPoint();
26
- return n ? "close" in n ? n.close : n.value : null;
27
+ function V(n, i) {
28
+ const u = i.find((e) => e.id === n);
29
+ if (!u) return null;
30
+ const t = u.renderer;
31
+ if (!d(t)) return null;
32
+ const r = t.getSecondLastDataPoint();
33
+ return r ? o(r) : null;
27
34
  }
28
35
  export {
29
- d as getLastValue,
30
- L as getPreviousClose,
31
- v as getStackedLastValue
36
+ L as getLastValue,
37
+ V as getPreviousClose,
38
+ p as getStackedLastValue
32
39
  };
@@ -1,4 +1,4 @@
1
- function o(a) {
1
+ function c(a) {
2
2
  if (!(a.stacking !== "percent" || a.isPlottable(0)))
3
3
  throw new Error(
4
4
  `[wick-charts] Series '${a.seriesId}' uses stacking: 'percent', which this Y scale can't show — a 0–100% axis starts at 0, and the scale has no position for 0. Use a linear axis, or stacking: 'normal' / 'off'.`
@@ -6,11 +6,11 @@ function o(a) {
6
6
  }
7
7
  function i(a) {
8
8
  if (process.env.NODE_ENV === "production") return;
9
- const { y: n, isPlottable: t } = a;
9
+ const { y: n, isPlottable: o, path: t = "axis.y" } = a;
10
10
  for (const e of ["min", "max"]) {
11
11
  const s = n?.[e];
12
- typeof s != "number" || t(s) || console.warn(
13
- `[wick-charts] axis.y.${e} is ${s}, which the Y scale can't place — falling back to 'auto'. Use a bound inside the scale's domain.`
12
+ typeof s != "number" || o(s) || console.warn(
13
+ `[wick-charts] ${t}.${e} is ${s}, which the Y scale can't place — falling back to 'auto'. Use a bound inside the scale's domain.`
14
14
  );
15
15
  }
16
16
  }
@@ -19,8 +19,26 @@ function r(a) {
19
19
  `[wick-charts] Series '${a.seriesId}' has values in view the Y scale can't place (e.g. ${a.value}; a log axis has no position for values ≤ 0). They are skipped — gaps in a line, no bar or candle. Filter or offset the data, or use a linear axis.`
20
20
  );
21
21
  }
22
+ function l(a) {
23
+ process.env.NODE_ENV !== "production" && console.warn(
24
+ `[wick-charts] Series '${a.seriesId}' uses scale '${a.scaleId}', which \`scales\` doesn't define — it maps through the default Y scale.`
25
+ );
26
+ }
27
+ function h(a) {
28
+ process.env.NODE_ENV !== "production" && console.warn(
29
+ `[wick-charts] Scale '${a.scaleId}' asks for the ${a.side} axis column, which another Y axis already holds — it renders as an overlay scale with no column. One axis column fits on each side.`
30
+ );
31
+ }
32
+ function u(a) {
33
+ process.env.NODE_ENV !== "production" && console.warn(
34
+ `[wick-charts] Series '${a.seriesId}' uses stacking: 'percent' on a Y scale that can't place 0 — a 0–100% axis starts at 0. Put it on a linear scale, or use stacking: 'normal' / 'off'.`
35
+ );
36
+ }
22
37
  export {
23
- o as assertStackingFitsScale,
38
+ c as assertStackingFitsScale,
39
+ h as warnScaleSideTaken,
40
+ u as warnStackingOffScale,
41
+ l as warnUnknownScale,
24
42
  i as warnUnplottableBounds,
25
43
  r as warnUnplottableValues
26
44
  };
@@ -0,0 +1,37 @@
1
+ function a(e) {
2
+ const { seriesType: s, axisType: t, supported: i } = e;
3
+ if (i.includes(t)) return;
4
+ const n = i.map((r) => `'${r}'`).join(", ");
5
+ throw new Error(
6
+ `[wick-charts] A '${s}' series can't plot on a '${t}' X axis — it supports ${n}. Set axis.x.type to a supported type, or declare \`xTypes\` on a custom series definition.`
7
+ );
8
+ }
9
+ function o(e) {
10
+ if (process.env.NODE_ENV === "production") return;
11
+ const s = e.axisType === "category" ? "a string `x` (the category name)" : "a number `x`";
12
+ console.warn(
13
+ `[wick-charts] Series '${e.seriesId}' has a point with x = ${String(e.x)}, which doesn't fit the '${e.axisType}' X axis — it needs ${s}. Such points are skipped.`
14
+ );
15
+ }
16
+ function c(e) {
17
+ process.env.NODE_ENV !== "production" && console.warn(
18
+ `[wick-charts] Series '${e.seriesId}' mixes \`x\` and \`time\` keys. On a numeric or category X axis key every point by \`x\`.`
19
+ );
20
+ }
21
+ function p(e) {
22
+ process.env.NODE_ENV !== "production" && console.warn(
23
+ `[wick-charts] ${e.feature} works on a time X axis only — it is disabled on this '${e.axisType}' axis.`
24
+ );
25
+ }
26
+ function x(e) {
27
+ process.env.NODE_ENV !== "production" && console.warn(
28
+ `[wick-charts] axis.x.type changed from '${e.from}' to '${e.to}' after the chart was created — the change is ignored. Remount the chart (e.g. a React \`key\`) to switch the X axis type.`
29
+ );
30
+ }
31
+ export {
32
+ a as assertSeriesFitsXAxis,
33
+ p as warnTimeOnlyFeature,
34
+ o as warnXMisfit,
35
+ c as warnXTimeMixed,
36
+ x as warnXTypeChange
37
+ };