@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.
- package/README.md +45 -6
- package/dist/BarSeries.vue.js +26 -20
- package/dist/CandlestickSeries.vue.js +30 -24
- package/dist/ChartContainer.vue.js +125 -72
- package/dist/HeatmapSeries.vue.js +40 -0
- package/dist/HeatmapSeries.vue2.js +4 -0
- package/dist/LineSeries.vue.js +26 -20
- package/dist/PieSeries.vue.js +24 -18
- package/dist/core/dist/animation/animator.js +21 -21
- package/dist/core/dist/animation/config.js +114 -87
- package/dist/core/dist/animation/easing.js +3 -1
- package/dist/core/dist/animation/intro-wave.js +68 -0
- package/dist/core/dist/axis/dom-labels.js +13 -14
- package/dist/core/dist/chart/badge-animator.js +56 -0
- package/dist/core/dist/chart/edge-indicators.js +28 -13
- package/dist/core/dist/chart/last-value.js +18 -17
- package/dist/core/dist/chart/options.js +27 -16
- package/dist/core/dist/chart/y-target.js +13 -12
- package/dist/core/dist/chart.js +868 -441
- package/dist/core/dist/components/annotation-chip.js +28 -0
- package/dist/core/dist/components/crosshair.js +8 -6
- package/dist/core/dist/components/edge-indicator.js +58 -26
- package/dist/core/dist/components/loading-indicator.js +46 -0
- package/dist/core/dist/components/marker.js +49 -31
- package/dist/core/dist/components/reference-line.js +27 -36
- package/dist/core/dist/components/time-region.js +30 -28
- package/dist/core/dist/data/store.js +38 -19
- package/dist/core/dist/data/sync.js +60 -38
- package/dist/core/dist/heatmap-tooltip.js +16 -0
- package/dist/core/dist/interactions/handler.js +86 -46
- package/dist/core/dist/perf/perf-hud.js +5 -5
- package/dist/core/dist/scales/x-scale.js +85 -37
- package/dist/core/dist/scales/y-scale.js +38 -27
- package/dist/core/dist/series/bar-intro.js +18 -0
- package/dist/core/dist/series/bar.js +337 -205
- package/dist/core/dist/series/base-multi-layer.js +224 -96
- package/dist/core/dist/series/candlestick-intro.js +57 -0
- package/dist/core/dist/series/candlestick.js +454 -276
- package/dist/core/dist/series/heatmap.js +387 -0
- package/dist/core/dist/series/line-intro.js +85 -0
- package/dist/core/dist/series/line.js +590 -282
- package/dist/core/dist/series/painters/builtins.js +2 -2
- package/dist/core/dist/series/pie.js +396 -259
- package/dist/core/dist/series/register-builtins.js +8 -7
- package/dist/core/dist/series/types.js +6 -0
- package/dist/core/dist/series/wave-intro.js +26 -0
- package/dist/core/dist/theme/create.js +69 -63
- package/dist/core/dist/theme/themes/mint-breeze.js +2 -2
- package/dist/core/dist/theme/themes/sand-dune.js +2 -2
- package/dist/core/dist/utils/color.js +109 -34
- package/dist/core/dist/utils/deep-equal.js +18 -0
- package/dist/core/dist/utils/time.js +25 -19
- package/dist/index.d.ts +1494 -122
- package/dist/index.js +177 -130
- package/dist/ui/Crosshair.vue.js +20 -21
- package/dist/ui/HeatmapTooltip.vue.js +96 -0
- package/dist/ui/HeatmapTooltip.vue2.js +4 -0
- package/dist/ui/InfoBar.vue.js +46 -47
- package/dist/ui/Legend.vue.js +80 -79
- package/dist/ui/PieLegend.vue.js +5 -5
- package/dist/ui/PieTooltip.vue.js +77 -67
- package/dist/ui/Tooltip.vue.js +60 -60
- package/dist/ui/YAxis.vue.js +2 -2
- package/dist/ui/YLabel.vue.js +94 -61
- package/package.json +2 -2
- package/src/BarSeries.vue +23 -7
- package/src/CandlestickSeries.vue +23 -7
- package/src/ChartContainer.vue +250 -13
- package/src/HeatmapSeries.vue +69 -0
- package/src/LineSeries.vue +23 -7
- package/src/PieSeries.vue +22 -6
- package/src/index.ts +84 -3
- package/src/ui/Crosshair.vue +1 -2
- package/src/ui/HeatmapTooltip.vue +144 -0
- package/src/ui/InfoBar.vue +1 -2
- package/src/ui/Legend.vue +13 -0
- package/src/ui/Marker.vue +1 -1
- package/src/ui/PieTooltip.vue +10 -0
- package/src/ui/ReferenceLine.vue +2 -2
- package/src/ui/TimeRegion.vue +2 -2
- package/src/ui/Tooltip.vue +2 -2
- package/src/ui/YLabel.vue +123 -8
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { formatCompact as
|
|
2
|
-
import { AxisTickTracker as
|
|
3
|
-
function
|
|
4
|
-
if (!Number.isFinite(
|
|
5
|
-
const t = 10 ** Math.floor(Math.log10(
|
|
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
|
|
9
|
-
if (!Number.isFinite(
|
|
10
|
-
const t = 10 ** Math.floor(Math.log10(
|
|
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
|
|
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
|
|
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(
|
|
88
|
-
for (let
|
|
89
|
-
return
|
|
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
|
|
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
|
|
128
|
-
if (
|
|
129
|
-
const l =
|
|
130
|
-
if (l &&
|
|
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
|
|
136
|
-
if (this.labelCountHint != null && this.countTicks(
|
|
137
|
-
const l =
|
|
138
|
-
l >= i && l > 0 && (
|
|
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 =
|
|
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(
|
|
149
|
-
return typeof
|
|
159
|
+
function f(e) {
|
|
160
|
+
return typeof e == "number" && Number.isFinite(e) && e >= 2 ? Math.floor(e) : null;
|
|
150
161
|
}
|
|
151
|
-
function g(
|
|
152
|
-
return typeof
|
|
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
|
+
};
|