@tectra-ng/charts 0.0.1 → 0.2.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/LICENSE +21 -0
- package/README.md +44 -1
- package/bar-list/README.md +30 -0
- package/boxplot/README.md +62 -0
- package/bullet/README.md +53 -0
- package/candlestick/README.md +57 -0
- package/column/README.md +73 -0
- package/combo/README.md +83 -0
- package/core/README.md +62 -0
- package/fesm2022/tectra-ng-charts-bar-list.mjs +299 -0
- package/fesm2022/tectra-ng-charts-bar-list.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-boxplot.mjs +887 -0
- package/fesm2022/tectra-ng-charts-boxplot.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-bullet.mjs +666 -0
- package/fesm2022/tectra-ng-charts-bullet.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-candlestick.mjs +778 -0
- package/fesm2022/tectra-ng-charts-candlestick.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-column.mjs +1166 -0
- package/fesm2022/tectra-ng-charts-column.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-combo.mjs +1218 -0
- package/fesm2022/tectra-ng-charts-combo.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-core.mjs +3679 -0
- package/fesm2022/tectra-ng-charts-core.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-funnel.mjs +694 -0
- package/fesm2022/tectra-ng-charts-funnel.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-gantt.mjs +947 -0
- package/fesm2022/tectra-ng-charts-gantt.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-gauge.mjs +693 -0
- package/fesm2022/tectra-ng-charts-gauge.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-heatmap.mjs +935 -0
- package/fesm2022/tectra-ng-charts-heatmap.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-line.mjs +1541 -0
- package/fesm2022/tectra-ng-charts-line.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-org-chart.mjs +2341 -0
- package/fesm2022/tectra-ng-charts-org-chart.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-pie.mjs +1059 -0
- package/fesm2022/tectra-ng-charts-pie.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-radar.mjs +924 -0
- package/fesm2022/tectra-ng-charts-radar.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-radial-bar.mjs +802 -0
- package/fesm2022/tectra-ng-charts-radial-bar.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-range-area.mjs +933 -0
- package/fesm2022/tectra-ng-charts-range-area.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-rank-line.mjs +660 -0
- package/fesm2022/tectra-ng-charts-rank-line.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-sankey.mjs +837 -0
- package/fesm2022/tectra-ng-charts-sankey.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-scatter.mjs +1174 -0
- package/fesm2022/tectra-ng-charts-scatter.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-segmented-bar.mjs +328 -0
- package/fesm2022/tectra-ng-charts-segmented-bar.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-sunburst.mjs +733 -0
- package/fesm2022/tectra-ng-charts-sunburst.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-treemap.mjs +674 -0
- package/fesm2022/tectra-ng-charts-treemap.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts-waterfall.mjs +809 -0
- package/fesm2022/tectra-ng-charts-waterfall.mjs.map +1 -0
- package/fesm2022/tectra-ng-charts.mjs +4 -0
- package/fesm2022/tectra-ng-charts.mjs.map +1 -0
- package/funnel/README.md +53 -0
- package/gantt/README.md +53 -0
- package/gauge/README.md +41 -0
- package/heatmap/README.md +47 -0
- package/line/README.md +86 -0
- package/org-chart/README.md +57 -0
- package/package.json +173 -4
- package/pie/README.md +66 -0
- package/radar/README.md +64 -0
- package/radial-bar/README.md +62 -0
- package/range-area/README.md +66 -0
- package/rank-line/README.md +51 -0
- package/sankey/README.md +52 -0
- package/scatter/README.md +71 -0
- package/segmented-bar/README.md +35 -0
- package/sunburst/README.md +55 -0
- package/treemap/README.md +47 -0
- package/types/tectra-ng-charts-bar-list.d.ts +724 -0
- package/types/tectra-ng-charts-bar-list.d.ts.map +1 -0
- package/types/tectra-ng-charts-boxplot.d.ts +882 -0
- package/types/tectra-ng-charts-boxplot.d.ts.map +1 -0
- package/types/tectra-ng-charts-bullet.d.ts +833 -0
- package/types/tectra-ng-charts-bullet.d.ts.map +1 -0
- package/types/tectra-ng-charts-candlestick.d.ts +854 -0
- package/types/tectra-ng-charts-candlestick.d.ts.map +1 -0
- package/types/tectra-ng-charts-column.d.ts +951 -0
- package/types/tectra-ng-charts-column.d.ts.map +1 -0
- package/types/tectra-ng-charts-combo.d.ts +987 -0
- package/types/tectra-ng-charts-combo.d.ts.map +1 -0
- package/types/tectra-ng-charts-core.d.ts +859 -0
- package/types/tectra-ng-charts-core.d.ts.map +1 -0
- package/types/tectra-ng-charts-funnel.d.ts +857 -0
- package/types/tectra-ng-charts-funnel.d.ts.map +1 -0
- package/types/tectra-ng-charts-gantt.d.ts +884 -0
- package/types/tectra-ng-charts-gantt.d.ts.map +1 -0
- package/types/tectra-ng-charts-gauge.d.ts +859 -0
- package/types/tectra-ng-charts-gauge.d.ts.map +1 -0
- package/types/tectra-ng-charts-heatmap.d.ts +914 -0
- package/types/tectra-ng-charts-heatmap.d.ts.map +1 -0
- package/types/tectra-ng-charts-line.d.ts +1023 -0
- package/types/tectra-ng-charts-line.d.ts.map +1 -0
- package/types/tectra-ng-charts-org-chart.d.ts +1017 -0
- package/types/tectra-ng-charts-org-chart.d.ts.map +1 -0
- package/types/tectra-ng-charts-pie.d.ts +983 -0
- package/types/tectra-ng-charts-pie.d.ts.map +1 -0
- package/types/tectra-ng-charts-radar.d.ts +903 -0
- package/types/tectra-ng-charts-radar.d.ts.map +1 -0
- package/types/tectra-ng-charts-radial-bar.d.ts +886 -0
- package/types/tectra-ng-charts-radial-bar.d.ts.map +1 -0
- package/types/tectra-ng-charts-range-area.d.ts +897 -0
- package/types/tectra-ng-charts-range-area.d.ts.map +1 -0
- package/types/tectra-ng-charts-rank-line.d.ts +839 -0
- package/types/tectra-ng-charts-rank-line.d.ts.map +1 -0
- package/types/tectra-ng-charts-sankey.d.ts +866 -0
- package/types/tectra-ng-charts-sankey.d.ts.map +1 -0
- package/types/tectra-ng-charts-scatter.d.ts +987 -0
- package/types/tectra-ng-charts-scatter.d.ts.map +1 -0
- package/types/tectra-ng-charts-segmented-bar.d.ts +751 -0
- package/types/tectra-ng-charts-segmented-bar.d.ts.map +1 -0
- package/types/tectra-ng-charts-sunburst.d.ts +864 -0
- package/types/tectra-ng-charts-sunburst.d.ts.map +1 -0
- package/types/tectra-ng-charts-treemap.d.ts +847 -0
- package/types/tectra-ng-charts-treemap.d.ts.map +1 -0
- package/types/tectra-ng-charts-waterfall.d.ts +869 -0
- package/types/tectra-ng-charts-waterfall.d.ts.map +1 -0
- package/types/tectra-ng-charts.d.ts +2 -0
- package/types/tectra-ng-charts.d.ts.map +1 -0
- package/waterfall/README.md +60 -0
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
import { TxChartAxes, TxChartFrame, TxChartTooltipTemplate, cartesianLayout, chartNumberFormatter, chartSummary, initialChartSize, injectChartEntrance, readTokenNumber, stepIndex, timeInterval, timeTickFormatter, timeTooltipFormatter, toTime } from "@tectra-ng/charts/core";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { ChangeDetectionStrategy, Component, ElementRef, afterNextRender, afterRenderEffect, booleanAttribute, computed, contentChild, inject, input, linkedSignal, output, signal, viewChild } from "@angular/core";
|
|
4
|
+
import { injectPassThrough, injectUnstyled } from "@tectra-ng/core/config";
|
|
5
|
+
import { TxLocaleService, injectTranslations } from "@tectra-ng/core/i18n";
|
|
6
|
+
import { optionalBoolean } from "@tectra-ng/core/utils";
|
|
7
|
+
import { toStyleObject } from "@tectra-ng/themes";
|
|
8
|
+
const ISO_DATE = /^\d{4}-\d{2}-\d{2}/;
|
|
9
|
+
function candleTimes(candles) {
|
|
10
|
+
if (!candles.length) return null;
|
|
11
|
+
const times = candles.map((candle) => candle.x instanceof Date || typeof candle.x === "string" && ISO_DATE.test(candle.x) ? toTime(candle.x) : null);
|
|
12
|
+
return times.every((time) => time !== null) ? times : null;
|
|
13
|
+
}
|
|
14
|
+
function candleLabels(candles, intl) {
|
|
15
|
+
const times = candleTimes(candles);
|
|
16
|
+
if (!times) {
|
|
17
|
+
const labels = candles.map((candle) => String(candle.x));
|
|
18
|
+
return {
|
|
19
|
+
axis: labels,
|
|
20
|
+
full: labels
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const span = times[times.length - 1] - times[0];
|
|
24
|
+
const interval = timeInterval(times[0], times[times.length - 1] || times[0] + 1, Math.max(2, Math.min(12, times.length)));
|
|
25
|
+
const axis = timeTickFormatter(intl, interval, span);
|
|
26
|
+
const full = timeTooltipFormatter(intl, interval);
|
|
27
|
+
return {
|
|
28
|
+
axis: times.map((time) => axis(time)),
|
|
29
|
+
full: times.map((time) => full(time))
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function candleExtent(candles, volumeShare) {
|
|
33
|
+
if (!candles.length) return [0, 1];
|
|
34
|
+
let low = Infinity;
|
|
35
|
+
let high = -Infinity;
|
|
36
|
+
for (const candle of candles) {
|
|
37
|
+
low = Math.min(low, candle.low, candle.open, candle.close);
|
|
38
|
+
high = Math.max(high, candle.high, candle.open, candle.close);
|
|
39
|
+
}
|
|
40
|
+
const span = high - low || Math.abs(high) * .1 || 1;
|
|
41
|
+
const share = Math.min(.6, Math.max(0, volumeShare));
|
|
42
|
+
return [low - span * share / (1 - share), high];
|
|
43
|
+
}
|
|
44
|
+
function isUp(candle) {
|
|
45
|
+
return candle.close >= candle.open;
|
|
46
|
+
}
|
|
47
|
+
const DEFAULTS = {
|
|
48
|
+
bodyWidth: .68,
|
|
49
|
+
volumeHeight: .22
|
|
50
|
+
};
|
|
51
|
+
const EDGE_SLACK = 8;
|
|
52
|
+
var TxCandlestickChart = class TxCandlestickChart {
|
|
53
|
+
locale = inject(TxLocaleService);
|
|
54
|
+
host = inject(ElementRef);
|
|
55
|
+
translations = injectTranslations();
|
|
56
|
+
data = input([], ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
|
|
57
|
+
variant = input("candle", ...ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []);
|
|
58
|
+
showVolume = input(true, {
|
|
59
|
+
...ngDevMode ? { debugName: "showVolume" } : /* istanbul ignore next */ {},
|
|
60
|
+
transform: booleanAttribute
|
|
61
|
+
});
|
|
62
|
+
height = input(380, ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
|
|
63
|
+
showTooltip = input(true, {
|
|
64
|
+
...ngDevMode ? { debugName: "showTooltip" } : /* istanbul ignore next */ {},
|
|
65
|
+
transform: booleanAttribute
|
|
66
|
+
});
|
|
67
|
+
valueFormat = input("number", ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
|
|
68
|
+
volumeFormat = input("compact", ...ngDevMode ? [{ debugName: "volumeFormat" }] : /* istanbul ignore next */ []);
|
|
69
|
+
yMin = input(void 0, ...ngDevMode ? [{ debugName: "yMin" }] : /* istanbul ignore next */ []);
|
|
70
|
+
yMax = input(void 0, ...ngDevMode ? [{ debugName: "yMax" }] : /* istanbul ignore next */ []);
|
|
71
|
+
yAxisTitle = input("", ...ngDevMode ? [{ debugName: "yAxisTitle" }] : /* istanbul ignore next */ []);
|
|
72
|
+
grid = input("value", ...ngDevMode ? [{ debugName: "grid" }] : /* istanbul ignore next */ []);
|
|
73
|
+
labelMode = input("skip", ...ngDevMode ? [{ debugName: "labelMode" }] : /* istanbul ignore next */ []);
|
|
74
|
+
yAxisPosition = input("right", ...ngDevMode ? [{ debugName: "yAxisPosition" }] : /* istanbul ignore next */ []);
|
|
75
|
+
toolbar = input(true, {
|
|
76
|
+
...ngDevMode ? { debugName: "toolbar" } : /* istanbul ignore next */ {},
|
|
77
|
+
transform: booleanAttribute
|
|
78
|
+
});
|
|
79
|
+
loading = input(false, {
|
|
80
|
+
...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
|
|
81
|
+
transform: booleanAttribute
|
|
82
|
+
});
|
|
83
|
+
ariaLabel = input("", ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
|
|
84
|
+
dt = input(void 0, ...ngDevMode ? [{ debugName: "dt" }] : /* istanbul ignore next */ []);
|
|
85
|
+
pt = input(void 0, ...ngDevMode ? [{ debugName: "pt" }] : /* istanbul ignore next */ []);
|
|
86
|
+
ptOptions = input(void 0, ...ngDevMode ? [{ debugName: "ptOptions" }] : /* istanbul ignore next */ []);
|
|
87
|
+
unstyled = input(void 0, {
|
|
88
|
+
...ngDevMode ? { debugName: "unstyled" } : /* istanbul ignore next */ {},
|
|
89
|
+
transform: optionalBoolean
|
|
90
|
+
});
|
|
91
|
+
candleClick = output();
|
|
92
|
+
tooltipTemplate = contentChild(TxChartTooltipTemplate, ...ngDevMode ? [{ debugName: "tooltipTemplate" }] : /* istanbul ignore next */ []);
|
|
93
|
+
frame = viewChild(TxChartFrame, ...ngDevMode ? [{ debugName: "frame" }] : /* istanbul ignore next */ []);
|
|
94
|
+
isUnstyled = injectUnstyled(this.unstyled);
|
|
95
|
+
passThrough = injectPassThrough("candlestickChart", this, this.pt, this.ptOptions);
|
|
96
|
+
tokenStyle = computed(() => toStyleObject(this.dt(), "--tx-chart"), ...ngDevMode ? [{ debugName: "tokenStyle" }] : /* istanbul ignore next */ []);
|
|
97
|
+
hostStyle = computed(() => ({
|
|
98
|
+
...this.tokenStyle(),
|
|
99
|
+
...this.passThrough().root?.style
|
|
100
|
+
}), ...ngDevMode ? [{ debugName: "hostStyle" }] : /* istanbul ignore next */ []);
|
|
101
|
+
entrance = injectChartEntrance();
|
|
102
|
+
morph = signal(false, ...ngDevMode ? [{ debugName: "morph" }] : /* istanbul ignore next */ []);
|
|
103
|
+
active = signal(null, ...ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []);
|
|
104
|
+
geometry = signal(DEFAULTS, ...ngDevMode ? [{ debugName: "geometry" }] : /* istanbul ignore next */ []);
|
|
105
|
+
intl = computed(() => this.locale.locale().intl, ...ngDevMode ? [{ debugName: "intl" }] : /* istanbul ignore next */ []);
|
|
106
|
+
list = computed(() => (this.data() ?? []).filter((candle) => [
|
|
107
|
+
candle.open,
|
|
108
|
+
candle.high,
|
|
109
|
+
candle.low,
|
|
110
|
+
candle.close
|
|
111
|
+
].every((value) => Number.isFinite(value))), ...ngDevMode ? [{ debugName: "list" }] : /* istanbul ignore next */ []);
|
|
112
|
+
isEmpty = computed(() => !this.list().length, ...ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []);
|
|
113
|
+
hasVolume = computed(() => this.showVolume() && this.list().some((candle) => (candle.volume ?? 0) > 0), ...ngDevMode ? [{ debugName: "hasVolume" }] : /* istanbul ignore next */ []);
|
|
114
|
+
size = linkedSignal(() => initialChartSize(this.height(), null, void 0, this.toolbar()), ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
|
|
115
|
+
labels = computed(() => candleLabels(this.list(), this.intl()), ...ngDevMode ? [{ debugName: "labels" }] : /* istanbul ignore next */ []);
|
|
116
|
+
valueFormatter = computed(() => chartNumberFormatter(this.intl(), this.valueFormat()), ...ngDevMode ? [{ debugName: "valueFormatter" }] : /* istanbul ignore next */ []);
|
|
117
|
+
volumeFormatter = computed(() => chartNumberFormatter(this.intl(), this.volumeFormat()), ...ngDevMode ? [{ debugName: "volumeFormatter" }] : /* istanbul ignore next */ []);
|
|
118
|
+
layout = computed(() => {
|
|
119
|
+
const { width, height } = this.size();
|
|
120
|
+
const labels = this.labels().axis;
|
|
121
|
+
return cartesianLayout({
|
|
122
|
+
width,
|
|
123
|
+
height,
|
|
124
|
+
intl: this.intl(),
|
|
125
|
+
category: {
|
|
126
|
+
kind: "band",
|
|
127
|
+
labels,
|
|
128
|
+
count: labels.length,
|
|
129
|
+
labelMode: this.labelMode()
|
|
130
|
+
},
|
|
131
|
+
value: {
|
|
132
|
+
extent: candleExtent(this.list(), this.hasVolume() ? this.geometry().volumeHeight : 0),
|
|
133
|
+
format: this.valueFormat(),
|
|
134
|
+
includeZero: false,
|
|
135
|
+
min: this.yMin(),
|
|
136
|
+
max: this.yMax(),
|
|
137
|
+
title: this.yAxisTitle() || void 0
|
|
138
|
+
},
|
|
139
|
+
grid: this.grid(),
|
|
140
|
+
yAxisPosition: this.yAxisPosition()
|
|
141
|
+
});
|
|
142
|
+
}, ...ngDevMode ? [{ debugName: "layout" }] : /* istanbul ignore next */ []);
|
|
143
|
+
candles = computed(() => {
|
|
144
|
+
const layout = this.layout();
|
|
145
|
+
const band = layout.category;
|
|
146
|
+
const scale = layout.value;
|
|
147
|
+
const width = Math.max(1, band.bandwidth * Math.min(1, Math.max(.05, this.geometry().bodyWidth)));
|
|
148
|
+
const plot = layout.plot;
|
|
149
|
+
const volumeArea = this.hasVolume() ? plot.height * this.geometry().volumeHeight : 0;
|
|
150
|
+
const maxVolume = Math.max(0, ...this.list().map((candle) => candle.volume ?? 0));
|
|
151
|
+
return this.list().map((candle, index) => {
|
|
152
|
+
const open = scale.map(candle.open);
|
|
153
|
+
const close = scale.map(candle.close);
|
|
154
|
+
const volume = candle.volume ?? 0;
|
|
155
|
+
const volumeHeight = volumeArea && maxVolume ? Math.max(0, volume) / maxVolume * volumeArea : 0;
|
|
156
|
+
return {
|
|
157
|
+
index,
|
|
158
|
+
key: `${index}`,
|
|
159
|
+
up: isUp(candle),
|
|
160
|
+
center: band.center(index),
|
|
161
|
+
width,
|
|
162
|
+
high: scale.map(candle.high),
|
|
163
|
+
low: scale.map(candle.low),
|
|
164
|
+
open,
|
|
165
|
+
close,
|
|
166
|
+
bodyY: Math.min(open, close),
|
|
167
|
+
bodyHeight: Math.max(1, Math.abs(open - close)),
|
|
168
|
+
volumeY: volumeHeight ? plot.top + plot.height - volumeHeight : null,
|
|
169
|
+
volumeHeight
|
|
170
|
+
};
|
|
171
|
+
});
|
|
172
|
+
}, ...ngDevMode ? [{ debugName: "candles" }] : /* istanbul ignore next */ []);
|
|
173
|
+
crosshair = computed(() => {
|
|
174
|
+
const index = this.active();
|
|
175
|
+
const candle = index === null ? null : this.candles()[index];
|
|
176
|
+
if (!candle) return null;
|
|
177
|
+
const plot = this.layout().plot;
|
|
178
|
+
return {
|
|
179
|
+
x: candle.center,
|
|
180
|
+
y1: plot.top,
|
|
181
|
+
y2: plot.top + plot.height
|
|
182
|
+
};
|
|
183
|
+
}, ...ngDevMode ? [{ debugName: "crosshair" }] : /* istanbul ignore next */ []);
|
|
184
|
+
tooltip = computed(() => {
|
|
185
|
+
const index = this.active();
|
|
186
|
+
if (index === null || !this.showTooltip()) return null;
|
|
187
|
+
const candle = this.list()[index];
|
|
188
|
+
const shape = this.candles()[index];
|
|
189
|
+
if (!candle || !shape) return null;
|
|
190
|
+
const t = this.translations();
|
|
191
|
+
const format = this.valueFormatter();
|
|
192
|
+
const color = `var(--tx-chart-candlestick-${shape.up ? "up" : "down"}-color)`;
|
|
193
|
+
const rows = [
|
|
194
|
+
{
|
|
195
|
+
label: t.chartOpen,
|
|
196
|
+
value: format(candle.open),
|
|
197
|
+
color,
|
|
198
|
+
raw: candle.open,
|
|
199
|
+
seriesIndex: 0
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
label: t.chartHigh,
|
|
203
|
+
value: format(candle.high),
|
|
204
|
+
color: "transparent",
|
|
205
|
+
raw: candle.high,
|
|
206
|
+
seriesIndex: 1
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
label: t.chartLow,
|
|
210
|
+
value: format(candle.low),
|
|
211
|
+
color: "transparent",
|
|
212
|
+
raw: candle.low,
|
|
213
|
+
seriesIndex: 2
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
label: t.chartClose,
|
|
217
|
+
value: format(candle.close),
|
|
218
|
+
color: "transparent",
|
|
219
|
+
raw: candle.close,
|
|
220
|
+
seriesIndex: 3,
|
|
221
|
+
active: true
|
|
222
|
+
},
|
|
223
|
+
...this.hasVolume() && candle.volume !== null && candle.volume !== void 0 ? [{
|
|
224
|
+
label: t.chartVolume,
|
|
225
|
+
value: this.volumeFormatter()(candle.volume),
|
|
226
|
+
color: "transparent",
|
|
227
|
+
raw: candle.volume,
|
|
228
|
+
seriesIndex: 4
|
|
229
|
+
}] : []
|
|
230
|
+
];
|
|
231
|
+
return {
|
|
232
|
+
title: this.labels().full[index] ?? "",
|
|
233
|
+
rows,
|
|
234
|
+
index,
|
|
235
|
+
x: shape.center,
|
|
236
|
+
y: shape.high,
|
|
237
|
+
placement: "top"
|
|
238
|
+
};
|
|
239
|
+
}, ...ngDevMode ? [{ debugName: "tooltip" }] : /* istanbul ignore next */ []);
|
|
240
|
+
summary = computed(() => {
|
|
241
|
+
const t = this.translations();
|
|
242
|
+
const list = this.list();
|
|
243
|
+
const format = this.valueFormatter();
|
|
244
|
+
const range = list.length ? [format(Math.min(...list.map((candle) => candle.low))), format(Math.max(...list.map((candle) => candle.high)))] : null;
|
|
245
|
+
const text = chartSummary(t, this.intl(), t.chartCandlestick, 1, list.length, range);
|
|
246
|
+
return this.ariaLabel() ? `${this.ariaLabel()}. ${text}` : text;
|
|
247
|
+
}, ...ngDevMode ? [{ debugName: "summary" }] : /* istanbul ignore next */ []);
|
|
248
|
+
dataTable = computed(() => {
|
|
249
|
+
const t = this.translations();
|
|
250
|
+
const format = this.valueFormatter();
|
|
251
|
+
const volume = this.hasVolume();
|
|
252
|
+
return {
|
|
253
|
+
columns: [
|
|
254
|
+
{
|
|
255
|
+
key: "open",
|
|
256
|
+
label: t.chartOpen
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
key: "high",
|
|
260
|
+
label: t.chartHigh
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
key: "low",
|
|
264
|
+
label: t.chartLow
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
key: "close",
|
|
268
|
+
label: t.chartClose
|
|
269
|
+
},
|
|
270
|
+
...volume ? [{
|
|
271
|
+
key: "volume",
|
|
272
|
+
label: t.chartVolume
|
|
273
|
+
}] : []
|
|
274
|
+
],
|
|
275
|
+
rows: this.list().map((candle, index) => ({
|
|
276
|
+
label: this.labels().full[index],
|
|
277
|
+
cells: [
|
|
278
|
+
format(candle.open),
|
|
279
|
+
format(candle.high),
|
|
280
|
+
format(candle.low),
|
|
281
|
+
format(candle.close),
|
|
282
|
+
...volume ? [candle.volume === null || candle.volume === void 0 ? "—" : this.volumeFormatter()(candle.volume)] : []
|
|
283
|
+
]
|
|
284
|
+
}))
|
|
285
|
+
};
|
|
286
|
+
}, ...ngDevMode ? [{ debugName: "dataTable" }] : /* istanbul ignore next */ []);
|
|
287
|
+
constructor() {
|
|
288
|
+
afterNextRender(() => setTimeout(() => this.morph.set(true), 120));
|
|
289
|
+
afterRenderEffect(() => {
|
|
290
|
+
this.dt();
|
|
291
|
+
this.readGeometry();
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
onPointer(event) {
|
|
295
|
+
if (event.type === "leave") {
|
|
296
|
+
this.active.set(null);
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const plot = this.layout().plot;
|
|
300
|
+
const index = event.x >= plot.left - EDGE_SLACK && event.x <= plot.left + plot.width + EDGE_SLACK && event.y >= plot.top - EDGE_SLACK && event.y <= plot.top + plot.height + EDGE_SLACK ? this.layout().category.indexAt(event.x) : -1;
|
|
301
|
+
this.active.set(index >= 0 ? index : null);
|
|
302
|
+
if (event.type === "click" && index >= 0) this.candleClick.emit({
|
|
303
|
+
index,
|
|
304
|
+
label: this.labels().full[index],
|
|
305
|
+
candle: this.list()[index]
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
onNavigate(event) {
|
|
309
|
+
if (event.key === "Escape") {
|
|
310
|
+
this.active.set(null);
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
const index = stepIndex(event.key, this.active() ?? -1, this.list().length);
|
|
314
|
+
if (index < 0) return;
|
|
315
|
+
this.active.set(index);
|
|
316
|
+
const candle = this.list()[index];
|
|
317
|
+
const t = this.translations();
|
|
318
|
+
const format = this.valueFormatter();
|
|
319
|
+
this.frame()?.announce(`${this.labels().full[index]}: ${t.chartOpen} ${format(candle.open)}, ${t.chartHigh} ${format(candle.high)}, ${t.chartLow} ${format(candle.low)}, ${t.chartClose} ${format(candle.close)}`);
|
|
320
|
+
}
|
|
321
|
+
readGeometry() {
|
|
322
|
+
const element = this.host.nativeElement;
|
|
323
|
+
const next = {
|
|
324
|
+
bodyWidth: readTokenNumber(element, "--tx-chart-candlestick-body-width", DEFAULTS.bodyWidth),
|
|
325
|
+
volumeHeight: readTokenNumber(element, "--tx-chart-candlestick-volume-height", DEFAULTS.volumeHeight)
|
|
326
|
+
};
|
|
327
|
+
const current = this.geometry();
|
|
328
|
+
if (current.bodyWidth !== next.bodyWidth || current.volumeHeight !== next.volumeHeight) this.geometry.set(next);
|
|
329
|
+
}
|
|
330
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
331
|
+
minVersion: "12.0.0",
|
|
332
|
+
version: "22.2.3",
|
|
333
|
+
ngImport: i0,
|
|
334
|
+
type: TxCandlestickChart,
|
|
335
|
+
deps: [],
|
|
336
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
337
|
+
});
|
|
338
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
339
|
+
minVersion: "17.0.0",
|
|
340
|
+
version: "22.2.3",
|
|
341
|
+
type: TxCandlestickChart,
|
|
342
|
+
isStandalone: true,
|
|
343
|
+
selector: "tx-candlestick-chart",
|
|
344
|
+
inputs: {
|
|
345
|
+
data: {
|
|
346
|
+
classPropertyName: "data",
|
|
347
|
+
publicName: "data",
|
|
348
|
+
isSignal: true,
|
|
349
|
+
isRequired: false,
|
|
350
|
+
transformFunction: null
|
|
351
|
+
},
|
|
352
|
+
variant: {
|
|
353
|
+
classPropertyName: "variant",
|
|
354
|
+
publicName: "variant",
|
|
355
|
+
isSignal: true,
|
|
356
|
+
isRequired: false,
|
|
357
|
+
transformFunction: null
|
|
358
|
+
},
|
|
359
|
+
showVolume: {
|
|
360
|
+
classPropertyName: "showVolume",
|
|
361
|
+
publicName: "showVolume",
|
|
362
|
+
isSignal: true,
|
|
363
|
+
isRequired: false,
|
|
364
|
+
transformFunction: null
|
|
365
|
+
},
|
|
366
|
+
height: {
|
|
367
|
+
classPropertyName: "height",
|
|
368
|
+
publicName: "height",
|
|
369
|
+
isSignal: true,
|
|
370
|
+
isRequired: false,
|
|
371
|
+
transformFunction: null
|
|
372
|
+
},
|
|
373
|
+
showTooltip: {
|
|
374
|
+
classPropertyName: "showTooltip",
|
|
375
|
+
publicName: "showTooltip",
|
|
376
|
+
isSignal: true,
|
|
377
|
+
isRequired: false,
|
|
378
|
+
transformFunction: null
|
|
379
|
+
},
|
|
380
|
+
valueFormat: {
|
|
381
|
+
classPropertyName: "valueFormat",
|
|
382
|
+
publicName: "valueFormat",
|
|
383
|
+
isSignal: true,
|
|
384
|
+
isRequired: false,
|
|
385
|
+
transformFunction: null
|
|
386
|
+
},
|
|
387
|
+
volumeFormat: {
|
|
388
|
+
classPropertyName: "volumeFormat",
|
|
389
|
+
publicName: "volumeFormat",
|
|
390
|
+
isSignal: true,
|
|
391
|
+
isRequired: false,
|
|
392
|
+
transformFunction: null
|
|
393
|
+
},
|
|
394
|
+
yMin: {
|
|
395
|
+
classPropertyName: "yMin",
|
|
396
|
+
publicName: "yMin",
|
|
397
|
+
isSignal: true,
|
|
398
|
+
isRequired: false,
|
|
399
|
+
transformFunction: null
|
|
400
|
+
},
|
|
401
|
+
yMax: {
|
|
402
|
+
classPropertyName: "yMax",
|
|
403
|
+
publicName: "yMax",
|
|
404
|
+
isSignal: true,
|
|
405
|
+
isRequired: false,
|
|
406
|
+
transformFunction: null
|
|
407
|
+
},
|
|
408
|
+
yAxisTitle: {
|
|
409
|
+
classPropertyName: "yAxisTitle",
|
|
410
|
+
publicName: "yAxisTitle",
|
|
411
|
+
isSignal: true,
|
|
412
|
+
isRequired: false,
|
|
413
|
+
transformFunction: null
|
|
414
|
+
},
|
|
415
|
+
grid: {
|
|
416
|
+
classPropertyName: "grid",
|
|
417
|
+
publicName: "grid",
|
|
418
|
+
isSignal: true,
|
|
419
|
+
isRequired: false,
|
|
420
|
+
transformFunction: null
|
|
421
|
+
},
|
|
422
|
+
labelMode: {
|
|
423
|
+
classPropertyName: "labelMode",
|
|
424
|
+
publicName: "labelMode",
|
|
425
|
+
isSignal: true,
|
|
426
|
+
isRequired: false,
|
|
427
|
+
transformFunction: null
|
|
428
|
+
},
|
|
429
|
+
yAxisPosition: {
|
|
430
|
+
classPropertyName: "yAxisPosition",
|
|
431
|
+
publicName: "yAxisPosition",
|
|
432
|
+
isSignal: true,
|
|
433
|
+
isRequired: false,
|
|
434
|
+
transformFunction: null
|
|
435
|
+
},
|
|
436
|
+
toolbar: {
|
|
437
|
+
classPropertyName: "toolbar",
|
|
438
|
+
publicName: "toolbar",
|
|
439
|
+
isSignal: true,
|
|
440
|
+
isRequired: false,
|
|
441
|
+
transformFunction: null
|
|
442
|
+
},
|
|
443
|
+
loading: {
|
|
444
|
+
classPropertyName: "loading",
|
|
445
|
+
publicName: "loading",
|
|
446
|
+
isSignal: true,
|
|
447
|
+
isRequired: false,
|
|
448
|
+
transformFunction: null
|
|
449
|
+
},
|
|
450
|
+
ariaLabel: {
|
|
451
|
+
classPropertyName: "ariaLabel",
|
|
452
|
+
publicName: "ariaLabel",
|
|
453
|
+
isSignal: true,
|
|
454
|
+
isRequired: false,
|
|
455
|
+
transformFunction: null
|
|
456
|
+
},
|
|
457
|
+
dt: {
|
|
458
|
+
classPropertyName: "dt",
|
|
459
|
+
publicName: "dt",
|
|
460
|
+
isSignal: true,
|
|
461
|
+
isRequired: false,
|
|
462
|
+
transformFunction: null
|
|
463
|
+
},
|
|
464
|
+
pt: {
|
|
465
|
+
classPropertyName: "pt",
|
|
466
|
+
publicName: "pt",
|
|
467
|
+
isSignal: true,
|
|
468
|
+
isRequired: false,
|
|
469
|
+
transformFunction: null
|
|
470
|
+
},
|
|
471
|
+
ptOptions: {
|
|
472
|
+
classPropertyName: "ptOptions",
|
|
473
|
+
publicName: "ptOptions",
|
|
474
|
+
isSignal: true,
|
|
475
|
+
isRequired: false,
|
|
476
|
+
transformFunction: null
|
|
477
|
+
},
|
|
478
|
+
unstyled: {
|
|
479
|
+
classPropertyName: "unstyled",
|
|
480
|
+
publicName: "unstyled",
|
|
481
|
+
isSignal: true,
|
|
482
|
+
isRequired: false,
|
|
483
|
+
transformFunction: null
|
|
484
|
+
}
|
|
485
|
+
},
|
|
486
|
+
outputs: { candleClick: "candleClick" },
|
|
487
|
+
host: {
|
|
488
|
+
properties: {
|
|
489
|
+
"class": "passThrough().root?.class",
|
|
490
|
+
"style": "hostStyle()",
|
|
491
|
+
"attr.data-styled": "!isUnstyled() || null",
|
|
492
|
+
"attr.data-variant": "variant()",
|
|
493
|
+
"class.tx-candlestick-chart--fill": "typeof height() === \"string\"",
|
|
494
|
+
"class.tx-candlestick-chart--entering": "entrance.active()",
|
|
495
|
+
"class.tx-candlestick-chart--morph": "morph()",
|
|
496
|
+
"class.tx-candlestick-chart--active": "active() !== null"
|
|
497
|
+
},
|
|
498
|
+
classAttribute: "tx-candlestick-chart"
|
|
499
|
+
},
|
|
500
|
+
queries: [{
|
|
501
|
+
propertyName: "tooltipTemplate",
|
|
502
|
+
first: true,
|
|
503
|
+
predicate: TxChartTooltipTemplate,
|
|
504
|
+
descendants: true,
|
|
505
|
+
isSignal: true
|
|
506
|
+
}],
|
|
507
|
+
viewQueries: [{
|
|
508
|
+
propertyName: "frame",
|
|
509
|
+
first: true,
|
|
510
|
+
predicate: TxChartFrame,
|
|
511
|
+
descendants: true,
|
|
512
|
+
isSignal: true
|
|
513
|
+
}],
|
|
514
|
+
ngImport: i0,
|
|
515
|
+
template: "<tx-chart-frame\n [height]=\"height()\"\n [(size)]=\"size\"\n [showLegend]=\"false\"\n [empty]=\"isEmpty()\"\n [loading]=\"loading()\"\n [toolbar]=\"toolbar()\"\n [exportName]=\"ariaLabel()\"\n emptyIcon=\"chart-bar\"\n [summary]=\"summary()\"\n [table]=\"dataTable()\"\n [tooltip]=\"tooltip()\"\n [tooltipTemplate]=\"tooltipTemplate()?.template\"\n [panelStyle]=\"tokenStyle()\"\n [parts]=\"passThrough()\"\n [styled]=\"!isUnstyled()\"\n (pointer)=\"onPointer($event)\"\n (navigate)=\"onNavigate($event)\"\n (tooltipClosed)=\"active.set(null)\"\n>\n <svg:g [tx-chart-axes]=\"layout().axes\" [gridPart]=\"passThrough().grid\" [axisPart]=\"passThrough().axis\" />\n @if (hasVolume()) {\n <svg:g class=\"tx-candlestick-chart__volumes\">\n @for (candle of candles(); track candle.key) {\n @if (candle.volumeY !== null) {\n <svg:rect\n class=\"tx-candlestick-chart__volume\"\n [class]=\"passThrough().volume?.class\"\n [style]=\"passThrough().volume?.style\"\n [attr.data-dir]=\"candle.up ? 'up' : 'down'\"\n [attr.x]=\"candle.center - candle.width / 2\"\n [attr.y]=\"candle.volumeY\"\n [attr.width]=\"candle.width\"\n [attr.height]=\"candle.volumeHeight\"\n />\n }\n }\n </svg:g>\n }\n @if (crosshair(); as line) {\n <svg:line\n class=\"tx-candlestick-chart__crosshair\"\n [class]=\"passThrough().crosshair?.class\"\n [style]=\"passThrough().crosshair?.style\"\n [attr.x1]=\"line.x\"\n [attr.x2]=\"line.x\"\n [attr.y1]=\"line.y1\"\n [attr.y2]=\"line.y2\"\n />\n }\n <svg:g class=\"tx-candlestick-chart__candles\">\n @for (candle of candles(); track candle.key) {\n <svg:g\n class=\"tx-candlestick-chart__candle\"\n [class.tx-candlestick-chart__candle--active]=\"active() === candle.index\"\n [class]=\"passThrough().candle?.class\"\n [style]=\"passThrough().candle?.style\"\n [attr.data-dir]=\"candle.up ? 'up' : 'down'\"\n [attr.data-index]=\"candle.index\"\n [style.--tx-candlestick-chart-order]=\"candle.index\"\n >\n <svg:line\n class=\"tx-candlestick-chart__wick\"\n [class]=\"passThrough().wick?.class\"\n [style]=\"passThrough().wick?.style\"\n [attr.x1]=\"candle.center\"\n [attr.x2]=\"candle.center\"\n [attr.y1]=\"candle.high\"\n [attr.y2]=\"candle.low\"\n />\n @if (variant() === 'candle') {\n <svg:rect\n class=\"tx-candlestick-chart__body\"\n [class]=\"passThrough().body?.class\"\n [style]=\"passThrough().body?.style\"\n [attr.x]=\"candle.center - candle.width / 2\"\n [attr.y]=\"candle.bodyY\"\n [attr.width]=\"candle.width\"\n [attr.height]=\"candle.bodyHeight\"\n />\n } @else {\n <svg:line class=\"tx-candlestick-chart__tick\" [attr.x1]=\"candle.center - candle.width / 2\" [attr.x2]=\"candle.center\" [attr.y1]=\"candle.open\" [attr.y2]=\"candle.open\" />\n <svg:line class=\"tx-candlestick-chart__tick\" [attr.x1]=\"candle.center\" [attr.x2]=\"candle.center + candle.width / 2\" [attr.y1]=\"candle.close\" [attr.y2]=\"candle.close\" />\n }\n </svg:g>\n }\n </svg:g>\n</tx-chart-frame>\n",
|
|
516
|
+
styles: [":host{display:block;min-width:0}:host(.tx-candlestick-chart--fill){height:100%}.tx-candlestick-chart__candle{color:currentColor;transform-box:fill-box;transform-origin:50% 50%}.tx-candlestick-chart__wick,.tx-candlestick-chart__tick{stroke:currentColor;shape-rendering:crispEdges}.tx-candlestick-chart__body{fill:currentColor}.tx-candlestick-chart__volume{fill:currentColor;fill-opacity:.25}.tx-candlestick-chart__candles,.tx-candlestick-chart__volumes,.tx-candlestick-chart__crosshair{pointer-events:none}:host([data-styled]) .tx-candlestick-chart__candle[data-dir=up],:host([data-styled]) .tx-candlestick-chart__volume[data-dir=up]{color:var(--tx-chart-candlestick-up-color)}:host([data-styled]) .tx-candlestick-chart__candle[data-dir=down],:host([data-styled]) .tx-candlestick-chart__volume[data-dir=down]{color:var(--tx-chart-candlestick-down-color)}:host([data-styled]) .tx-candlestick-chart__volume{fill:currentColor;fill-opacity:var(--tx-chart-candlestick-volume-opacity)}:host([data-styled]) .tx-candlestick-chart__wick,:host([data-styled]) .tx-candlestick-chart__tick{stroke-width:var(--tx-chart-candlestick-wick-width)}:host([data-styled]) .tx-candlestick-chart__body{clip-path:inset(0 round var(--tx-chart-candlestick-body-radius))}:host([data-styled]) .tx-candlestick-chart__crosshair{stroke:var(--tx-chart-crosshair-color);stroke-width:var(--tx-chart-crosshair-width);stroke-dasharray:var(--tx-chart-crosshair-dash)}:host([data-styled]) .tx-candlestick-chart__candle{transition:opacity var(--tx-chart-motion-hover-duration) ease}:host([data-styled][data-variant=ohlc]) .tx-candlestick-chart__tick,:host([data-styled][data-variant=ohlc]) .tx-candlestick-chart__wick{stroke-width:calc(var(--tx-chart-candlestick-wick-width) * 1.4)}:host([data-styled].tx-candlestick-chart--active) .tx-candlestick-chart__candle:not(.tx-candlestick-chart__candle--active){opacity:var(--tx-chart-candlestick-dimmed-opacity)}:host([data-styled].tx-candlestick-chart--entering) .tx-candlestick-chart__candle{animation:tx-candlestick-chart-grow var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both;animation-delay:calc(min(var(--tx-candlestick-chart-order, 0),40) * var(--tx-chart-motion-stagger) * .5)}:host([data-styled].tx-candlestick-chart--entering) .tx-candlestick-chart__volumes{animation:tx-candlestick-chart-fade var(--tx-chart-motion-enter-duration) ease both}@keyframes tx-candlestick-chart-grow{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}@keyframes tx-candlestick-chart-fade{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-candlestick-chart__candle,:host([data-styled]) .tx-candlestick-chart__volumes{transition:none;animation:none}}\n"],
|
|
517
|
+
dependencies: [{
|
|
518
|
+
kind: "component",
|
|
519
|
+
type: TxChartFrame,
|
|
520
|
+
selector: "tx-chart-frame",
|
|
521
|
+
inputs: [
|
|
522
|
+
"height",
|
|
523
|
+
"size",
|
|
524
|
+
"legendItems",
|
|
525
|
+
"showLegend",
|
|
526
|
+
"legendPosition",
|
|
527
|
+
"legendAlign",
|
|
528
|
+
"legendVariant",
|
|
529
|
+
"legendToggle",
|
|
530
|
+
"legendTemplate",
|
|
531
|
+
"empty",
|
|
532
|
+
"loading",
|
|
533
|
+
"emptyIcon",
|
|
534
|
+
"summary",
|
|
535
|
+
"table",
|
|
536
|
+
"tooltip",
|
|
537
|
+
"tooltipTemplate",
|
|
538
|
+
"tooltipPlacement",
|
|
539
|
+
"panelStyle",
|
|
540
|
+
"parts",
|
|
541
|
+
"styled",
|
|
542
|
+
"interactive",
|
|
543
|
+
"actionKeys",
|
|
544
|
+
"zoomable",
|
|
545
|
+
"zoomedIn",
|
|
546
|
+
"plotHeight",
|
|
547
|
+
"toolbar",
|
|
548
|
+
"exportName"
|
|
549
|
+
],
|
|
550
|
+
outputs: [
|
|
551
|
+
"sizeChange",
|
|
552
|
+
"pointer",
|
|
553
|
+
"navigate",
|
|
554
|
+
"legendToggled",
|
|
555
|
+
"legendHovered",
|
|
556
|
+
"tooltipClosed",
|
|
557
|
+
"zoomed",
|
|
558
|
+
"panned",
|
|
559
|
+
"zoomReset"
|
|
560
|
+
]
|
|
561
|
+
}, {
|
|
562
|
+
kind: "component",
|
|
563
|
+
type: TxChartAxes,
|
|
564
|
+
selector: "g[tx-chart-axes]",
|
|
565
|
+
inputs: [
|
|
566
|
+
"tx-chart-axes",
|
|
567
|
+
"gridPart",
|
|
568
|
+
"axisPart"
|
|
569
|
+
]
|
|
570
|
+
}],
|
|
571
|
+
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
572
|
+
});
|
|
573
|
+
};
|
|
574
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
575
|
+
minVersion: "12.0.0",
|
|
576
|
+
version: "22.2.3",
|
|
577
|
+
ngImport: i0,
|
|
578
|
+
type: TxCandlestickChart,
|
|
579
|
+
decorators: [{
|
|
580
|
+
type: Component,
|
|
581
|
+
args: [{
|
|
582
|
+
selector: "tx-candlestick-chart",
|
|
583
|
+
imports: [TxChartFrame, TxChartAxes],
|
|
584
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
585
|
+
host: {
|
|
586
|
+
class: "tx-candlestick-chart",
|
|
587
|
+
"[class]": "passThrough().root?.class",
|
|
588
|
+
"[style]": "hostStyle()",
|
|
589
|
+
"[attr.data-styled]": "!isUnstyled() || null",
|
|
590
|
+
"[attr.data-variant]": "variant()",
|
|
591
|
+
"[class.tx-candlestick-chart--fill]": "typeof height() === \"string\"",
|
|
592
|
+
"[class.tx-candlestick-chart--entering]": "entrance.active()",
|
|
593
|
+
"[class.tx-candlestick-chart--morph]": "morph()",
|
|
594
|
+
"[class.tx-candlestick-chart--active]": "active() !== null"
|
|
595
|
+
},
|
|
596
|
+
template: "<tx-chart-frame\n [height]=\"height()\"\n [(size)]=\"size\"\n [showLegend]=\"false\"\n [empty]=\"isEmpty()\"\n [loading]=\"loading()\"\n [toolbar]=\"toolbar()\"\n [exportName]=\"ariaLabel()\"\n emptyIcon=\"chart-bar\"\n [summary]=\"summary()\"\n [table]=\"dataTable()\"\n [tooltip]=\"tooltip()\"\n [tooltipTemplate]=\"tooltipTemplate()?.template\"\n [panelStyle]=\"tokenStyle()\"\n [parts]=\"passThrough()\"\n [styled]=\"!isUnstyled()\"\n (pointer)=\"onPointer($event)\"\n (navigate)=\"onNavigate($event)\"\n (tooltipClosed)=\"active.set(null)\"\n>\n <svg:g [tx-chart-axes]=\"layout().axes\" [gridPart]=\"passThrough().grid\" [axisPart]=\"passThrough().axis\" />\n @if (hasVolume()) {\n <svg:g class=\"tx-candlestick-chart__volumes\">\n @for (candle of candles(); track candle.key) {\n @if (candle.volumeY !== null) {\n <svg:rect\n class=\"tx-candlestick-chart__volume\"\n [class]=\"passThrough().volume?.class\"\n [style]=\"passThrough().volume?.style\"\n [attr.data-dir]=\"candle.up ? 'up' : 'down'\"\n [attr.x]=\"candle.center - candle.width / 2\"\n [attr.y]=\"candle.volumeY\"\n [attr.width]=\"candle.width\"\n [attr.height]=\"candle.volumeHeight\"\n />\n }\n }\n </svg:g>\n }\n @if (crosshair(); as line) {\n <svg:line\n class=\"tx-candlestick-chart__crosshair\"\n [class]=\"passThrough().crosshair?.class\"\n [style]=\"passThrough().crosshair?.style\"\n [attr.x1]=\"line.x\"\n [attr.x2]=\"line.x\"\n [attr.y1]=\"line.y1\"\n [attr.y2]=\"line.y2\"\n />\n }\n <svg:g class=\"tx-candlestick-chart__candles\">\n @for (candle of candles(); track candle.key) {\n <svg:g\n class=\"tx-candlestick-chart__candle\"\n [class.tx-candlestick-chart__candle--active]=\"active() === candle.index\"\n [class]=\"passThrough().candle?.class\"\n [style]=\"passThrough().candle?.style\"\n [attr.data-dir]=\"candle.up ? 'up' : 'down'\"\n [attr.data-index]=\"candle.index\"\n [style.--tx-candlestick-chart-order]=\"candle.index\"\n >\n <svg:line\n class=\"tx-candlestick-chart__wick\"\n [class]=\"passThrough().wick?.class\"\n [style]=\"passThrough().wick?.style\"\n [attr.x1]=\"candle.center\"\n [attr.x2]=\"candle.center\"\n [attr.y1]=\"candle.high\"\n [attr.y2]=\"candle.low\"\n />\n @if (variant() === 'candle') {\n <svg:rect\n class=\"tx-candlestick-chart__body\"\n [class]=\"passThrough().body?.class\"\n [style]=\"passThrough().body?.style\"\n [attr.x]=\"candle.center - candle.width / 2\"\n [attr.y]=\"candle.bodyY\"\n [attr.width]=\"candle.width\"\n [attr.height]=\"candle.bodyHeight\"\n />\n } @else {\n <svg:line class=\"tx-candlestick-chart__tick\" [attr.x1]=\"candle.center - candle.width / 2\" [attr.x2]=\"candle.center\" [attr.y1]=\"candle.open\" [attr.y2]=\"candle.open\" />\n <svg:line class=\"tx-candlestick-chart__tick\" [attr.x1]=\"candle.center\" [attr.x2]=\"candle.center + candle.width / 2\" [attr.y1]=\"candle.close\" [attr.y2]=\"candle.close\" />\n }\n </svg:g>\n }\n </svg:g>\n</tx-chart-frame>\n",
|
|
597
|
+
styles: [":host{display:block;min-width:0}:host(.tx-candlestick-chart--fill){height:100%}.tx-candlestick-chart__candle{color:currentColor;transform-box:fill-box;transform-origin:50% 50%}.tx-candlestick-chart__wick,.tx-candlestick-chart__tick{stroke:currentColor;shape-rendering:crispEdges}.tx-candlestick-chart__body{fill:currentColor}.tx-candlestick-chart__volume{fill:currentColor;fill-opacity:.25}.tx-candlestick-chart__candles,.tx-candlestick-chart__volumes,.tx-candlestick-chart__crosshair{pointer-events:none}:host([data-styled]) .tx-candlestick-chart__candle[data-dir=up],:host([data-styled]) .tx-candlestick-chart__volume[data-dir=up]{color:var(--tx-chart-candlestick-up-color)}:host([data-styled]) .tx-candlestick-chart__candle[data-dir=down],:host([data-styled]) .tx-candlestick-chart__volume[data-dir=down]{color:var(--tx-chart-candlestick-down-color)}:host([data-styled]) .tx-candlestick-chart__volume{fill:currentColor;fill-opacity:var(--tx-chart-candlestick-volume-opacity)}:host([data-styled]) .tx-candlestick-chart__wick,:host([data-styled]) .tx-candlestick-chart__tick{stroke-width:var(--tx-chart-candlestick-wick-width)}:host([data-styled]) .tx-candlestick-chart__body{clip-path:inset(0 round var(--tx-chart-candlestick-body-radius))}:host([data-styled]) .tx-candlestick-chart__crosshair{stroke:var(--tx-chart-crosshair-color);stroke-width:var(--tx-chart-crosshair-width);stroke-dasharray:var(--tx-chart-crosshair-dash)}:host([data-styled]) .tx-candlestick-chart__candle{transition:opacity var(--tx-chart-motion-hover-duration) ease}:host([data-styled][data-variant=ohlc]) .tx-candlestick-chart__tick,:host([data-styled][data-variant=ohlc]) .tx-candlestick-chart__wick{stroke-width:calc(var(--tx-chart-candlestick-wick-width) * 1.4)}:host([data-styled].tx-candlestick-chart--active) .tx-candlestick-chart__candle:not(.tx-candlestick-chart__candle--active){opacity:var(--tx-chart-candlestick-dimmed-opacity)}:host([data-styled].tx-candlestick-chart--entering) .tx-candlestick-chart__candle{animation:tx-candlestick-chart-grow var(--tx-chart-motion-enter-duration) var(--tx-chart-motion-easing) both;animation-delay:calc(min(var(--tx-candlestick-chart-order, 0),40) * var(--tx-chart-motion-stagger) * .5)}:host([data-styled].tx-candlestick-chart--entering) .tx-candlestick-chart__volumes{animation:tx-candlestick-chart-fade var(--tx-chart-motion-enter-duration) ease both}@keyframes tx-candlestick-chart-grow{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}@keyframes tx-candlestick-chart-fade{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){:host([data-styled]) .tx-candlestick-chart__candle,:host([data-styled]) .tx-candlestick-chart__volumes{transition:none;animation:none}}\n"]
|
|
598
|
+
}]
|
|
599
|
+
}],
|
|
600
|
+
ctorParameters: () => [],
|
|
601
|
+
propDecorators: {
|
|
602
|
+
data: [{
|
|
603
|
+
type: i0.Input,
|
|
604
|
+
args: [{
|
|
605
|
+
isSignal: true,
|
|
606
|
+
alias: "data",
|
|
607
|
+
required: false
|
|
608
|
+
}]
|
|
609
|
+
}],
|
|
610
|
+
variant: [{
|
|
611
|
+
type: i0.Input,
|
|
612
|
+
args: [{
|
|
613
|
+
isSignal: true,
|
|
614
|
+
alias: "variant",
|
|
615
|
+
required: false
|
|
616
|
+
}]
|
|
617
|
+
}],
|
|
618
|
+
showVolume: [{
|
|
619
|
+
type: i0.Input,
|
|
620
|
+
args: [{
|
|
621
|
+
isSignal: true,
|
|
622
|
+
alias: "showVolume",
|
|
623
|
+
required: false
|
|
624
|
+
}]
|
|
625
|
+
}],
|
|
626
|
+
height: [{
|
|
627
|
+
type: i0.Input,
|
|
628
|
+
args: [{
|
|
629
|
+
isSignal: true,
|
|
630
|
+
alias: "height",
|
|
631
|
+
required: false
|
|
632
|
+
}]
|
|
633
|
+
}],
|
|
634
|
+
showTooltip: [{
|
|
635
|
+
type: i0.Input,
|
|
636
|
+
args: [{
|
|
637
|
+
isSignal: true,
|
|
638
|
+
alias: "showTooltip",
|
|
639
|
+
required: false
|
|
640
|
+
}]
|
|
641
|
+
}],
|
|
642
|
+
valueFormat: [{
|
|
643
|
+
type: i0.Input,
|
|
644
|
+
args: [{
|
|
645
|
+
isSignal: true,
|
|
646
|
+
alias: "valueFormat",
|
|
647
|
+
required: false
|
|
648
|
+
}]
|
|
649
|
+
}],
|
|
650
|
+
volumeFormat: [{
|
|
651
|
+
type: i0.Input,
|
|
652
|
+
args: [{
|
|
653
|
+
isSignal: true,
|
|
654
|
+
alias: "volumeFormat",
|
|
655
|
+
required: false
|
|
656
|
+
}]
|
|
657
|
+
}],
|
|
658
|
+
yMin: [{
|
|
659
|
+
type: i0.Input,
|
|
660
|
+
args: [{
|
|
661
|
+
isSignal: true,
|
|
662
|
+
alias: "yMin",
|
|
663
|
+
required: false
|
|
664
|
+
}]
|
|
665
|
+
}],
|
|
666
|
+
yMax: [{
|
|
667
|
+
type: i0.Input,
|
|
668
|
+
args: [{
|
|
669
|
+
isSignal: true,
|
|
670
|
+
alias: "yMax",
|
|
671
|
+
required: false
|
|
672
|
+
}]
|
|
673
|
+
}],
|
|
674
|
+
yAxisTitle: [{
|
|
675
|
+
type: i0.Input,
|
|
676
|
+
args: [{
|
|
677
|
+
isSignal: true,
|
|
678
|
+
alias: "yAxisTitle",
|
|
679
|
+
required: false
|
|
680
|
+
}]
|
|
681
|
+
}],
|
|
682
|
+
grid: [{
|
|
683
|
+
type: i0.Input,
|
|
684
|
+
args: [{
|
|
685
|
+
isSignal: true,
|
|
686
|
+
alias: "grid",
|
|
687
|
+
required: false
|
|
688
|
+
}]
|
|
689
|
+
}],
|
|
690
|
+
labelMode: [{
|
|
691
|
+
type: i0.Input,
|
|
692
|
+
args: [{
|
|
693
|
+
isSignal: true,
|
|
694
|
+
alias: "labelMode",
|
|
695
|
+
required: false
|
|
696
|
+
}]
|
|
697
|
+
}],
|
|
698
|
+
yAxisPosition: [{
|
|
699
|
+
type: i0.Input,
|
|
700
|
+
args: [{
|
|
701
|
+
isSignal: true,
|
|
702
|
+
alias: "yAxisPosition",
|
|
703
|
+
required: false
|
|
704
|
+
}]
|
|
705
|
+
}],
|
|
706
|
+
toolbar: [{
|
|
707
|
+
type: i0.Input,
|
|
708
|
+
args: [{
|
|
709
|
+
isSignal: true,
|
|
710
|
+
alias: "toolbar",
|
|
711
|
+
required: false
|
|
712
|
+
}]
|
|
713
|
+
}],
|
|
714
|
+
loading: [{
|
|
715
|
+
type: i0.Input,
|
|
716
|
+
args: [{
|
|
717
|
+
isSignal: true,
|
|
718
|
+
alias: "loading",
|
|
719
|
+
required: false
|
|
720
|
+
}]
|
|
721
|
+
}],
|
|
722
|
+
ariaLabel: [{
|
|
723
|
+
type: i0.Input,
|
|
724
|
+
args: [{
|
|
725
|
+
isSignal: true,
|
|
726
|
+
alias: "ariaLabel",
|
|
727
|
+
required: false
|
|
728
|
+
}]
|
|
729
|
+
}],
|
|
730
|
+
dt: [{
|
|
731
|
+
type: i0.Input,
|
|
732
|
+
args: [{
|
|
733
|
+
isSignal: true,
|
|
734
|
+
alias: "dt",
|
|
735
|
+
required: false
|
|
736
|
+
}]
|
|
737
|
+
}],
|
|
738
|
+
pt: [{
|
|
739
|
+
type: i0.Input,
|
|
740
|
+
args: [{
|
|
741
|
+
isSignal: true,
|
|
742
|
+
alias: "pt",
|
|
743
|
+
required: false
|
|
744
|
+
}]
|
|
745
|
+
}],
|
|
746
|
+
ptOptions: [{
|
|
747
|
+
type: i0.Input,
|
|
748
|
+
args: [{
|
|
749
|
+
isSignal: true,
|
|
750
|
+
alias: "ptOptions",
|
|
751
|
+
required: false
|
|
752
|
+
}]
|
|
753
|
+
}],
|
|
754
|
+
unstyled: [{
|
|
755
|
+
type: i0.Input,
|
|
756
|
+
args: [{
|
|
757
|
+
isSignal: true,
|
|
758
|
+
alias: "unstyled",
|
|
759
|
+
required: false
|
|
760
|
+
}]
|
|
761
|
+
}],
|
|
762
|
+
candleClick: [{
|
|
763
|
+
type: i0.Output,
|
|
764
|
+
args: ["candleClick"]
|
|
765
|
+
}],
|
|
766
|
+
tooltipTemplate: [{
|
|
767
|
+
type: i0.ContentChild,
|
|
768
|
+
args: [i0.forwardRef(() => TxChartTooltipTemplate), { isSignal: true }]
|
|
769
|
+
}],
|
|
770
|
+
frame: [{
|
|
771
|
+
type: i0.ViewChild,
|
|
772
|
+
args: [i0.forwardRef(() => TxChartFrame), { isSignal: true }]
|
|
773
|
+
}]
|
|
774
|
+
}
|
|
775
|
+
});
|
|
776
|
+
export { TxCandlestickChart, candleExtent, candleLabels, candleTimes, isUp };
|
|
777
|
+
|
|
778
|
+
//# sourceMappingURL=tectra-ng-charts-candlestick.mjs.map
|