@wick-charts/vue 0.6.2 → 0.6.3
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/dist/ChartContainer.vue.js +43 -37
- package/dist/LineSeries.vue.js +2 -2
- package/dist/composables.js +39 -26
- package/dist/core/dist/axis/dom-labels.js +56 -43
- package/dist/core/dist/chart/options.js +5 -5
- package/dist/core/dist/chart/scale-guards.js +26 -0
- package/dist/core/dist/chart/y-target.js +46 -19
- package/dist/core/dist/chart.js +670 -519
- package/dist/core/dist/components/crosshair.js +8 -8
- package/dist/core/dist/components/grid.js +26 -17
- package/dist/core/dist/components/marker.js +28 -28
- package/dist/core/dist/components/reference-line.js +16 -16
- package/dist/core/dist/interactions/handler.js +3 -2
- package/dist/core/dist/interactions/zoom.js +6 -5
- package/dist/core/dist/navigator/controller.js +38 -35
- package/dist/core/dist/perf/perf-hud.js +3 -3
- package/dist/core/dist/scales/log-scale.js +76 -0
- package/dist/core/dist/scales/y-scale.js +134 -35
- package/dist/core/dist/series/bar-intro.js +11 -11
- package/dist/core/dist/series/bar.js +301 -251
- package/dist/core/dist/series/base-multi-layer.js +100 -76
- package/dist/core/dist/series/candlestick.js +244 -241
- package/dist/core/dist/series/line-intro.js +18 -18
- package/dist/core/dist/series/line.js +428 -390
- package/dist/core/dist/series/scale-stack.js +25 -0
- package/dist/core/dist/tooltip-position.js +5 -5
- package/dist/index.d.ts +246 -31
- package/dist/index.js +59 -57
- package/dist/ui/Crosshair.vue.js +14 -14
- package/dist/ui/HeatmapTooltip.vue.js +6 -6
- package/dist/ui/PieTooltip.vue.js +4 -4
- package/dist/ui/TimeAxis.vue.js +23 -22
- package/dist/ui/Tooltip.vue.js +71 -69
- package/dist/ui/YAxis.vue.js +25 -24
- package/dist/ui/YLabel.vue.js +48 -48
- package/package.json +2 -2
- package/src/ChartContainer.vue +20 -8
- package/src/composables.ts +35 -1
- package/src/index.ts +5 -0
- package/src/ui/Crosshair.vue +2 -2
- package/src/ui/TimeAxis.vue +7 -4
- package/src/ui/Tooltip.vue +4 -1
- package/src/ui/YAxis.vue +5 -3
- package/src/ui/YLabel.vue +3 -3
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { default as m } from "./ChartContainer.vue.js";
|
|
|
4
4
|
import { useCrosshairPosition as i, useLastYValue as s, usePreviousClose as x, useVisibleRange as n, useYRange as l } from "./composables.js";
|
|
5
5
|
import { useChartInstance as u, useTheme as c } from "./context.js";
|
|
6
6
|
import { default as h } from "./HeatmapSeries.vue.js";
|
|
7
|
-
import { default as
|
|
7
|
+
import { default as S } from "./LineSeries.vue.js";
|
|
8
8
|
import { default as P } from "./PieSeries.vue.js";
|
|
9
9
|
import { default as T } from "./ui/Crosshair.vue.js";
|
|
10
10
|
import { default as k } from "./ui/HeatmapTooltip.vue.js";
|
|
@@ -31,7 +31,7 @@ import { NavigatorController as le } from "./core/dist/navigator/controller.js";
|
|
|
31
31
|
import { PerfMonitor as ue } from "./core/dist/perf/perf-monitor.js";
|
|
32
32
|
import { PieSeriesDef as ge } from "./core/dist/series/pie.js";
|
|
33
33
|
import { XScale as Ce } from "./core/dist/scales/x-scale.js";
|
|
34
|
-
import { YScale as
|
|
34
|
+
import { YScale as Ie } from "./core/dist/scales/y-scale.js";
|
|
35
35
|
import { andromeda as ve } from "./core/dist/theme/themes/andromeda.js";
|
|
36
36
|
import { autoGradient as Le, createTheme as ke, isDarkBg as De } from "./core/dist/theme/create.js";
|
|
37
37
|
import { ayuMirage as Be } from "./core/dist/theme/themes/ayu-mirage.js";
|
|
@@ -49,34 +49,35 @@ import { formatCompact as xr, formatPriceAdaptive as nr } from "./core/dist/util
|
|
|
49
49
|
import { githubLight as dr } from "./core/dist/theme/themes/github-light.js";
|
|
50
50
|
import { growIntro as cr, springIntro as gr } from "./core/dist/series/bar-intro.js";
|
|
51
51
|
import { gruvbox as Cr } from "./core/dist/theme/themes/gruvbox.js";
|
|
52
|
-
import { handwritten as
|
|
52
|
+
import { handwritten as Ir } from "./core/dist/theme/themes/handwritten.js";
|
|
53
53
|
import { hermite as vr } from "./core/dist/animation/y-range-hermite.js";
|
|
54
54
|
import { highContrast as Lr } from "./core/dist/theme/themes/high-contrast.js";
|
|
55
55
|
import { isTimeSeriesRenderer as Dr } from "./core/dist/series/types.js";
|
|
56
56
|
import { lavenderMist as Br } from "./core/dist/theme/themes/lavender-mist.js";
|
|
57
57
|
import { lightPink as Rr } from "./core/dist/theme/themes/light-pink.js";
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
import {
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
58
|
+
import { logScale as Hr } from "./core/dist/scales/log-scale.js";
|
|
59
|
+
import { materialPalenight as Yr } from "./core/dist/theme/themes/material-palenight.js";
|
|
60
|
+
import { minimalLight as Fr } from "./core/dist/theme/themes/minimal-light.js";
|
|
61
|
+
import { mintBreeze as Nr } from "./core/dist/theme/themes/mint-breeze.js";
|
|
62
|
+
import { mixColors as Or, sampleRamp as Vr } from "./core/dist/utils/color.js";
|
|
63
|
+
import { monokaiPro as Er } from "./core/dist/theme/themes/monokai-pro.js";
|
|
64
|
+
import { nightOwl as Ur } from "./core/dist/theme/themes/night-owl.js";
|
|
65
|
+
import { oneDarkPro as Jr } from "./core/dist/theme/themes/one-dark-pro.js";
|
|
66
|
+
import { panda as Qr } from "./core/dist/theme/themes/panda.js";
|
|
67
|
+
import { parseAnimationTime as Zr } from "./core/dist/animation/time.js";
|
|
68
|
+
import { peachCream as $r } from "./core/dist/theme/themes/peach-cream.js";
|
|
69
|
+
import { perfHud as ro } from "./core/dist/perf/perf-hud.js";
|
|
70
|
+
import { quietLight as to } from "./core/dist/theme/themes/quiet-light.js";
|
|
71
|
+
import { registerBuiltinSeries as fo } from "./core/dist/series/register-builtins.js";
|
|
72
|
+
import { registerSeriesDefinition as po } from "./core/dist/series/definition.js";
|
|
73
|
+
import { resolveAxisFontSize as so, resolveAxisTextColor as xo, resolveCandlestickBodyColor as no } from "./core/dist/theme/resolve.js";
|
|
74
|
+
import { rosePineDawn as uo } from "./core/dist/theme/themes/rose-pine-dawn.js";
|
|
75
|
+
import { roundedBarFill as go, roundedCandleFill as ho, smoothCurve as Co, steppedCurve as So, straightCurve as Io } from "./core/dist/series/painters/builtins.js";
|
|
76
|
+
import { sandDune as vo } from "./core/dist/theme/themes/sand-dune.js";
|
|
77
|
+
import { skeletonLoadingIndicator as Lo } from "./core/dist/components/loading-indicator.js";
|
|
78
|
+
import { snap as Do } from "./core/dist/animation/y-range-snap.js";
|
|
79
|
+
import { solarizedLight as Bo } from "./core/dist/theme/themes/solarized-light.js";
|
|
80
|
+
import { spring as Ro } from "./core/dist/animation/spring.js";
|
|
80
81
|
export {
|
|
81
82
|
o as BarSeries,
|
|
82
83
|
oe as BarSeriesDef,
|
|
@@ -90,7 +91,7 @@ export {
|
|
|
90
91
|
k as HeatmapTooltip,
|
|
91
92
|
w as InfoBar,
|
|
92
93
|
b as Legend,
|
|
93
|
-
|
|
94
|
+
S as LineSeries,
|
|
94
95
|
xe as LineSeriesDef,
|
|
95
96
|
A as Marker,
|
|
96
97
|
M as Navigator,
|
|
@@ -110,7 +111,7 @@ export {
|
|
|
110
111
|
Ce as XScale,
|
|
111
112
|
_ as YAxis,
|
|
112
113
|
ee as YLabel,
|
|
113
|
-
|
|
114
|
+
Ie as YScale,
|
|
114
115
|
ve as andromeda,
|
|
115
116
|
Le as autoGradient,
|
|
116
117
|
Be as ayuMirage,
|
|
@@ -134,47 +135,48 @@ export {
|
|
|
134
135
|
dr as githubLight,
|
|
135
136
|
cr as growIntro,
|
|
136
137
|
Cr as gruvbox,
|
|
137
|
-
|
|
138
|
+
Ir as handwritten,
|
|
138
139
|
vr as hermite,
|
|
139
140
|
Lr as highContrast,
|
|
140
141
|
De as isDarkBg,
|
|
141
142
|
Dr as isTimeSeriesRenderer,
|
|
142
143
|
Br as lavenderMist,
|
|
143
144
|
Rr as lightPink,
|
|
144
|
-
Hr as
|
|
145
|
-
Yr as
|
|
146
|
-
Fr as
|
|
147
|
-
Nr as
|
|
148
|
-
|
|
149
|
-
Er as
|
|
145
|
+
Hr as logScale,
|
|
146
|
+
Yr as materialPalenight,
|
|
147
|
+
Fr as minimalLight,
|
|
148
|
+
Nr as mintBreeze,
|
|
149
|
+
Or as mixColors,
|
|
150
|
+
Er as monokaiPro,
|
|
151
|
+
Ur as nightOwl,
|
|
150
152
|
$e as normalizeTime,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
153
|
+
Jr as oneDarkPro,
|
|
154
|
+
Qr as panda,
|
|
155
|
+
Zr as parseAnimationTime,
|
|
156
|
+
$r as peachCream,
|
|
157
|
+
ro as perfHud,
|
|
156
158
|
He as plotterIntro,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
159
|
+
to as quietLight,
|
|
160
|
+
fo as registerBuiltinSeries,
|
|
161
|
+
po as registerSeriesDefinition,
|
|
162
|
+
so as resolveAxisFontSize,
|
|
163
|
+
xo as resolveAxisTextColor,
|
|
164
|
+
no as resolveCandlestickBodyColor,
|
|
163
165
|
ar as riseIntro,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
uo as rosePineDawn,
|
|
167
|
+
go as roundedBarFill,
|
|
168
|
+
ho as roundedCandleFill,
|
|
169
|
+
Vr as sampleRamp,
|
|
170
|
+
vo as sandDune,
|
|
171
|
+
Lo as skeletonLoadingIndicator,
|
|
170
172
|
Ve as skeletonMorphIntro,
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
Co as smoothCurve,
|
|
174
|
+
Do as snap,
|
|
175
|
+
Bo as solarizedLight,
|
|
176
|
+
Ro as spring,
|
|
175
177
|
gr as springIntro,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
+
So as steppedCurve,
|
|
179
|
+
Io as straightCurve,
|
|
178
180
|
Me as sweepIntro,
|
|
179
181
|
Ye as traceIntro,
|
|
180
182
|
ir as tracePath,
|
package/dist/ui/Crosshair.vue.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { defineComponent as v, ref as d, onMounted as f, onUnmounted as
|
|
1
|
+
import { defineComponent as v, ref as d, onMounted as f, onUnmounted as y, computed as n, unref as t, openBlock as h, createElementBlock as x, Fragment as g, createElementVNode as c, normalizeStyle as m, toDisplayString as u, createCommentVNode as b } from "vue";
|
|
2
2
|
import { useCrosshairPosition as C } from "../composables.js";
|
|
3
3
|
import { useChartInstance as S } from "../context.js";
|
|
4
4
|
const E = /* @__PURE__ */ v({
|
|
5
5
|
__name: "Crosshair",
|
|
6
6
|
setup(k) {
|
|
7
|
-
const e = S(),
|
|
7
|
+
const e = S(), o = C(e), r = d(0), l = () => {
|
|
8
8
|
r.value++;
|
|
9
9
|
};
|
|
10
|
-
f(() => e.on("overlayChange", l)),
|
|
11
|
-
const
|
|
10
|
+
f(() => e.on("overlayChange", l)), y(() => e.off("overlayChange", l));
|
|
11
|
+
const a = n(() => (r.value, e.getTheme())), i = n(() => e.getDataInterval()), p = n(() => (o.value, e.timeScale.niceTickValues(i.value).tickInterval || i.value)), s = n(() => ({
|
|
12
12
|
// Blend the theme's labelBackground at 80% opacity so the axis grid
|
|
13
13
|
// shows through — keeps the badge from looking like an opaque block
|
|
14
14
|
// while still masking whatever tick sits underneath.
|
|
15
|
-
background: `color-mix(in srgb, ${
|
|
16
|
-
color:
|
|
17
|
-
fontSize:
|
|
18
|
-
fontFamily:
|
|
15
|
+
background: `color-mix(in srgb, ${a.value.crosshair.labelBackground} 80%, transparent)`,
|
|
16
|
+
color: a.value.crosshair.labelTextColor,
|
|
17
|
+
fontSize: a.value.axis.fontSize + "px",
|
|
18
|
+
fontFamily: a.value.typography.fontFamily,
|
|
19
19
|
fontVariantNumeric: "tabular-nums",
|
|
20
20
|
padding: "2px 6px",
|
|
21
21
|
borderRadius: "2px",
|
|
@@ -25,25 +25,25 @@ const E = /* @__PURE__ */ v({
|
|
|
25
25
|
// live last-value stays visible when the crosshair crosses its row.
|
|
26
26
|
zIndex: 2
|
|
27
27
|
}));
|
|
28
|
-
return (_, I) => t(
|
|
28
|
+
return (_, I) => t(o) ? (h(), x(g, { key: 0 }, [
|
|
29
29
|
c("div", {
|
|
30
30
|
style: m({
|
|
31
31
|
position: "absolute",
|
|
32
|
-
|
|
33
|
-
top: t(
|
|
32
|
+
[t(e).yAxisPosition]: "0",
|
|
33
|
+
top: t(o).mediaY + "px",
|
|
34
34
|
transform: "translateY(-50%)",
|
|
35
35
|
...s.value
|
|
36
36
|
})
|
|
37
|
-
}, u(t(e).yScale.formatY(t(
|
|
37
|
+
}, u(t(e).yScale.formatY(t(o).y)), 5),
|
|
38
38
|
c("div", {
|
|
39
39
|
style: m({
|
|
40
40
|
position: "absolute",
|
|
41
41
|
bottom: "0",
|
|
42
|
-
left: t(
|
|
42
|
+
left: t(o).mediaX + "px",
|
|
43
43
|
transform: "translateX(-50%)",
|
|
44
44
|
...s.value
|
|
45
45
|
})
|
|
46
|
-
}, u(t(e).timeScale.formatX(t(
|
|
46
|
+
}, u(t(e).timeScale.formatX(t(o).time, p.value)), 5)
|
|
47
47
|
], 64)) : b("", !0);
|
|
48
48
|
}
|
|
49
49
|
});
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { defineComponent as x, computed as a, ref as g, onMounted as b, onUnmounted as y, unref as _, openBlock as k, createElementBlock as I, normalizeStyle as n, createElementVNode as r, toDisplayString as v, createCommentVNode as H } from "vue";
|
|
2
2
|
import { defaultHeatmapFormat as T, resolveHeatmapSeriesId as C, HEATMAP_TOOLTIP_WIDTH as S, HEATMAP_TOOLTIP_HEIGHT as W } from "../core/dist/heatmap-tooltip.js";
|
|
3
3
|
import { computeTooltipPosition as F } from "../core/dist/tooltip-position.js";
|
|
4
|
-
import { useCrosshairPosition as
|
|
5
|
-
import { useChartInstance as
|
|
6
|
-
const
|
|
4
|
+
import { useCrosshairPosition as M } from "../composables.js";
|
|
5
|
+
import { useChartInstance as P } from "../context.js";
|
|
6
|
+
const z = { style: { display: "flex", alignItems: "center", gap: "8px" } }, E = { style: { fontWeight: 600 } }, w = { style: { marginLeft: "auto", fontWeight: 600 } }, N = /* @__PURE__ */ x({
|
|
7
7
|
__name: "HeatmapTooltip",
|
|
8
8
|
props: {
|
|
9
9
|
seriesId: {},
|
|
10
10
|
format: { type: Function }
|
|
11
11
|
},
|
|
12
12
|
setup(m) {
|
|
13
|
-
const u = m, f = a(() => u.format ?? T), t =
|
|
13
|
+
const u = m, f = a(() => u.format ?? T), t = P(), l = M(t), i = g(0), d = () => {
|
|
14
14
|
i.value++;
|
|
15
15
|
};
|
|
16
16
|
b(() => {
|
|
@@ -56,7 +56,7 @@ const E = { style: { display: "flex", alignItems: "center", gap: "8px" } }, M =
|
|
|
56
56
|
minWidth: "120px"
|
|
57
57
|
})
|
|
58
58
|
}, [
|
|
59
|
-
r("div",
|
|
59
|
+
r("div", z, [
|
|
60
60
|
r("span", {
|
|
61
61
|
style: n({
|
|
62
62
|
width: "10px",
|
|
@@ -66,7 +66,7 @@ const E = { style: { display: "flex", alignItems: "center", gap: "8px" } }, M =
|
|
|
66
66
|
flexShrink: 0
|
|
67
67
|
})
|
|
68
68
|
}, null, 4),
|
|
69
|
-
r("span",
|
|
69
|
+
r("span", E, v(e.value.label), 1),
|
|
70
70
|
r("span", w, v(f.value(e.value.value)), 1)
|
|
71
71
|
]),
|
|
72
72
|
r("div", {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineComponent as H, computed as a, useSlots as R, ref as x, onMounted as O, onUnmounted as P, watchEffect as B, openBlock as m, createElementBlock as g, Fragment as D, unref as b, normalizeStyle as y, createElementVNode as s, toDisplayString as _, createCommentVNode as I, renderSlot as L } from "vue";
|
|
2
2
|
import { computeTooltipPosition as C } from "../core/dist/tooltip-position.js";
|
|
3
|
-
import { formatCompact as
|
|
4
|
-
import { useCrosshairPosition as
|
|
5
|
-
import { useChartInstance as
|
|
3
|
+
import { formatCompact as M } from "../core/dist/utils/format.js";
|
|
4
|
+
import { useCrosshairPosition as X } from "../composables.js";
|
|
5
|
+
import { useChartInstance as Y } from "../context.js";
|
|
6
6
|
const U = { style: { display: "flex", alignItems: "center", gap: "8px" } }, A = { style: { fontWeight: 600 } }, N = { style: { display: "flex", justifyContent: "space-between", gap: "16px" } }, V = { style: { opacity: 0.6 } }, j = { style: { fontWeight: 600 } }, G = ["data-measured"], $ = 160, q = 70, te = /* @__PURE__ */ H({
|
|
7
7
|
__name: "PieTooltip",
|
|
8
8
|
props: {
|
|
@@ -10,7 +10,7 @@ const U = { style: { display: "flex", alignItems: "center", gap: "8px" } }, A =
|
|
|
10
10
|
format: { type: Function }
|
|
11
11
|
},
|
|
12
12
|
setup(T) {
|
|
13
|
-
const S = T, k = a(() => S.format ??
|
|
13
|
+
const S = T, k = a(() => S.format ?? M), i = Y(), l = X(i), W = R(), d = a(() => typeof W.default == "function"), c = x(0), w = () => {
|
|
14
14
|
c.value++;
|
|
15
15
|
};
|
|
16
16
|
O(() => {
|
package/dist/ui/TimeAxis.vue.js
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { mountAxisLabels as
|
|
1
|
+
import { defineComponent as c, computed as p, ref as m, watch as f, onUnmounted as u, onMounted as x, openBlock as b, createElementBlock as y, normalizeStyle as h, unref as o } from "vue";
|
|
2
|
+
import { mountAxisLabels as L } from "../core/dist/axis/dom-labels.js";
|
|
3
|
+
import { useAxisLayout as d } from "../composables.js";
|
|
3
4
|
import { useChartInstance as g } from "../context.js";
|
|
4
|
-
const
|
|
5
|
+
const D = /* @__PURE__ */ c({
|
|
5
6
|
__name: "TimeAxis",
|
|
6
7
|
props: {
|
|
7
8
|
labelCount: {},
|
|
8
9
|
minLabelSpacing: {}
|
|
9
10
|
},
|
|
10
|
-
setup(
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
labelCount:
|
|
14
|
-
minLabelSpacing:
|
|
11
|
+
setup(r) {
|
|
12
|
+
const e = r, n = g(), t = d(n), a = p(() => t.value.yAxisPosition === "left"), l = m(null), s = () => {
|
|
13
|
+
n.setTimeAxisLabelDensity({
|
|
14
|
+
labelCount: e.labelCount ?? null,
|
|
15
|
+
minLabelSpacing: e.minLabelSpacing ?? null
|
|
15
16
|
});
|
|
16
17
|
};
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
s(), f(() => [e.labelCount, e.minLabelSpacing], s), u(() => {
|
|
19
|
+
n.setTimeAxisLabelDensity({ labelCount: null, minLabelSpacing: null });
|
|
19
20
|
});
|
|
20
|
-
let
|
|
21
|
-
return
|
|
22
|
-
|
|
23
|
-
}),
|
|
24
|
-
|
|
25
|
-
}), (
|
|
21
|
+
let i = null;
|
|
22
|
+
return x(() => {
|
|
23
|
+
l.value !== null && (i = L({ chart: n, container: l.value, axis: "x" }));
|
|
24
|
+
}), u(() => {
|
|
25
|
+
i?.(), i = null;
|
|
26
|
+
}), (A, v) => (b(), y("div", {
|
|
26
27
|
ref_key: "containerRef",
|
|
27
|
-
ref:
|
|
28
|
-
style:
|
|
28
|
+
ref: l,
|
|
29
|
+
style: h({
|
|
29
30
|
position: "absolute",
|
|
30
|
-
left:
|
|
31
|
+
left: (a.value ? o(t).yAxisWidth : 0) + "px",
|
|
31
32
|
bottom: "0",
|
|
32
|
-
right: o(
|
|
33
|
-
height: o(
|
|
33
|
+
right: (a.value ? 0 : o(t).yAxisWidth) + "px",
|
|
34
|
+
height: o(t).xAxisHeight + "px",
|
|
34
35
|
pointerEvents: "none",
|
|
35
36
|
display: "flex",
|
|
36
37
|
alignItems: "center"
|
|
@@ -39,5 +40,5 @@ const _ = /* @__PURE__ */ r({
|
|
|
39
40
|
}
|
|
40
41
|
});
|
|
41
42
|
export {
|
|
42
|
-
|
|
43
|
+
D as default
|
|
43
44
|
};
|
package/dist/ui/Tooltip.vue.js
CHANGED
|
@@ -1,98 +1,100 @@
|
|
|
1
|
-
import { defineComponent as P, computed as s, ref as w, onMounted as D, onUnmounted as
|
|
2
|
-
import { buildHoverSnapshots as
|
|
3
|
-
import { resolveCandlestickBodyColor as
|
|
1
|
+
import { defineComponent as P, computed as s, ref as w, onMounted as D, onUnmounted as X, useSlots as Y, watchEffect as Z, openBlock as r, createElementBlock as u, Fragment as x, unref as p, normalizeStyle as m, createElementVNode as d, toDisplayString as f, renderList as H, createCommentVNode as _, renderSlot as $ } from "vue";
|
|
2
|
+
import { buildHoverSnapshots as K } from "../core/dist/snapshots.js";
|
|
3
|
+
import { resolveCandlestickBodyColor as U } from "../core/dist/theme/resolve.js";
|
|
4
4
|
import { computeTooltipPosition as R } from "../core/dist/tooltip-position.js";
|
|
5
|
-
import { formatCompact as
|
|
6
|
-
import { formatDate as
|
|
7
|
-
import { useCrosshairPosition as
|
|
8
|
-
import { useChartInstance as
|
|
9
|
-
const
|
|
5
|
+
import { formatCompact as j, formatPriceAdaptive as q } from "../core/dist/utils/format.js";
|
|
6
|
+
import { formatDate as G } from "../core/dist/utils/time.js";
|
|
7
|
+
import { useCrosshairPosition as J } from "../composables.js";
|
|
8
|
+
import { useChartInstance as Q } from "../context.js";
|
|
9
|
+
const ee = {
|
|
10
10
|
key: 0,
|
|
11
11
|
style: { display: "grid", gridTemplateColumns: "auto 1fr", gap: "4px 12px" }
|
|
12
|
-
},
|
|
12
|
+
}, te = { style: { opacity: 0.5 } }, oe = {
|
|
13
13
|
key: 1,
|
|
14
14
|
style: { display: "flex", alignItems: "center", gap: "8px", padding: "2px 0" }
|
|
15
|
-
},
|
|
15
|
+
}, le = { style: { opacity: 0.6, flex: "1" } }, ae = ["data-measured"], ve = /* @__PURE__ */ P({
|
|
16
16
|
__name: "Tooltip",
|
|
17
17
|
props: {
|
|
18
18
|
sort: {},
|
|
19
19
|
format: { type: Function }
|
|
20
20
|
},
|
|
21
21
|
setup(I) {
|
|
22
|
-
const F = I,
|
|
23
|
-
() => F.format ?? ((a,
|
|
24
|
-
),
|
|
22
|
+
const F = I, L = s(() => F.sort ?? "none"), k = s(
|
|
23
|
+
() => F.format ?? ((a, i) => i === "volume" ? j(a) : q(a))
|
|
24
|
+
), t = Q(), n = J(t), C = w(0), W = () => {
|
|
25
25
|
C.value++;
|
|
26
26
|
};
|
|
27
27
|
D(() => {
|
|
28
|
-
|
|
29
|
-
}),
|
|
30
|
-
|
|
28
|
+
t.on("overlayChange", W), t.getSeriesIds().length > 0 && C.value++;
|
|
29
|
+
}), X(() => {
|
|
30
|
+
t.off("overlayChange", W);
|
|
31
31
|
});
|
|
32
|
-
const
|
|
33
|
-
time:
|
|
34
|
-
sort:
|
|
32
|
+
const o = s(() => t.getTheme()), A = s(() => t.getDataInterval()), c = s(() => (C.value, n.value ? K(t, {
|
|
33
|
+
time: n.value.time,
|
|
34
|
+
sort: L.value,
|
|
35
35
|
cacheKey: "tooltip"
|
|
36
|
-
}) : [])), z = s(() =>
|
|
36
|
+
}) : [])), z = s(() => n.value?.time ?? 0), O = Y(), g = s(() => typeof O.default == "function"), B = w(null), b = w(null);
|
|
37
37
|
let S = null;
|
|
38
|
-
|
|
38
|
+
Z((a) => {
|
|
39
39
|
if (!g.value) return;
|
|
40
|
-
const
|
|
41
|
-
!
|
|
40
|
+
const i = B.value;
|
|
41
|
+
!i || typeof ResizeObserver > "u" || (S = new ResizeObserver((e) => {
|
|
42
42
|
const l = e[0]?.contentRect;
|
|
43
43
|
if (!l) return;
|
|
44
44
|
const y = b.value;
|
|
45
45
|
(!y || y.width !== l.width || y.height !== l.height) && (b.value = { width: l.width, height: l.height });
|
|
46
|
-
}), S.observe(
|
|
46
|
+
}), S.observe(i), a(() => {
|
|
47
47
|
S?.disconnect(), S = null;
|
|
48
48
|
}));
|
|
49
49
|
});
|
|
50
50
|
const h = s(() => {
|
|
51
|
-
if (!
|
|
52
|
-
const a =
|
|
51
|
+
if (!n.value || c.value.length === 0) return null;
|
|
52
|
+
const a = t.getMediaSize(), i = t.plotLeft, e = a.width - t.yAxisWidth, l = a.height - t.xAxisHeight;
|
|
53
53
|
if (g.value) {
|
|
54
54
|
const v = b.value;
|
|
55
55
|
return v ? R({
|
|
56
|
-
x:
|
|
57
|
-
y:
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
x: n.value.mediaX,
|
|
57
|
+
y: n.value.mediaY,
|
|
58
|
+
chartLeft: i,
|
|
59
|
+
chartWidth: e,
|
|
60
|
+
chartHeight: l,
|
|
60
61
|
tooltipWidth: v.width,
|
|
61
62
|
tooltipHeight: v.height
|
|
62
|
-
}) : { left:
|
|
63
|
+
}) : { left: i, top: 0 };
|
|
63
64
|
}
|
|
64
|
-
const
|
|
65
|
+
const y = c.value.some((v) => "open" in v.data), E = c.value.filter((v) => !("open" in v.data)).length, M = 160, N = y ? 140 : 40 + E * 22;
|
|
65
66
|
return R({
|
|
66
|
-
x:
|
|
67
|
-
y:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
x: n.value.mediaX,
|
|
68
|
+
y: n.value.mediaY,
|
|
69
|
+
chartLeft: i,
|
|
70
|
+
chartWidth: e,
|
|
71
|
+
chartHeight: l,
|
|
72
|
+
tooltipWidth: M,
|
|
71
73
|
tooltipHeight: N
|
|
72
74
|
});
|
|
73
|
-
}),
|
|
74
|
-
function
|
|
75
|
+
}), T = s(() => !g.value || b.value !== null);
|
|
76
|
+
function V(a) {
|
|
75
77
|
return "open" in a;
|
|
76
78
|
}
|
|
77
|
-
return (a,
|
|
78
|
-
p(
|
|
79
|
+
return (a, i) => (r(), u(x, null, [
|
|
80
|
+
p(n) && c.value.length > 0 && h.value && !g.value ? (r(), u("div", {
|
|
79
81
|
key: 0,
|
|
80
82
|
style: m({
|
|
81
83
|
position: "absolute",
|
|
82
84
|
left: h.value.left + "px",
|
|
83
85
|
top: h.value.top + "px",
|
|
84
86
|
pointerEvents: "none",
|
|
85
|
-
background:
|
|
87
|
+
background: o.value.tooltip.background,
|
|
86
88
|
backdropFilter: "blur(12px)",
|
|
87
89
|
WebkitBackdropFilter: "blur(12px)",
|
|
88
|
-
border: "1px solid " +
|
|
90
|
+
border: "1px solid " + o.value.tooltip.borderColor,
|
|
89
91
|
borderRadius: "8px",
|
|
90
92
|
padding: "10px 14px",
|
|
91
93
|
boxShadow: "0 4px 16px rgba(0,0,0,0.1), 0 1px 4px rgba(0,0,0,0.06)",
|
|
92
|
-
fontSize:
|
|
93
|
-
fontFamily:
|
|
94
|
+
fontSize: o.value.tooltip.fontSize + "px",
|
|
95
|
+
fontFamily: o.value.typography.fontFamily,
|
|
94
96
|
fontVariantNumeric: "tabular-nums",
|
|
95
|
-
color:
|
|
97
|
+
color: o.value.tooltip.textColor,
|
|
96
98
|
minWidth: "140px",
|
|
97
99
|
zIndex: 10,
|
|
98
100
|
transition: "opacity 0.15s ease"
|
|
@@ -100,18 +102,18 @@ const Q = {
|
|
|
100
102
|
}, [
|
|
101
103
|
d("div", {
|
|
102
104
|
style: m({
|
|
103
|
-
fontSize:
|
|
104
|
-
color:
|
|
105
|
+
fontSize: o.value.axis.fontSize + "px",
|
|
106
|
+
color: o.value.axis.textColor,
|
|
105
107
|
marginBottom: "8px",
|
|
106
108
|
paddingBottom: "6px",
|
|
107
|
-
borderBottom: "1px solid " +
|
|
109
|
+
borderBottom: "1px solid " + o.value.tooltip.borderColor,
|
|
108
110
|
letterSpacing: "0.02em"
|
|
109
111
|
})
|
|
110
|
-
}, f(p(
|
|
112
|
+
}, f(p(G)(z.value, { locale: p(t).timeScale.getLocale(), timeZone: p(t).timeScale.getTimeZone() })) + " " + f(p(t).timeScale.formatX(z.value, A.value)), 5),
|
|
111
113
|
(r(!0), u(x, null, H(c.value, (e) => (r(), u(x, {
|
|
112
114
|
key: e.id
|
|
113
115
|
}, [
|
|
114
|
-
|
|
116
|
+
V(e.data) ? (r(), u("div", ee, [
|
|
115
117
|
(r(!0), u(x, null, H([
|
|
116
118
|
{ label: "Open", val: e.data.open, field: "open" },
|
|
117
119
|
{ label: "High", val: e.data.high, field: "high" },
|
|
@@ -120,24 +122,24 @@ const Q = {
|
|
|
120
122
|
], (l) => (r(), u(x, {
|
|
121
123
|
key: l.label
|
|
122
124
|
}, [
|
|
123
|
-
d("span",
|
|
125
|
+
d("span", te, f(l.label), 1),
|
|
124
126
|
d("span", {
|
|
125
127
|
style: m({
|
|
126
128
|
fontWeight: 600,
|
|
127
|
-
color: p(
|
|
128
|
-
e.data.close >= e.data.open ?
|
|
129
|
+
color: p(U)(
|
|
130
|
+
e.data.close >= e.data.open ? o.value.candlestick.up.body : o.value.candlestick.down.body
|
|
129
131
|
),
|
|
130
132
|
textAlign: "right"
|
|
131
133
|
})
|
|
132
134
|
}, f(k.value(l.val, l.field)), 5)
|
|
133
135
|
], 64))), 128)),
|
|
134
136
|
e.data.volume != null ? (r(), u(x, { key: 0 }, [
|
|
135
|
-
|
|
137
|
+
i[0] || (i[0] = d("span", { style: { opacity: 0.5 } }, "Volume", -1)),
|
|
136
138
|
d("span", {
|
|
137
|
-
style: m({ fontWeight: 600, color:
|
|
139
|
+
style: m({ fontWeight: 600, color: o.value.tooltip.textColor, textAlign: "right" })
|
|
138
140
|
}, f(k.value(e.data.volume, "volume")), 5)
|
|
139
141
|
], 64)) : _("", !0)
|
|
140
|
-
])) : (r(), u("div",
|
|
142
|
+
])) : (r(), u("div", oe, [
|
|
141
143
|
d("span", {
|
|
142
144
|
style: m({
|
|
143
145
|
width: "8px",
|
|
@@ -147,49 +149,49 @@ const Q = {
|
|
|
147
149
|
flexShrink: 0
|
|
148
150
|
})
|
|
149
151
|
}, null, 4),
|
|
150
|
-
d("span",
|
|
152
|
+
d("span", le, f(e.label ?? "Value"), 1),
|
|
151
153
|
d("span", {
|
|
152
154
|
style: m({ fontWeight: 600, color: e.color })
|
|
153
155
|
}, f(k.value(e.data.value, "value")), 5)
|
|
154
156
|
]))
|
|
155
157
|
], 64))), 128))
|
|
156
158
|
], 4)) : _("", !0),
|
|
157
|
-
p(
|
|
159
|
+
p(n) && c.value.length > 0 && h.value && g.value ? (r(), u("div", {
|
|
158
160
|
key: 1,
|
|
159
161
|
ref_key: "containerRef",
|
|
160
162
|
ref: B,
|
|
161
|
-
"data-measured":
|
|
163
|
+
"data-measured": T.value ? "true" : "false",
|
|
162
164
|
style: m({
|
|
163
165
|
position: "absolute",
|
|
164
166
|
left: h.value.left + "px",
|
|
165
167
|
top: h.value.top + "px",
|
|
166
168
|
pointerEvents: "none",
|
|
167
|
-
background:
|
|
169
|
+
background: o.value.tooltip.background,
|
|
168
170
|
backdropFilter: "blur(12px)",
|
|
169
171
|
WebkitBackdropFilter: "blur(12px)",
|
|
170
|
-
border: "1px solid " +
|
|
172
|
+
border: "1px solid " + o.value.tooltip.borderColor,
|
|
171
173
|
borderRadius: "8px",
|
|
172
174
|
padding: "10px 14px",
|
|
173
175
|
boxShadow: "0 4px 16px rgba(0,0,0,0.1), 0 1px 4px rgba(0,0,0,0.06)",
|
|
174
|
-
fontFamily:
|
|
175
|
-
fontSize:
|
|
176
|
+
fontFamily: o.value.typography.fontFamily,
|
|
177
|
+
fontSize: o.value.tooltip.fontSize + "px",
|
|
176
178
|
fontVariantNumeric: "tabular-nums",
|
|
177
|
-
color:
|
|
179
|
+
color: o.value.tooltip.textColor,
|
|
178
180
|
width: "max-content",
|
|
179
|
-
maxWidth: p(
|
|
181
|
+
maxWidth: p(t).getMediaSize().width - p(t).yAxisWidth + "px",
|
|
180
182
|
boxSizing: "border-box",
|
|
181
183
|
zIndex: 10,
|
|
182
184
|
visibility: b.value !== null ? "visible" : "hidden"
|
|
183
185
|
})
|
|
184
186
|
}, [
|
|
185
|
-
|
|
187
|
+
$(a.$slots, "default", {
|
|
186
188
|
snapshots: c.value,
|
|
187
189
|
time: z.value
|
|
188
190
|
})
|
|
189
|
-
], 12,
|
|
191
|
+
], 12, ae)) : _("", !0)
|
|
190
192
|
], 64));
|
|
191
193
|
}
|
|
192
194
|
});
|
|
193
195
|
export {
|
|
194
|
-
|
|
196
|
+
ve as default
|
|
195
197
|
};
|