@wick-charts/vue 0.5.1 → 0.6.1

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 (82) hide show
  1. package/README.md +45 -6
  2. package/dist/BarSeries.vue.js +26 -20
  3. package/dist/CandlestickSeries.vue.js +30 -24
  4. package/dist/ChartContainer.vue.js +125 -72
  5. package/dist/HeatmapSeries.vue.js +40 -0
  6. package/dist/HeatmapSeries.vue2.js +4 -0
  7. package/dist/LineSeries.vue.js +26 -20
  8. package/dist/PieSeries.vue.js +24 -18
  9. package/dist/core/dist/animation/animator.js +21 -21
  10. package/dist/core/dist/animation/config.js +114 -87
  11. package/dist/core/dist/animation/easing.js +3 -1
  12. package/dist/core/dist/animation/intro-wave.js +68 -0
  13. package/dist/core/dist/axis/dom-labels.js +13 -14
  14. package/dist/core/dist/chart/badge-animator.js +56 -0
  15. package/dist/core/dist/chart/edge-indicators.js +28 -13
  16. package/dist/core/dist/chart/last-value.js +18 -17
  17. package/dist/core/dist/chart/options.js +27 -16
  18. package/dist/core/dist/chart/y-target.js +13 -12
  19. package/dist/core/dist/chart.js +868 -441
  20. package/dist/core/dist/components/annotation-chip.js +28 -0
  21. package/dist/core/dist/components/crosshair.js +8 -6
  22. package/dist/core/dist/components/edge-indicator.js +58 -26
  23. package/dist/core/dist/components/loading-indicator.js +46 -0
  24. package/dist/core/dist/components/marker.js +49 -31
  25. package/dist/core/dist/components/reference-line.js +27 -36
  26. package/dist/core/dist/components/time-region.js +30 -28
  27. package/dist/core/dist/data/store.js +38 -19
  28. package/dist/core/dist/data/sync.js +60 -38
  29. package/dist/core/dist/heatmap-tooltip.js +16 -0
  30. package/dist/core/dist/interactions/handler.js +86 -46
  31. package/dist/core/dist/perf/perf-hud.js +5 -5
  32. package/dist/core/dist/scales/x-scale.js +85 -37
  33. package/dist/core/dist/scales/y-scale.js +38 -27
  34. package/dist/core/dist/series/bar-intro.js +18 -0
  35. package/dist/core/dist/series/bar.js +337 -205
  36. package/dist/core/dist/series/base-multi-layer.js +224 -96
  37. package/dist/core/dist/series/candlestick-intro.js +57 -0
  38. package/dist/core/dist/series/candlestick.js +454 -276
  39. package/dist/core/dist/series/heatmap.js +387 -0
  40. package/dist/core/dist/series/line-intro.js +85 -0
  41. package/dist/core/dist/series/line.js +590 -282
  42. package/dist/core/dist/series/painters/builtins.js +2 -2
  43. package/dist/core/dist/series/pie.js +396 -259
  44. package/dist/core/dist/series/register-builtins.js +8 -7
  45. package/dist/core/dist/series/types.js +6 -0
  46. package/dist/core/dist/series/wave-intro.js +26 -0
  47. package/dist/core/dist/theme/create.js +69 -63
  48. package/dist/core/dist/theme/themes/mint-breeze.js +2 -2
  49. package/dist/core/dist/theme/themes/sand-dune.js +2 -2
  50. package/dist/core/dist/utils/color.js +109 -34
  51. package/dist/core/dist/utils/deep-equal.js +18 -0
  52. package/dist/core/dist/utils/time.js +25 -19
  53. package/dist/index.d.ts +1494 -122
  54. package/dist/index.js +177 -130
  55. package/dist/ui/Crosshair.vue.js +20 -21
  56. package/dist/ui/HeatmapTooltip.vue.js +96 -0
  57. package/dist/ui/HeatmapTooltip.vue2.js +4 -0
  58. package/dist/ui/InfoBar.vue.js +46 -47
  59. package/dist/ui/Legend.vue.js +80 -79
  60. package/dist/ui/PieLegend.vue.js +5 -5
  61. package/dist/ui/PieTooltip.vue.js +77 -67
  62. package/dist/ui/Tooltip.vue.js +60 -60
  63. package/dist/ui/YAxis.vue.js +2 -2
  64. package/dist/ui/YLabel.vue.js +94 -61
  65. package/package.json +2 -2
  66. package/src/BarSeries.vue +23 -7
  67. package/src/CandlestickSeries.vue +23 -7
  68. package/src/ChartContainer.vue +250 -13
  69. package/src/HeatmapSeries.vue +69 -0
  70. package/src/LineSeries.vue +23 -7
  71. package/src/PieSeries.vue +22 -6
  72. package/src/index.ts +84 -3
  73. package/src/ui/Crosshair.vue +1 -2
  74. package/src/ui/HeatmapTooltip.vue +144 -0
  75. package/src/ui/InfoBar.vue +1 -2
  76. package/src/ui/Legend.vue +13 -0
  77. package/src/ui/Marker.vue +1 -1
  78. package/src/ui/PieTooltip.vue +10 -0
  79. package/src/ui/ReferenceLine.vue +2 -2
  80. package/src/ui/TimeRegion.vue +2 -2
  81. package/src/ui/Tooltip.vue +2 -2
  82. package/src/ui/YLabel.vue +123 -8
@@ -1,19 +1,19 @@
1
- import { formatCompact as h } from "../utils/format.js";
2
- import { AxisTickTracker as o } from "./tick-tracker.js";
3
- function u(n) {
4
- if (!Number.isFinite(n) || n <= 0) return 1;
5
- const t = 10 ** Math.floor(Math.log10(n)), i = n / t;
1
+ import { formatCompact as o } from "../utils/format.js";
2
+ import { AxisTickTracker as u } from "./tick-tracker.js";
3
+ function m(e) {
4
+ if (!Number.isFinite(e) || e <= 0) return 1;
5
+ const t = 10 ** Math.floor(Math.log10(e)), i = e / t;
6
6
  return (i <= 1 ? 1 : i <= 2 ? 2 : i <= 5 ? 5 : 10) * t;
7
7
  }
8
- function m(n) {
9
- if (!Number.isFinite(n) || n <= 0) return 1;
10
- const t = 10 ** Math.floor(Math.log10(n)), i = n / t;
8
+ function c(e) {
9
+ if (!Number.isFinite(e) || e <= 0) return 1;
10
+ const t = 10 ** Math.floor(Math.log10(e)), i = e / t;
11
11
  return (i >= 5 ? 5 : i >= 2 ? 2 : 1) * t;
12
12
  }
13
- const c = 50, v = 50;
13
+ const r = 50, v = 50;
14
14
  class M {
15
15
  /** Shared fade state for Y ticks; see {@link TimeScale.tickTracker}. */
16
- tickTracker = new o();
16
+ tickTracker = new u();
17
17
  min = 0;
18
18
  max = 0;
19
19
  height = 1;
@@ -35,6 +35,8 @@ class M {
35
35
  lastRawInterval = null;
36
36
  /** Custom formatter (driven by `<YAxis format=…>`). */
37
37
  customFormat = null;
38
+ /** Custom tick generator — bypasses {1,2,5}×10^k resolution in `niceTickValues` when set. */
39
+ customTickGenerator = null;
38
40
  get labelCountHint() {
39
41
  return this.labelCountHintValue;
40
42
  }
@@ -64,6 +66,14 @@ class M {
64
66
  getFormat() {
65
67
  return this.customFormat;
66
68
  }
69
+ /**
70
+ * Install (or clear) a custom tick-value generator. When set, it replaces
71
+ * {1,2,5}×10^k resolution entirely — `niceTickValues` calls it directly
72
+ * with the current range.
73
+ */
74
+ setTickGenerator(t) {
75
+ this.customTickGenerator = t, this.resetHysteresis();
76
+ }
67
77
  /** Convert a value to a Y position in CSS (media) pixels. */
68
78
  valueToY(t) {
69
79
  const i = this.max - this.min;
@@ -83,10 +93,11 @@ class M {
83
93
  * chart height. Pure read — resolution happens in `update()`.
84
94
  */
85
95
  niceTickValues() {
96
+ if (this.customTickGenerator) return this.customTickGenerator({ min: this.min, max: this.max }).slice(0, r);
86
97
  if (this.resolvedInterval == null) return [];
87
- const t = this.resolvedInterval, i = Math.ceil(this.min / t) * t, a = Math.max(0, Math.min(c, Math.floor((this.max - i) / t) + 1)), e = [];
88
- for (let s = 0; s < a; s++) e.push(i + s * t);
89
- return e;
98
+ const t = this.resolvedInterval, i = Math.ceil(this.min / t) * t, a = Math.max(0, Math.min(r, Math.floor((this.max - i) / t) + 1)), s = [];
99
+ for (let n = 0; n < a; n++) s.push(i + n * t);
100
+ return s;
90
101
  }
91
102
  getRange() {
92
103
  return { min: this.min, max: this.max };
@@ -103,7 +114,7 @@ class M {
103
114
  */
104
115
  formatY(t) {
105
116
  if (this.customFormat) return this.customFormat(t);
106
- if (this.max - this.min >= 1e6) return h(t);
117
+ if (this.max - this.min >= 1e6) return o(t);
107
118
  const i = this.resolvedInterval, a = i != null && i > 0 ? Math.max(0, -Math.floor(Math.log10(i))) : 1;
108
119
  return t.toFixed(a);
109
120
  }
@@ -124,20 +135,20 @@ class M {
124
135
  return;
125
136
  }
126
137
  const t = this.max - this.min, i = t * this.minLabelSpacing / this.height, a = this.labelCountHint != null ? Math.max(1, this.labelCountHint) : Math.max(1, Math.floor(this.height / this.minLabelSpacing));
127
- let e = t / a;
128
- if (e < i && (e = i), this.lastInterval != null && this.lastRawInterval != null) {
129
- const l = e >= this.lastRawInterval * 0.8 && e <= this.lastRawInterval * 1.25, r = this.lastInterval >= i;
130
- if (l && r) {
138
+ let s = t / a;
139
+ if (s < i && (s = i), this.lastInterval != null && this.lastRawInterval != null) {
140
+ const l = s >= this.lastRawInterval * 0.8 && s <= this.lastRawInterval * 1.25, h = this.lastInterval >= i;
141
+ if (l && h) {
131
142
  this.resolvedInterval = this.lastInterval;
132
143
  return;
133
144
  }
134
145
  }
135
- let s = u(e);
136
- if (this.labelCountHint != null && this.countTicks(s) < this.labelCountHint) {
137
- const l = m(e);
138
- l >= i && l > 0 && (s = l);
146
+ let n = m(s);
147
+ if (this.labelCountHint != null && this.countTicks(n) < this.labelCountHint) {
148
+ const l = c(s);
149
+ l >= i && l > 0 && (n = l);
139
150
  }
140
- this.resolvedInterval = s, this.lastInterval = s, this.lastRawInterval = e;
151
+ this.resolvedInterval = n, this.lastInterval = n, this.lastRawInterval = s;
141
152
  }
142
153
  countTicks(t) {
143
154
  if (!(t > 0)) return 0;
@@ -145,11 +156,11 @@ class M {
145
156
  return Math.max(0, Math.floor((this.max - i) / t) + 1);
146
157
  }
147
158
  }
148
- function f(n) {
149
- return typeof n == "number" && Number.isFinite(n) && n >= 2 ? Math.floor(n) : null;
159
+ function f(e) {
160
+ return typeof e == "number" && Number.isFinite(e) && e >= 2 ? Math.floor(e) : null;
150
161
  }
151
- function g(n) {
152
- return typeof n == "number" && Number.isFinite(n) && n > 0 ? n : null;
162
+ function g(e) {
163
+ return typeof e == "number" && Number.isFinite(e) && e > 0 ? e : null;
153
164
  }
154
165
  export {
155
166
  M as YScale
@@ -0,0 +1,18 @@
1
+ import { easeOutBack as a } from "../animation/easing.js";
2
+ function t() {
3
+ return () => ({
4
+ value: ({ value: e, progress: r }) => e * r,
5
+ element: (e) => ({ alpha: e.progress })
6
+ });
7
+ }
8
+ const o = 0.3;
9
+ function n() {
10
+ return () => ({
11
+ value: ({ value: e, progress: r }) => e * a(r),
12
+ element: (e) => ({ alpha: Math.min(1, e.progress / o) })
13
+ });
14
+ }
15
+ export {
16
+ t as growIntro,
17
+ n as springIntro
18
+ };