tvcharts 0.9.22 → 0.9.24

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/index.js CHANGED
@@ -51,7 +51,7 @@ export * from './lib/export/core.js';
51
51
  // not included in this list.
52
52
  // ----------------------------------------------
53
53
  import { SVGRenderer, CanvasRenderer } from './lib/export/renderers.js';
54
- import { LineChart, BarChart, PieChart, ScatterChart, RadarChart, MapChart, TreeChart, TreemapChart, GraphChart, GaugeChart, FunnelChart, ParallelChart, SankeyChart, BoxplotChart, CandlestickChart, EffectScatterChart, LinesChart, LinesPlotChart, StrategyChart, PlaybackOrderChart, MineLinesChart, MinePolyLinesChart, LineFillsChart, CharPlotChart, BoxesChart, LabelsChart, HLinesChart, ArrowsPlotChart, CandlePlotChart, BarPlotChart, FillsChart, BgColorChart, HeatmapChart, PictorialBarChart, ThemeRiverChart, SunburstChart, CustomChart } from './lib/export/charts.js';
54
+ import { LineChart, BarChart, PieChart, ScatterChart, RadarChart, MapChart, TreeChart, TreemapChart, GraphChart, GaugeChart, FunnelChart, ParallelChart, SankeyChart, BoxplotChart, CandlestickChart, EffectScatterChart, LinesChart, LinesPlotChart, StrategyChart, PlaybackOrderChart, MineLinesChart, MinePolyLinesChart, LineFillsChart, CharPlotChart, BoxesChart, LabelsChart, HLinesChart, ArrowsPlotChart, CandlePlotChart, HeikinAshiChart, BarPlotChart, FillsChart, BgColorChart, HeatmapChart, PictorialBarChart, ThemeRiverChart, SunburstChart, CustomChart } from './lib/export/charts.js';
55
55
  import { GridComponent, PolarComponent, GeoComponent, SingleAxisComponent, ParallelComponent, CalendarComponent, GraphicComponent, ToolboxComponent, TooltipComponent, AxisPointerComponent, BrushComponent, TitleComponent, EventsComponent, LimitTipComponent, CursorPointerComponent, TableComponent, AlarmComponent, BgRectComponent, PlaybackComponent, LogoComponent, TimelineComponent, MarkPointComponent, MarkLineComponent, MarkAreaComponent, MarkLabelComponent, LegendComponent, DataZoomComponent, DataZoomInsideComponent, DataZoomSliderComponent, VisualMapComponent, VisualMapContinuousComponent, VisualMapPiecewiseComponent, AriaComponent, DatasetComponent, TransformComponent } from './lib/export/components.js';
56
56
  import { UniversalTransition, LabelLayout } from './lib/export/features.js';
57
57
  // -----------------
@@ -72,7 +72,7 @@ use([SVGRenderer]);
72
72
  // type: 'line' // or 'bar', 'pie', ...
73
73
  // }]
74
74
  // });
75
- use([LineChart, BarChart, PieChart, ScatterChart, RadarChart, MapChart, TreeChart, TreemapChart, GraphChart, GaugeChart, FunnelChart, ParallelChart, SankeyChart, BoxplotChart, CharPlotChart, CandlestickChart, EffectScatterChart, LinesChart, LinesPlotChart, StrategyChart, PlaybackOrderChart, MineLinesChart, MinePolyLinesChart, LineFillsChart, BoxesChart, LabelsChart, ArrowsPlotChart, CandlePlotChart, BarPlotChart, HLinesChart, BgColorChart, FillsChart, HeatmapChart, PictorialBarChart, ThemeRiverChart, SunburstChart, CustomChart]);
75
+ use([LineChart, BarChart, PieChart, ScatterChart, RadarChart, MapChart, TreeChart, TreemapChart, GraphChart, GaugeChart, FunnelChart, ParallelChart, SankeyChart, BoxplotChart, CharPlotChart, CandlestickChart, EffectScatterChart, LinesChart, LinesPlotChart, StrategyChart, PlaybackOrderChart, MineLinesChart, MinePolyLinesChart, LineFillsChart, BoxesChart, LabelsChart, ArrowsPlotChart, CandlePlotChart, HeikinAshiChart, BarPlotChart, HLinesChart, BgColorChart, FillsChart, HeatmapChart, PictorialBarChart, ThemeRiverChart, SunburstChart, CustomChart]);
76
76
  // -------------------
77
77
  // Coordinate systems
78
78
  // -------------------
@@ -0,0 +1,235 @@
1
+
2
+ /*
3
+ * Licensed to the Apache Software Foundation (ASF) under one
4
+ * or more contributor license agreements. See the NOTICE file
5
+ * distributed with this work for additional information
6
+ * regarding copyright ownership. The ASF licenses this file
7
+ * to you under the Apache License, Version 2.0 (the
8
+ * "License"); you may not use this file except in compliance
9
+ * with the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing,
14
+ * software distributed under the License is distributed on an
15
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ * KIND, either express or implied. See the License for the
17
+ * specific language governing permissions and limitations
18
+ * under the License.
19
+ */
20
+
21
+
22
+ /**
23
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
24
+ */
25
+
26
+ /*
27
+ * Licensed to the Apache Software Foundation (ASF) under one
28
+ * or more contributor license agreements. See the NOTICE file
29
+ * distributed with this work for additional information
30
+ * regarding copyright ownership. The ASF licenses this file
31
+ * to you under the Apache License, Version 2.0 (the
32
+ * "License"); you may not use this file except in compliance
33
+ * with the License. You may obtain a copy of the License at
34
+ *
35
+ * http://www.apache.org/licenses/LICENSE-2.0
36
+ *
37
+ * Unless required by applicable law or agreed to in writing,
38
+ * software distributed under the License is distributed on an
39
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
40
+ * KIND, either express or implied. See the License for the
41
+ * specific language governing permissions and limitations
42
+ * under the License.
43
+ */
44
+ import { subPixelOptimize } from '../../util/graphic.js';
45
+ import createRenderPlanner from '../helper/createRenderPlanner.js';
46
+ import { map } from 'tvrender/lib/core/util.js';
47
+ import { isMobileRender } from "../../util/mobile.js";
48
+ var positiveBorderColorQuery = ['itemStyle', 'borderColor'];
49
+ var negativeBorderColorQuery = ['itemStyle', 'borderColor0'];
50
+ var dojiBorderColorQuery = ['itemStyle', 'borderColorDoji'];
51
+ var positiveColorQuery = ['itemStyle', 'color'];
52
+ var negativeColorQuery = ['itemStyle', 'color0'];
53
+ var positiveWickColorQuery = ['itemStyle', 'wickColor'];
54
+ var negativeWickColorQuery = ['itemStyle', 'wickColor0'];
55
+ function getColor(sign, model, ignoreParentColor) {
56
+ return model.get(sign > 0 ? positiveColorQuery : negativeColorQuery, ignoreParentColor);
57
+ }
58
+ function getBorderColor(sign, model, ignoreParentColor) {
59
+ return model.get(sign === 0 ? dojiBorderColorQuery : sign > 0 ? positiveBorderColorQuery : negativeBorderColorQuery, ignoreParentColor);
60
+ }
61
+ function getWickColor(sign, model, ignoreParentColor) {
62
+ return model.get(sign > 0 ? positiveWickColorQuery : negativeWickColorQuery, ignoreParentColor);
63
+ }
64
+ var heikinAshiLayout = {
65
+ seriesType: 'heikinAshi',
66
+ plan: createRenderPlanner(),
67
+ reset: function (seriesModel) {
68
+ var coordSys = seriesModel.coordinateSystem;
69
+ var data = seriesModel.getData();
70
+ var candleWidth = calculateCandleWidth(seriesModel, data);
71
+ var cDimIdx = 0;
72
+ var vDimIdx = 1;
73
+ var coordDims = ['x', 'y'];
74
+ var cDimI = data.getDimensionIndex(data.mapDimension(coordDims[cDimIdx]));
75
+ var vDimsI = map(data.mapDimensionsAll(coordDims[vDimIdx]), data.getDimensionIndex, data);
76
+ var openDimI = vDimsI[0];
77
+ var closeDimI = vDimsI[1];
78
+ var lowestDimI = vDimsI[2];
79
+ var highestDimI = vDimsI[3];
80
+ var isSimpleBox = candleWidth <= 1.3;
81
+ if (cDimI < 0 || vDimsI.length < 4) {
82
+ return;
83
+ }
84
+ var showLast = seriesModel.get('showLast');
85
+ var ignoreParentColor = seriesModel.get('ignoreParentColor');
86
+ var signByPrev = seriesModel.get('signByPrev');
87
+ var offsetX = isMobileRender ? 0 : 0.5;
88
+ var formatY = isMobileRender ? function (y) {
89
+ return y;
90
+ } : function (y) {
91
+ return Math.floor(y);
92
+ };
93
+ return {
94
+ progress: normalProgress
95
+ };
96
+ function normalProgress(params, candleData) {
97
+ var store = candleData.getStore();
98
+ var bodyPointsByColor = {};
99
+ var wickPointsByColor = {};
100
+ var lastIndex = candleData.count(true) - 1;
101
+ for (var dataIndex = params.start; dataIndex < params.end; dataIndex++) {
102
+ if (showLast && lastIndex - candleData.getRawIndex(dataIndex) >= showLast) {
103
+ continue;
104
+ }
105
+ var axisDimVal = store.get(cDimI, dataIndex);
106
+ var openVal = store.get(openDimI, dataIndex);
107
+ var closeVal = store.get(closeDimI, dataIndex);
108
+ var lowestVal = store.get(lowestDimI, dataIndex);
109
+ var highestVal = store.get(highestDimI, dataIndex);
110
+ var ocLow = Math.min(openVal, closeVal);
111
+ var ocHigh = Math.max(openVal, closeVal);
112
+ var _a = coordSys.dataToPoint([axisDimVal, ocLow]),
113
+ ocLowX = _a[0],
114
+ ocLowY = _a[1];
115
+ var x = ocLowX + offsetX;
116
+ var ocLowPoint = [x, formatY(ocLowY)];
117
+ var ocHighPoint = coordSys.dataToPoint([axisDimVal, ocHigh]);
118
+ ocHighPoint[0] = x;
119
+ ocHighPoint[1] = formatY(ocHighPoint[1]);
120
+ var lowestPoint = coordSys.dataToPoint([axisDimVal, lowestVal]);
121
+ lowestPoint[0] = x;
122
+ lowestPoint[1] = formatY(lowestPoint[1]);
123
+ var highestPoint = coordSys.dataToPoint([axisDimVal, highestVal]);
124
+ highestPoint[0] = x;
125
+ highestPoint[1] = formatY(highestPoint[1]);
126
+ var itemModel = candleData.getItemModel(dataIndex);
127
+ // const hasDojiColor = !!itemModel.get(['itemStyle', 'borderColorDoji']);
128
+ var sign = getSign(store, dataIndex, openVal, closeVal, closeDimI, signByPrev);
129
+ var color = getColor(sign, itemModel, ignoreParentColor);
130
+ var border = getBorderColor(sign, itemModel, ignoreParentColor);
131
+ if (!color && !border) {
132
+ continue;
133
+ }
134
+ var key = (color || 'none') + ":" + (border || 'none');
135
+ var bodyPoints = bodyPointsByColor[key] || [];
136
+ if (isSimpleBox) {
137
+ bodyPoints.push(ocHighPoint, lowestPoint);
138
+ } else {
139
+ addBodyEnd(bodyPoints, ocHighPoint, 0);
140
+ addBodyEnd(bodyPoints, ocLowPoint, 1);
141
+ }
142
+ bodyPointsByColor[key] = bodyPoints;
143
+ var wickKey = getWickColor(sign, itemModel, ignoreParentColor);
144
+ if (wickKey) {
145
+ var wickPoint = wickPointsByColor[wickKey] || [];
146
+ wickPoint.push(highestPoint, ocHighPoint, lowestPoint, ocLowPoint);
147
+ wickPointsByColor[wickKey] = wickPoint;
148
+ }
149
+ }
150
+ candleData.setLayout({
151
+ bodyPointsByColor: bodyPointsByColor,
152
+ wickPointsByColor: wickPointsByColor,
153
+ isSimpleBox: isSimpleBox
154
+ });
155
+ function addBodyEnd(ends, point, start) {
156
+ var point1 = point.slice();
157
+ var point2 = point.slice();
158
+ // point1[cDimIdx] = subPixelOptimize(
159
+ // point1[cDimIdx] + candleWidth / 2, 1, false
160
+ // );
161
+ // point2[cDimIdx] = subPixelOptimize(
162
+ // point2[cDimIdx] - candleWidth / 2, 1, true
163
+ // );
164
+ point1[0] = point1[0] - Math.floor(candleWidth * 0.5);
165
+ point2[0] = point1[0] + candleWidth;
166
+ point1[1] += 0.5;
167
+ point2[1] += 0.5;
168
+ start ? ends.push(point1, point2) : ends.push(point2, point1);
169
+ }
170
+ function subPixelOptimizePoint(point) {
171
+ point[cDimIdx] = subPixelOptimize(point[cDimIdx], 1);
172
+ return point;
173
+ }
174
+ }
175
+ }
176
+ };
177
+ /**
178
+ * Get the sign of a single data.
179
+ *
180
+ * @returns 0 for doji with hasDojiColor: true,
181
+ * 1 for positive,
182
+ * -1 for negative.
183
+ */
184
+ function getSign(store, dataIndex, openVal, closeVal, closeDimI, signByPrev) {
185
+ var sign;
186
+ if (signByPrev) {
187
+ var index = store.getRawIndex(dataIndex);
188
+ if (index > 0) return store.getByRawIndex(closeDimI, index - 1) <= closeVal ? 1 : -1;
189
+ }
190
+ if (openVal > closeVal) {
191
+ sign = -1;
192
+ } else if (openVal <= closeVal) {
193
+ sign = 1;
194
+ }
195
+ return sign;
196
+ }
197
+ // export function optimalCandlestickWidth(barSpacing: number, pixelRatio: number): number {
198
+ // const barSpacingSpecialCaseFrom = 2.5;
199
+ // const barSpacingSpecialCaseTo = 4;
200
+ // const barSpacingSpecialCaseCoeff = 3;
201
+ // if (barSpacing >= barSpacingSpecialCaseFrom && barSpacing <= barSpacingSpecialCaseTo) {
202
+ // return Math.floor(barSpacingSpecialCaseCoeff * pixelRatio);
203
+ // }
204
+ // else if (barSpacing > barSpacingSpecialCaseTo && barSpacing <= 7.5) {
205
+ // return Math.floor(Math.max(barSpacing * 0.72, 1));
206
+ // }
207
+ // // coeff should be 1 on small barspacing and go to 0.8 while groing bar spacing
208
+ // const barSpacingReducingCoeff = 0.2;
209
+ // const coeff = 1 - barSpacingReducingCoeff * Math.atan(Math.max(barSpacingSpecialCaseTo, barSpacing) - barSpacingSpecialCaseTo) / (Math.PI * 0.5);
210
+ // const res = Math.floor(barSpacing * coeff * pixelRatio);
211
+ // const scaledBarSpacing = Math.floor(barSpacing * pixelRatio);
212
+ // const optimal = Math.min(res, scaledBarSpacing);
213
+ // return Math.max(Math.floor(pixelRatio), optimal);
214
+ // }
215
+ function calculateCandleWidth(seriesModel, data) {
216
+ var baseAxis = seriesModel.getBaseAxis();
217
+ var extent;
218
+ var bandWidth = baseAxis.type === 'category' ? baseAxis.getBandWidth() : (extent = baseAxis.getExtent(), Math.abs(extent[1] - extent[0]) / data.count());
219
+ var width = optimalCandlestickWidth(bandWidth, 1);
220
+ return width >= 2 && width % 2 === 1 ? width - 1 : width;
221
+ // return Math.floor(Math.max(bandWidth * 0.7, 1));
222
+ }
223
+
224
+ function optimalCandlestickWidth(barSpacing, pixelRatio) {
225
+ if (barSpacing >= 2.5 && barSpacing <= 4) return Math.floor(3 * pixelRatio) - 1;
226
+ var n = 1 - .2 * Math.atan(Math.max(4, barSpacing) - 4) / (.5 * Math.PI),
227
+ i = Math.floor(barSpacing * n * pixelRatio),
228
+ s = Math.floor(barSpacing * pixelRatio),
229
+ r = Math.min(i, s - 1, Math.round(barSpacing - 2));
230
+ return Math.max(Math.floor(pixelRatio), r);
231
+ }
232
+ export function getRenderIndexX(bandWidth, x) {
233
+ return subPixelOptimize(x - bandWidth / 2, 1, false);
234
+ }
235
+ export default heikinAshiLayout;
@@ -0,0 +1,149 @@
1
+
2
+ /*
3
+ * Licensed to the Apache Software Foundation (ASF) under one
4
+ * or more contributor license agreements. See the NOTICE file
5
+ * distributed with this work for additional information
6
+ * regarding copyright ownership. The ASF licenses this file
7
+ * to you under the Apache License, Version 2.0 (the
8
+ * "License"); you may not use this file except in compliance
9
+ * with the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing,
14
+ * software distributed under the License is distributed on an
15
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ * KIND, either express or implied. See the License for the
17
+ * specific language governing permissions and limitations
18
+ * under the License.
19
+ */
20
+
21
+
22
+ /**
23
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
24
+ */
25
+
26
+ /*
27
+ * Licensed to the Apache Software Foundation (ASF) under one
28
+ * or more contributor license agreements. See the NOTICE file
29
+ * distributed with this work for additional information
30
+ * regarding copyright ownership. The ASF licenses this file
31
+ * to you under the Apache License, Version 2.0 (the
32
+ * "License"); you may not use this file except in compliance
33
+ * with the License. You may obtain a copy of the License at
34
+ *
35
+ * http://www.apache.org/licenses/LICENSE-2.0
36
+ *
37
+ * Unless required by applicable law or agreed to in writing,
38
+ * software distributed under the License is distributed on an
39
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
40
+ * KIND, either express or implied. See the License for the
41
+ * specific language governing permissions and limitations
42
+ * under the License.
43
+ */
44
+ import { __extends } from "tslib";
45
+ import SeriesModel from '../../model/Series.js';
46
+ import { WhiskerBoxCommonMixin } from '../helper/whiskerBoxCommon.js';
47
+ import { mixin } from 'tvrender/lib/core/util.js';
48
+ var HeikinAshiSeriesModel = /** @class */function (_super) {
49
+ __extends(HeikinAshiSeriesModel, _super);
50
+ function HeikinAshiSeriesModel() {
51
+ var _this = _super !== null && _super.apply(this, arguments) || this;
52
+ _this.type = HeikinAshiSeriesModel.type;
53
+ _this.notAddOrdinal = true;
54
+ _this.ignoreStyleOnData = true;
55
+ _this.defaultValueDimensions = [{
56
+ name: 'open',
57
+ defaultTooltip: true
58
+ }, {
59
+ name: 'close',
60
+ defaultTooltip: true
61
+ }, {
62
+ name: 'lowest',
63
+ defaultTooltip: true
64
+ }, {
65
+ name: 'highest',
66
+ defaultTooltip: true
67
+ }, {
68
+ name: 'realclose',
69
+ defaultTooltip: false
70
+ }];
71
+ return _this;
72
+ // brushSelector(
73
+ // dataIndex: number,
74
+ // data: SeriesData,
75
+ // selectors: BrushCommonSelectorsForSeries
76
+ // ): boolean {
77
+ // const itemLayout = data.getItemLayout(dataIndex);
78
+ // return itemLayout && selectors.rect(itemLayout.brushRect);
79
+ // }
80
+ // getFilterDataDims() {
81
+ // return [
82
+ // { name: 'base' },
83
+ // {
84
+ // name: 'lowest',
85
+ // contrastFn: (val: number, min: number, max: number) => !(val > max)
86
+ // },
87
+ // {
88
+ // name: 'highest',
89
+ // contrastFn: (val: number, min: number, max: number) => !(val < min)
90
+ // }
91
+ // ];
92
+ // }
93
+ }
94
+ /**
95
+ * Get dimension for shadow in dataZoom
96
+ * @return dimension name
97
+ */
98
+ HeikinAshiSeriesModel.prototype.getShadowDim = function () {
99
+ return 'open';
100
+ };
101
+ HeikinAshiSeriesModel.type = 'series.heikinAshi';
102
+ HeikinAshiSeriesModel.dependencies = ['xAxis', 'yAxis', 'grid'];
103
+ HeikinAshiSeriesModel.defaultOption = {
104
+ // zlevel: 0,
105
+ z: 2,
106
+ coordinateSystem: 'cartesian2d',
107
+ legendHoverLink: true,
108
+ // xAxisIndex: 0,
109
+ // yAxisIndex: 0,
110
+ layout: null,
111
+ clip: true,
112
+ itemStyle: {
113
+ color: '#eb5454',
114
+ color0: '#47b262',
115
+ borderColor: '#eb5454',
116
+ borderColor0: '#47b262',
117
+ wickColor: '#eb5454',
118
+ wickColor0: '#47b262',
119
+ borderColorDoji: null,
120
+ borderWidth: 1
121
+ },
122
+ baseDim: 'close',
123
+ emphasis: {
124
+ emphasisState: {
125
+ // hoverLayer: true,
126
+ zlevel: 1
127
+ }
128
+ // scale: true,
129
+ // itemStyle: {
130
+ // borderWidth: 2
131
+ // }
132
+ },
133
+
134
+ barMaxWidth: null,
135
+ barMinWidth: null,
136
+ barWidth: null,
137
+ large: true,
138
+ largeThreshold: 600,
139
+ progressive: 3e3,
140
+ progressiveThreshold: 1e4,
141
+ progressiveChunkMode: 'mod',
142
+ animationEasing: 'linear',
143
+ animationDuration: 300,
144
+ ignoreParentColor: false
145
+ };
146
+ return HeikinAshiSeriesModel;
147
+ }(SeriesModel);
148
+ mixin(HeikinAshiSeriesModel, WhiskerBoxCommonMixin, true);
149
+ export default HeikinAshiSeriesModel;
@@ -0,0 +1,143 @@
1
+
2
+ /*
3
+ * Licensed to the Apache Software Foundation (ASF) under one
4
+ * or more contributor license agreements. See the NOTICE file
5
+ * distributed with this work for additional information
6
+ * regarding copyright ownership. The ASF licenses this file
7
+ * to you under the Apache License, Version 2.0 (the
8
+ * "License"); you may not use this file except in compliance
9
+ * with the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing,
14
+ * software distributed under the License is distributed on an
15
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ * KIND, either express or implied. See the License for the
17
+ * specific language governing permissions and limitations
18
+ * under the License.
19
+ */
20
+
21
+
22
+ /**
23
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
24
+ */
25
+
26
+ /*
27
+ * Licensed to the Apache Software Foundation (ASF) under one
28
+ * or more contributor license agreements. See the NOTICE file
29
+ * distributed with this work for additional information
30
+ * regarding copyright ownership. The ASF licenses this file
31
+ * to you under the Apache License, Version 2.0 (the
32
+ * "License"); you may not use this file except in compliance
33
+ * with the License. You may obtain a copy of the License at
34
+ *
35
+ * http://www.apache.org/licenses/LICENSE-2.0
36
+ *
37
+ * Unless required by applicable law or agreed to in writing,
38
+ * software distributed under the License is distributed on an
39
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
40
+ * KIND, either express or implied. See the License for the
41
+ * specific language governing permissions and limitations
42
+ * under the License.
43
+ */
44
+ import { __extends } from "tslib";
45
+ import * as zrUtil from 'tvrender/lib/core/util.js';
46
+ import ChartView from '../../view/Chart.js';
47
+ import { createClipPath } from '../helper/createClipPathFromCoordSys.js';
48
+ import NormalBoxPath from '../candlePlot/NormalBoxPath.js';
49
+ import WickPath from '../candlePlot/WickPath.js';
50
+ // const SKIP_PROPS = ['color', 'borderColor'] as const;
51
+ var HeikinAshiView = /** @class */function (_super) {
52
+ __extends(HeikinAshiView, _super);
53
+ function HeikinAshiView() {
54
+ var _this = _super !== null && _super.apply(this, arguments) || this;
55
+ _this.type = HeikinAshiView.type;
56
+ return _this;
57
+ }
58
+ HeikinAshiView.prototype.render = function (seriesModel, ecModel, api) {
59
+ // If there is clipPath created in large mode. Remove it.
60
+ // this.group.removeClipPath();
61
+ // Clear previously rendered progressive elements.
62
+ this._progressiveEls = null;
63
+ // this._updateDrawMode(seriesModel);
64
+ this._renderNormal(seriesModel);
65
+ };
66
+ // eachRendered(cb: (el: Element) => boolean | void) {
67
+ // graphic.traverseElements(this._progressiveEls || this.group, cb);
68
+ // }
69
+ HeikinAshiView.prototype._renderNormal = function (seriesModel) {
70
+ var data = seriesModel.getData();
71
+ // const oldData = this._data;
72
+ var group = this.group;
73
+ group.removeAll();
74
+ var emphasisState = seriesModel.get('emphasis').emphasisState;
75
+ var info = seriesModel.get('info');
76
+ var groupId = seriesModel.get('groupId');
77
+ // const emphasisStyle = emphasis.itemStyle || {};
78
+ var isSimpleBox = data.getLayout('isSimpleBox');
79
+ var bodyPointsByColor = data.getLayout('bodyPointsByColor');
80
+ var wickPointsByColor = data.getLayout('wickPointsByColor');
81
+ var isMobile = seriesModel.get('isMobile');
82
+ zrUtil.each(wickPointsByColor, function (points, key) {
83
+ var stroke = key.split(':')[0];
84
+ var el = new WickPath({
85
+ shape: {
86
+ points: points,
87
+ isMobile: isMobile,
88
+ stroke: stroke !== 'none' ? stroke : ''
89
+ },
90
+ style: {
91
+ stroke: stroke
92
+ }
93
+ });
94
+ el.states.emphasis = emphasisState;
95
+ el.info = info;
96
+ group.add(el);
97
+ });
98
+ zrUtil.each(bodyPointsByColor, function (points, key) {
99
+ var _a = key.split(':'),
100
+ fill = _a[0],
101
+ stroke = _a[1];
102
+ var el = new NormalBoxPath({
103
+ shape: {
104
+ points: points,
105
+ isSimpleBox: isSimpleBox,
106
+ fill: fill !== 'none' ? fill : '',
107
+ isMobile: isMobile,
108
+ // stroke: !isSimpleBox || stroke === 'none' ? '' : stroke,
109
+ stroke: stroke === 'none' ? '' : stroke
110
+ },
111
+ style: {
112
+ fill: isSimpleBox ? 'none' : fill,
113
+ // stroke: 'none',
114
+ stroke: stroke
115
+ }
116
+ });
117
+ group.add(el);
118
+ el.states.emphasis = emphasisState;
119
+ el.info = info;
120
+ });
121
+ // const coordSys = seriesModel.coordinateSystem;
122
+ var clipPath = seriesModel.get('clip', true) ? createClipPath(seriesModel.coordinateSystem, false, seriesModel) : null;
123
+ if (clipPath) {
124
+ this.group.setClipPath(clipPath);
125
+ } else {
126
+ this.group.removeClipPath();
127
+ }
128
+ // toggleHoverEmphasis(this.group, null, null, false);
129
+ // getECData(this.group).groupId = groupId;
130
+ };
131
+
132
+ HeikinAshiView.prototype.remove = function (ecModel) {
133
+ this._clear();
134
+ };
135
+ HeikinAshiView.prototype._clear = function () {
136
+ this.group.removeAll();
137
+ // this._data = null;
138
+ };
139
+
140
+ HeikinAshiView.type = 'heikinAshi';
141
+ return HeikinAshiView;
142
+ }(ChartView);
143
+ export default HeikinAshiView;
@@ -0,0 +1,51 @@
1
+
2
+ /*
3
+ * Licensed to the Apache Software Foundation (ASF) under one
4
+ * or more contributor license agreements. See the NOTICE file
5
+ * distributed with this work for additional information
6
+ * regarding copyright ownership. The ASF licenses this file
7
+ * to you under the Apache License, Version 2.0 (the
8
+ * "License"); you may not use this file except in compliance
9
+ * with the License. You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing,
14
+ * software distributed under the License is distributed on an
15
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ * KIND, either express or implied. See the License for the
17
+ * specific language governing permissions and limitations
18
+ * under the License.
19
+ */
20
+
21
+
22
+ /**
23
+ * AUTO-GENERATED FILE. DO NOT MODIFY.
24
+ */
25
+
26
+ /*
27
+ * Licensed to the Apache Software Foundation (ASF) under one
28
+ * or more contributor license agreements. See the NOTICE file
29
+ * distributed with this work for additional information
30
+ * regarding copyright ownership. The ASF licenses this file
31
+ * to you under the Apache License, Version 2.0 (the
32
+ * "License"); you may not use this file except in compliance
33
+ * with the License. You may obtain a copy of the License at
34
+ *
35
+ * http://www.apache.org/licenses/LICENSE-2.0
36
+ *
37
+ * Unless required by applicable law or agreed to in writing,
38
+ * software distributed under the License is distributed on an
39
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
40
+ * KIND, either express or implied. See the License for the
41
+ * specific language governing permissions and limitations
42
+ * under the License.
43
+ */
44
+ import HeikinAshiView from './heikinAshiView.js';
45
+ import HeikinAshiSeriesModel from './heikinAshiSeries.js';
46
+ import heikinAshiLayout from './heikinAshiLayout.js';
47
+ export function install(registers) {
48
+ registers.registerChartView(HeikinAshiView);
49
+ registers.registerSeriesModel(HeikinAshiSeriesModel);
50
+ registers.registerLayout(heikinAshiLayout);
51
+ }
@@ -110,9 +110,18 @@ var markerTypeCalculator = {
110
110
  var fill = (_a = seriesData.getItemVisual(lastIndex, 'style')) === null || _a === void 0 ? void 0 : _a.fill;
111
111
  if (isCandle(seriesModel.subType)) {
112
112
  var dataItem = seriesData.getItemModel(lastIndex, true);
113
- var closeValue = seriesData.getByRawIndex('close', lastIndex);
114
- var openValue = seriesData.getByRawIndex('open', lastIndex);
115
- var sign = openValue > closeValue ? -1 : 1;
113
+ var sign = 1;
114
+ if (seriesModel.get('signByPrev') && lastIndex) {
115
+ var openValue = seriesData.getByRawIndex('close', lastIndex - 1);
116
+ var closeValue = seriesData.getByRawIndex('close', lastIndex);
117
+ sign = openValue > closeValue ? -1 : 1;
118
+ } else {
119
+ var closeValue = seriesData.getByRawIndex('close', lastIndex);
120
+ var openValue = seriesData.getByRawIndex('open', lastIndex);
121
+ sign = openValue > closeValue ? -1 : 1;
122
+ }
123
+ // const closeValue = seriesData.getByRawIndex('close', lastIndex);
124
+ // const openValue = seriesData.getByRawIndex('open', lastIndex);
116
125
  fill = dataItem.get(sign > 0 ? positiveColorQuery : negativeColorQuery);
117
126
  if (fill === 'none') {
118
127
  fill = dataItem.get(sign > 0 ? positiveBorderColorQuery : negativeBorderColorQuery);
@@ -152,9 +161,16 @@ var markerTypeCalculator = {
152
161
  fill = formatTextColor(dataItem.get([isLinesPlot ? 'lineStyle' : 'itemStyle', 'color']), height);
153
162
  } else if (isCandle(seriesModel.subType)) {
154
163
  var dataItem = seriesData.getItemModel(lastItem);
155
- var closeValue = seriesData.get('close', lastItem);
156
- var openValue = seriesData.get('open', lastItem);
157
- var sign = openValue > closeValue ? -1 : 1;
164
+ var sign = 1;
165
+ if (seriesModel.get('signByPrev') && lastIndex) {
166
+ var openValue = seriesData.get('close', lastItem - 1);
167
+ var closeValue = seriesData.get('close', lastItem);
168
+ sign = openValue > closeValue ? -1 : 1;
169
+ } else {
170
+ var closeValue = seriesData.get('close', lastItem);
171
+ var openValue = seriesData.get('open', lastItem);
172
+ sign = openValue > closeValue ? -1 : 1;
173
+ }
158
174
  fill = dataItem.get(sign > 0 ? positiveColorQuery : negativeColorQuery);
159
175
  if (fill === 'none') {
160
176
  fill = dataItem.get(sign > 0 ? positiveBorderColorQuery : negativeBorderColorQuery);
@@ -517,7 +533,13 @@ var MarkLabelView = /** @class */function (_super) {
517
533
  var _this = this;
518
534
  var timerMap = this._timerMap;
519
535
  var timer = setTimeout(function () {
520
- item.countDown.value = item.countDown.value - 1;
536
+ if (item.countDown.nextTime) {
537
+ var current_time = Date.now() + (item.countDown.dataTimeDiff || 0) * 1000;
538
+ var countDown = Math.round(item.countDown.nextTime - current_time / 1000);
539
+ item.countDown.value = countDown;
540
+ } else {
541
+ item.countDown.value = item.countDown.value - 1;
542
+ }
521
543
  var text = formatSeconds(item.countDown.value);
522
544
  el.attr('style', {
523
545
  text: text
@@ -80,7 +80,7 @@ import decal from '../visual/decal.js';
80
80
  import lifecycle from './lifecycle.js';
81
81
  import { platformApi, setPlatformAPI } from 'tvrender/lib/core/platform.js';
82
82
  import { getImpl } from './impl.js';
83
- import { isCandle } from '../util/seriesType.js';
83
+ import { isCandle, formatUpdateData } from '../util/seriesType.js';
84
84
  export var version = '5.5.0';
85
85
  export var dependencies = {
86
86
  zrender: '5.5.0'
@@ -1398,18 +1398,19 @@ var ECharts = /** @class */function (_super) {
1398
1398
  console.log("更新下标错误", idx, ordinalMeta, item[0]);
1399
1399
  return;
1400
1400
  }
1401
- var value = item.slice();
1401
+ var formatItem = formatUpdateData(seriesModel, item, idx);
1402
+ var value = formatItem.slice();
1402
1403
  if ((_a = seriesModel.option.data[idx]) === null || _a === void 0 ? void 0 : _a.value) {
1403
1404
  seriesModel.option.data[idx].value = value.length === 1 ? value[0] : value;
1404
- item[0] = idx;
1405
+ formatItem[0] = idx;
1405
1406
  return __assign(__assign({}, seriesModel.option.data[idx]), {
1406
- value: item
1407
+ value: formatItem
1407
1408
  });
1408
1409
  } else {
1409
1410
  seriesModel.option.data[idx] = value.length === 1 ? value[0] : value;
1410
1411
  }
1411
- item[0] = idx;
1412
- return item;
1412
+ formatItem[0] = idx;
1413
+ return formatItem;
1413
1414
  }).filter(Boolean);
1414
1415
  if (dataList.length) {
1415
1416
  seriesModel.updateValue({
@@ -1432,12 +1433,13 @@ var ECharts = /** @class */function (_super) {
1432
1433
  console.log("添加下标错误NaN", item[0], ordinalMeta);
1433
1434
  return;
1434
1435
  }
1436
+ var formatItem = formatUpdateData(seriesModel, item, idx);
1435
1437
  if (isCandletick_1) {
1436
- var value = item.slice();
1438
+ var value = formatItem.slice();
1437
1439
  seriesModel.option.data[idx] = value.length === 1 ? value[0] : value;
1438
1440
  }
1439
- item[0] = idx;
1440
- return item;
1441
+ formatItem[0] = idx;
1442
+ return formatItem;
1441
1443
  }).filter(Boolean);
1442
1444
  if (formatData) {
1443
1445
  seriesModel.appendData({
@@ -72,6 +72,7 @@ export { install as LineFillsChart } from '../chart/lineFills/install.js';
72
72
  export { install as BoxesChart } from '../chart/boxes/install.js';
73
73
  export { install as CharPlotChart } from '../chart/charPlot/install.js';
74
74
  export { install as CandlePlotChart } from '../chart/candlePlot/install.js';
75
+ export { install as HeikinAshiChart } from '../chart/heikinAshi/install.js';
75
76
  export { install as BarPlotChart } from '../chart/barPlot/install.js';
76
77
  export { install as ArrowsPlotChart } from '../chart/arrowsPlot/install.js';
77
78
  export { install as LabelsChart } from '../chart/labels/install.js';
@@ -142,6 +142,7 @@ var BUILTIN_CHARTS_MAP = {
142
142
  fills: 'FillsChart',
143
143
  arrowsPlot: 'ArrowsPlotChart',
144
144
  candlePlot: 'CandlePlotChart',
145
+ heikinAshi: 'HeikinAshiChart',
145
146
  barPlot: 'BarPlotChart',
146
147
  bgcolor: 'BgColorChart',
147
148
  heatmap: 'HeatmapChart',
@@ -23,7 +23,7 @@
23
23
  * AUTO-GENERATED FILE. DO NOT MODIFY.
24
24
  */
25
25
 
26
- var candleArr = ['candlestick', 'candlePlot', 'barPlot'];
26
+ var candleArr = ['candlestick', 'candlePlot', 'barPlot', 'heikinAshi'];
27
27
  function isCandle(type) {
28
28
  return candleArr.includes(type);
29
29
  }
@@ -31,4 +31,32 @@ var plotsArr = ['labels', 'linesPlot', 'charPlot', 'arrowsPlot', 'line'];
31
31
  function isPlot(type) {
32
32
  return plotsArr.includes(type);
33
33
  }
34
- export { isCandle, isPlot };
34
+ function formatUpdateData(seriesModel, item, index) {
35
+ if (seriesModel.subType === 'heikinAshi') {
36
+ var lastData = seriesModel.option.data[index - 1];
37
+ var _a = item,
38
+ time = _a[0],
39
+ o = _a[1],
40
+ c = _a[2],
41
+ l = _a[3],
42
+ h = _a[4];
43
+ if (lastData) {
44
+ var data = lastData.value || lastData;
45
+ var prevDataO = data[1];
46
+ var prevDataC = data[2];
47
+ var hAO = (prevDataO + prevDataC) / 2;
48
+ var hAC = (o + c + h + l) / 4;
49
+ var hAL = Math.min(hAO, hAC, l);
50
+ var hAH = Math.max(hAO, hAC, h);
51
+ return [time, hAO, hAC, hAL, hAH, c];
52
+ } else {
53
+ var hAO = (o + c) / 2;
54
+ var hAC = (o + c + h + l) / 4;
55
+ var hAL = Math.min(hAO, hAC, l);
56
+ var hAH = Math.max(hAO, hAC, h);
57
+ return [time, hAO, hAC, hAL, hAH, c];
58
+ }
59
+ }
60
+ return item;
61
+ }
62
+ export { isCandle, isPlot, formatUpdateData };
@@ -659,10 +659,17 @@ export function getSeriesPointData(ecModel, payload) {
659
659
  var dim = isCandlesStick ? 'close' : 'y';
660
660
  var fnKey = isRaw ? 'getByRawIndex' : 'get';
661
661
  if (isCandlesStick) {
662
- var closeValue = data[fnKey]('close', index);
663
- var openValue = data[fnKey]('open', index);
662
+ var sign = 1;
663
+ if (seriesModel.get('signByPrev') && rawDataIndex) {
664
+ var openValue = data.getByRawIndex('close', rawDataIndex - 1);
665
+ var closeValue = data.getByRawIndex('close', index);
666
+ sign = openValue > closeValue ? -1 : 1;
667
+ } else {
668
+ var closeValue = data[fnKey]('close', index);
669
+ var openValue = data[fnKey]('open', index);
670
+ sign = openValue > closeValue ? -1 : 1;
671
+ }
664
672
  var dataItem = data.getItemModel(index, isRaw);
665
- var sign = openValue > closeValue ? -1 : 1;
666
673
  var fill = dataItem.get(sign > 0 ? positiveDataColorQuery : negativeDataColorQuery);
667
674
  if (fill) {
668
675
  color = fill;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tvcharts",
3
- "version": "0.9.22",
3
+ "version": "0.9.24",
4
4
  "main": "dist/echarts.js",
5
5
  "module": "index.js",
6
6
  "jsdelivr": "dist/echarts.min.js",
@@ -1 +1 @@
1
- export { install$27 as ArrowsPlotChart, install$1 as BarChart, install$26 as BarPlotChart, BarSeriesOption, install$31 as BgColorChart, install$23 as BoxesChart, install$13 as BoxplotChart, BoxplotSeriesOption, install$25 as CandlePlotChart, install$14 as CandlestickChart, CandlestickSeriesOption, install$24 as CharPlotChart, install$36 as CustomChart, CustomSeriesOption, install$15 as EffectScatterChart, EffectScatterSeriesOption, install$30 as FillsChart, install$10 as FunnelChart, FunnelSeriesOption, install$9 as GaugeChart, GaugeSeriesOption, install$8 as GraphChart, GraphSeriesOption, install$29 as HLinesChart, install$32 as HeatmapChart, HeatmapSeriesOption, install$28 as LabelsChart, install as LineChart, install$22 as LineFillsChart, LineSeriesOption, install$16 as LinesChart, install$17 as LinesPlotChart, LinesPlotSeriesOption, LinesSeriesOption, install$5 as MapChart, MapSeriesOption, install$20 as MineLinesChart, install$21 as MinePolyLinesChart, install$11 as ParallelChart, ParallelSeriesOption, install$33 as PictorialBarChart, PictorialBarSeriesOption, install$2 as PieChart, PieSeriesOption, install$19 as PlaybackOrderChart, install$4 as RadarChart, RadarSeriesOption, install$12 as SankeyChart, SankeySeriesOption, install$3 as ScatterChart, ScatterSeriesOption, install$18 as StrategyChart, StrategySeriesOption, install$35 as SunburstChart, SunburstSeriesOption, install$34 as ThemeRiverChart, ThemeRiverSeriesOption, install$6 as TreeChart, TreeSeriesOption, install$7 as TreemapChart, TreemapSeriesOption } from './shared';
1
+ export { install$28 as ArrowsPlotChart, install$1 as BarChart, install$27 as BarPlotChart, BarSeriesOption, install$32 as BgColorChart, install$23 as BoxesChart, install$13 as BoxplotChart, BoxplotSeriesOption, install$25 as CandlePlotChart, install$14 as CandlestickChart, CandlestickSeriesOption, install$24 as CharPlotChart, install$37 as CustomChart, CustomSeriesOption, install$15 as EffectScatterChart, EffectScatterSeriesOption, install$31 as FillsChart, install$10 as FunnelChart, FunnelSeriesOption, install$9 as GaugeChart, GaugeSeriesOption, install$8 as GraphChart, GraphSeriesOption, install$30 as HLinesChart, install$33 as HeatmapChart, HeatmapSeriesOption, install$26 as HeikinAshiChart, install$29 as LabelsChart, install as LineChart, install$22 as LineFillsChart, LineSeriesOption, install$16 as LinesChart, install$17 as LinesPlotChart, LinesPlotSeriesOption, LinesSeriesOption, install$5 as MapChart, MapSeriesOption, install$20 as MineLinesChart, install$21 as MinePolyLinesChart, install$11 as ParallelChart, ParallelSeriesOption, install$34 as PictorialBarChart, PictorialBarSeriesOption, install$2 as PieChart, PieSeriesOption, install$19 as PlaybackOrderChart, install$4 as RadarChart, RadarSeriesOption, install$12 as SankeyChart, SankeySeriesOption, install$3 as ScatterChart, ScatterSeriesOption, install$18 as StrategyChart, StrategySeriesOption, install$36 as SunburstChart, SunburstSeriesOption, install$35 as ThemeRiverChart, ThemeRiverSeriesOption, install$6 as TreeChart, TreeSeriesOption, install$7 as TreemapChart, TreemapSeriesOption } from './shared';
@@ -1 +1 @@
1
- export { install$54 as AlarmComponent, install$73 as AriaComponent, AriaOption as AriaComponentOption, install$48 as AxisPointerComponent, AxisPointerOption as AxisPointerComponentOption, install$55 as BgRectComponent, install$49 as BrushComponent, BrushOption as BrushComponentOption, install$44 as CalendarComponent, CalendarOption as CalendarComponentOption, install$52 as CursorPointerComponent, install$67 as DataZoomComponent, DataZoomComponentOption, install$68 as DataZoomInsideComponent, install$69 as DataZoomSliderComponent, install$75 as DatasetComponent, DatasetOption as DatasetComponentOption, install$51 as EventsComponent, install$41 as GeoComponent, GeoOption as GeoComponentOption, install$45 as GraphicComponent, GraphicComponentLooseOption as GraphicComponentOption, install$38 as GridComponent, GridOption as GridComponentOption, install$37 as GridSimpleComponent, install$64 as LegendComponent, LegendComponentOption, install$66 as LegendPlainComponent, install$65 as LegendScrollComponent, install$63 as LimitTipComponent, install$57 as LogoComponent, install$61 as MarkAreaComponent, MarkAreaOption as MarkAreaComponentOption, install$62 as MarkLabelComponent, MarkLabelOption as MarkLabelComponentOption, install$60 as MarkLineComponent, MarkLineOption as MarkLineComponentOption, install$59 as MarkPointComponent, MarkPointOption as MarkPointComponentOption, install$43 as ParallelComponent, ParallelCoordinateSystemOption as ParallelComponentOption, install$56 as PlaybackComponent, install$39 as PolarComponent, PolarOption as PolarComponentOption, install$40 as RadarComponent, RadarOption as RadarComponentOption, install$42 as SingleAxisComponent, SingleAxisOption as SingleAxisComponentOption, install$53 as TableComponent, install$58 as TimelineComponent, TimelineOption as TimelineComponentOption, install$50 as TitleComponent, TitleOption as TitleComponentOption, install$46 as ToolboxComponent, ToolboxComponentOption, install$47 as TooltipComponent, TooltipOption as TooltipComponentOption, install$74 as TransformComponent, install$70 as VisualMapComponent, VisualMapComponentOption, install$71 as VisualMapContinuousComponent, install$72 as VisualMapPiecewiseComponent } from './shared';
1
+ export { install$55 as AlarmComponent, install$74 as AriaComponent, AriaOption as AriaComponentOption, install$49 as AxisPointerComponent, AxisPointerOption as AxisPointerComponentOption, install$56 as BgRectComponent, install$50 as BrushComponent, BrushOption as BrushComponentOption, install$45 as CalendarComponent, CalendarOption as CalendarComponentOption, install$53 as CursorPointerComponent, install$68 as DataZoomComponent, DataZoomComponentOption, install$69 as DataZoomInsideComponent, install$70 as DataZoomSliderComponent, install$76 as DatasetComponent, DatasetOption as DatasetComponentOption, install$52 as EventsComponent, install$42 as GeoComponent, GeoOption as GeoComponentOption, install$46 as GraphicComponent, GraphicComponentLooseOption as GraphicComponentOption, install$39 as GridComponent, GridOption as GridComponentOption, install$38 as GridSimpleComponent, install$65 as LegendComponent, LegendComponentOption, install$67 as LegendPlainComponent, install$66 as LegendScrollComponent, install$64 as LimitTipComponent, install$58 as LogoComponent, install$62 as MarkAreaComponent, MarkAreaOption as MarkAreaComponentOption, install$63 as MarkLabelComponent, MarkLabelOption as MarkLabelComponentOption, install$61 as MarkLineComponent, MarkLineOption as MarkLineComponentOption, install$60 as MarkPointComponent, MarkPointOption as MarkPointComponentOption, install$44 as ParallelComponent, ParallelCoordinateSystemOption as ParallelComponentOption, install$57 as PlaybackComponent, install$40 as PolarComponent, PolarOption as PolarComponentOption, install$41 as RadarComponent, RadarOption as RadarComponentOption, install$43 as SingleAxisComponent, SingleAxisOption as SingleAxisComponentOption, install$54 as TableComponent, install$59 as TimelineComponent, TimelineOption as TimelineComponentOption, install$51 as TitleComponent, TitleOption as TitleComponentOption, install$47 as ToolboxComponent, ToolboxComponentOption, install$48 as TooltipComponent, TooltipOption as TooltipComponentOption, install$75 as TransformComponent, install$71 as VisualMapComponent, VisualMapComponentOption, install$72 as VisualMapContinuousComponent, install$73 as VisualMapPiecewiseComponent } from './shared';
@@ -8107,6 +8107,8 @@ interface IMarkLabelData {
8107
8107
  countDown?: {
8108
8108
  value: number;
8109
8109
  show: boolean;
8110
+ dataTimeDiff?: number;
8111
+ nextTime?: number;
8110
8112
  };
8111
8113
  }
8112
8114
  interface MarkLabelOption extends ComponentOption, AnimationOptionMixin {
@@ -1 +1 @@
1
- export { install$77 as CanvasRenderer, install$76 as SVGRenderer } from './shared';
1
+ export { install$78 as CanvasRenderer, install$77 as SVGRenderer } from './shared';
@@ -8108,6 +8108,8 @@ interface IMarkLabelData {
8108
8108
  countDown?: {
8109
8109
  value: number;
8110
8110
  show: boolean;
8111
+ dataTimeDiff?: number;
8112
+ nextTime?: number;
8111
8113
  };
8112
8114
  }
8113
8115
  interface MarkLabelOption extends ComponentOption, AnimationOptionMixin {
@@ -9317,6 +9319,8 @@ declare function install$A(registers: EChartsExtensionInstallRegisters): void;
9317
9319
 
9318
9320
  declare function install$B(registers: EChartsExtensionInstallRegisters): void;
9319
9321
 
9322
+ declare function install$C(registers: EChartsExtensionInstallRegisters): void;
9323
+
9320
9324
  interface RadarIndicatorOption {
9321
9325
  name?: string;
9322
9326
  /**
@@ -9549,7 +9553,7 @@ interface TitleOption extends ComponentOption, BoxLayoutOptionMixin, BorderOptio
9549
9553
  */
9550
9554
  borderRadius?: number | number[];
9551
9555
  }
9552
- declare function install$C(registers: EChartsExtensionInstallRegisters): void;
9556
+ declare function install$D(registers: EChartsExtensionInstallRegisters): void;
9553
9557
 
9554
9558
  interface TimelineControlStyle extends ItemStyleOption {
9555
9559
  show?: boolean;
@@ -11544,8 +11548,6 @@ interface EChartsOption extends ECBasicOption {
11544
11548
  baseOption?: EChartsOption;
11545
11549
  }
11546
11550
 
11547
- declare function install$D(registers: EChartsExtensionInstallRegisters): void;
11548
-
11549
11551
  declare function install$E(registers: EChartsExtensionInstallRegisters): void;
11550
11552
 
11551
11553
  declare function install$F(registers: EChartsExtensionInstallRegisters): void;
@@ -11622,8 +11624,10 @@ declare function install$1c(registers: EChartsExtensionInstallRegisters): void;
11622
11624
 
11623
11625
  declare function install$1d(registers: EChartsExtensionInstallRegisters): void;
11624
11626
 
11627
+ declare function install$1e(registers: EChartsExtensionInstallRegisters): void;
11628
+
11625
11629
  declare function installUniversalTransition(registers: EChartsExtensionInstallRegisters): void;
11626
11630
 
11627
11631
  declare function installLabelLayout(registers: EChartsExtensionInstallRegisters): void;
11628
11632
 
11629
- export { AngleAxisOption, AnimationDelayCallback, AnimationDelayCallbackParam, AnimationDurationCallback, AriaOption, Axis, AxisPointerOption, BarSeriesOption$1 as BarSeriesOption, BoxplotSeriesOption$1 as BoxplotSeriesOption, BrushOption, CalendarOption, CallbackDataParams, CandlestickSeriesOption$1 as CandlestickSeriesOption, ChartView, ComponentModel, ComponentView, ComposeOption, ContinousVisualMapOption, CustomSeriesOption$1 as CustomSeriesOption, CustomSeriesRenderItem, CustomSeriesRenderItemAPI, CustomSeriesRenderItemParams, CustomSeriesRenderItemReturn, DataZoomComponentOption, DatasetOption, DownplayPayload, ECBasicOption, ECElementEvent, EChartsInitOpts, EChartsOption, EChartsType, EffectScatterSeriesOption$1 as EffectScatterSeriesOption, ElementEvent, FunnelSeriesOption$1 as FunnelSeriesOption, GaugeSeriesOption$1 as GaugeSeriesOption, GeoOption, GraphSeriesOption$1 as GraphSeriesOption, GraphicComponentLooseOption, GridOption, HeatmapSeriesOption$1 as HeatmapSeriesOption, HighlightPayload, ImagePatternObject, InsideDataZoomOption, LabelFormatterCallback, LabelLayoutOptionCallback, LabelLayoutOptionCallbackParams, LegendComponentOption, LegendOption, LineSeriesOption$1 as LineSeriesOption, LinearGradientObject, LinesPlotSeriesOption$1 as LinesPlotSeriesOption, LinesSeriesOption$1 as LinesSeriesOption, MapSeriesOption$1 as MapSeriesOption, MarkAreaOption, MarkLabelOption, MarkLineOption, MarkPointOption, MineLinesSeriesOption$1 as MineLinesSeriesOption, Model, PRIORITY, ParallelCoordinateSystemOption, ParallelSeriesOption$1 as ParallelSeriesOption, PatternObject, Payload, PictorialBarSeriesOption$1 as PictorialBarSeriesOption, PieSeriesOption$1 as PieSeriesOption, PiecewiseVisualMapOption, PolarOption, RadarOption, RadarSeriesOption$1 as RadarSeriesOption, RadialGradientObject, RadiusAxisOption, RegisteredSeriesOption, ResizeOpts, SVGPatternObject, SankeySeriesOption$1 as SankeySeriesOption, ScatterSeriesOption$1 as ScatterSeriesOption, ScrollableLegendOption, SelectChangedPayload, SeriesData, SeriesModel, SeriesOption$1 as SeriesOption, SetOptionOpts, SetOptionTransitionOpt, SetOptionTransitionOptItem, SingleAxisOption, SliderDataZoomOption, StrategySeriesOption$1 as StrategySeriesOption, SunburstSeriesOption$1 as SunburstSeriesOption, ThemeRiverSeriesOption$1 as ThemeRiverSeriesOption, TimelineOption, TitleOption, ToolboxComponentOption, TooltipFormatterCallback, TooltipOption, TooltipPositionCallback, TooltipPositionCallbackParams, TopLevelFormatterParams, TreeSeriesOption$1 as TreeSeriesOption, TreemapSeriesOption$1 as TreemapSeriesOption, VisualMapComponentOption, XAXisOption, YAXisOption, ZRColor, brushSingle, colorToRgba, color_d, connect, connectLayoutAction, connectLayouts, contrastColor, dataTool, dependencies, disConnect, disconnect, disconnectLayoutAction, disconnectLayouts, dispose$1 as dispose, env, extendChartView, extendComponentModel, extendComponentView, extendSeriesModel, format_d, getCoordinateSystemDimensions, getInstanceByDom, getInstanceById, getMap, graphic_d, helper_d, init$1 as init, install$1 as install, install$2 as install$1, install$b as install$10, install$c as install$11, install$d as install$12, install$e as install$13, install$f as install$14, install$g as install$15, install$h as install$16, install$i as install$17, install$j as install$18, install$k as install$19, install$3 as install$2, install$l as install$20, install$m as install$21, install$n as install$22, install$o as install$23, install$p as install$24, install$q as install$25, install$r as install$26, install$s as install$27, install$t as install$28, install$u as install$29, install$4 as install$3, install$v as install$30, install$w as install$31, install$x as install$32, install$y as install$33, install$z as install$34, install$A as install$35, install$B as install$36, install$D as install$37, install$E as install$38, install$F as install$39, install$5 as install$4, install$G as install$40, install$H as install$41, install$I as install$42, install$J as install$43, install$K as install$44, install$L as install$45, install$M as install$46, install$N as install$47, install$O as install$48, install$P as install$49, install$6 as install$5, install$C as install$50, install$Q as install$51, install$R as install$52, install$S as install$53, install$T as install$54, install$U as install$55, install$V as install$56, install$W as install$57, install$X as install$58, install$Y as install$59, install$7 as install$6, install$Z as install$60, install$_ as install$61, install$$ as install$62, install$10 as install$63, install$11 as install$64, install$12 as install$65, install$13 as install$66, install$14 as install$67, install$15 as install$68, install$16 as install$69, install$8 as install$7, install$17 as install$70, install$18 as install$71, install$19 as install$72, install$1a as install$73, install$1b as install$74, install as install$75, install$1c as install$76, install$1d as install$77, install$9 as install$8, install$a as install$9, installLabelLayout, installUniversalTransition, matrix_d, number_d, parseGeoJSON, registerAction, registerCoordinateSystem, registerLayout, registerLoading, registerLocale, registerMap, registerPostInit, registerPostUpdate, registerPreprocessor, registerProcessor, registerTheme, registerTransform, registerUpdateLifecycle, registerVisual, setCanvasCreator, setPlatformAPI, throttle, time_d, use, util_d, util_d$1, vector_d, version$1 as version, zrender_d };
11633
+ export { AngleAxisOption, AnimationDelayCallback, AnimationDelayCallbackParam, AnimationDurationCallback, AriaOption, Axis, AxisPointerOption, BarSeriesOption$1 as BarSeriesOption, BoxplotSeriesOption$1 as BoxplotSeriesOption, BrushOption, CalendarOption, CallbackDataParams, CandlestickSeriesOption$1 as CandlestickSeriesOption, ChartView, ComponentModel, ComponentView, ComposeOption, ContinousVisualMapOption, CustomSeriesOption$1 as CustomSeriesOption, CustomSeriesRenderItem, CustomSeriesRenderItemAPI, CustomSeriesRenderItemParams, CustomSeriesRenderItemReturn, DataZoomComponentOption, DatasetOption, DownplayPayload, ECBasicOption, ECElementEvent, EChartsInitOpts, EChartsOption, EChartsType, EffectScatterSeriesOption$1 as EffectScatterSeriesOption, ElementEvent, FunnelSeriesOption$1 as FunnelSeriesOption, GaugeSeriesOption$1 as GaugeSeriesOption, GeoOption, GraphSeriesOption$1 as GraphSeriesOption, GraphicComponentLooseOption, GridOption, HeatmapSeriesOption$1 as HeatmapSeriesOption, HighlightPayload, ImagePatternObject, InsideDataZoomOption, LabelFormatterCallback, LabelLayoutOptionCallback, LabelLayoutOptionCallbackParams, LegendComponentOption, LegendOption, LineSeriesOption$1 as LineSeriesOption, LinearGradientObject, LinesPlotSeriesOption$1 as LinesPlotSeriesOption, LinesSeriesOption$1 as LinesSeriesOption, MapSeriesOption$1 as MapSeriesOption, MarkAreaOption, MarkLabelOption, MarkLineOption, MarkPointOption, MineLinesSeriesOption$1 as MineLinesSeriesOption, Model, PRIORITY, ParallelCoordinateSystemOption, ParallelSeriesOption$1 as ParallelSeriesOption, PatternObject, Payload, PictorialBarSeriesOption$1 as PictorialBarSeriesOption, PieSeriesOption$1 as PieSeriesOption, PiecewiseVisualMapOption, PolarOption, RadarOption, RadarSeriesOption$1 as RadarSeriesOption, RadialGradientObject, RadiusAxisOption, RegisteredSeriesOption, ResizeOpts, SVGPatternObject, SankeySeriesOption$1 as SankeySeriesOption, ScatterSeriesOption$1 as ScatterSeriesOption, ScrollableLegendOption, SelectChangedPayload, SeriesData, SeriesModel, SeriesOption$1 as SeriesOption, SetOptionOpts, SetOptionTransitionOpt, SetOptionTransitionOptItem, SingleAxisOption, SliderDataZoomOption, StrategySeriesOption$1 as StrategySeriesOption, SunburstSeriesOption$1 as SunburstSeriesOption, ThemeRiverSeriesOption$1 as ThemeRiverSeriesOption, TimelineOption, TitleOption, ToolboxComponentOption, TooltipFormatterCallback, TooltipOption, TooltipPositionCallback, TooltipPositionCallbackParams, TopLevelFormatterParams, TreeSeriesOption$1 as TreeSeriesOption, TreemapSeriesOption$1 as TreemapSeriesOption, VisualMapComponentOption, XAXisOption, YAXisOption, ZRColor, brushSingle, colorToRgba, color_d, connect, connectLayoutAction, connectLayouts, contrastColor, dataTool, dependencies, disConnect, disconnect, disconnectLayoutAction, disconnectLayouts, dispose$1 as dispose, env, extendChartView, extendComponentModel, extendComponentView, extendSeriesModel, format_d, getCoordinateSystemDimensions, getInstanceByDom, getInstanceById, getMap, graphic_d, helper_d, init$1 as init, install$1 as install, install$2 as install$1, install$b as install$10, install$c as install$11, install$d as install$12, install$e as install$13, install$f as install$14, install$g as install$15, install$h as install$16, install$i as install$17, install$j as install$18, install$k as install$19, install$3 as install$2, install$l as install$20, install$m as install$21, install$n as install$22, install$o as install$23, install$p as install$24, install$q as install$25, install$r as install$26, install$s as install$27, install$t as install$28, install$u as install$29, install$4 as install$3, install$v as install$30, install$w as install$31, install$x as install$32, install$y as install$33, install$z as install$34, install$A as install$35, install$B as install$36, install$C as install$37, install$E as install$38, install$F as install$39, install$5 as install$4, install$G as install$40, install$H as install$41, install$I as install$42, install$J as install$43, install$K as install$44, install$L as install$45, install$M as install$46, install$N as install$47, install$O as install$48, install$P as install$49, install$6 as install$5, install$Q as install$50, install$D as install$51, install$R as install$52, install$S as install$53, install$T as install$54, install$U as install$55, install$V as install$56, install$W as install$57, install$X as install$58, install$Y as install$59, install$7 as install$6, install$Z as install$60, install$_ as install$61, install$$ as install$62, install$10 as install$63, install$11 as install$64, install$12 as install$65, install$13 as install$66, install$14 as install$67, install$15 as install$68, install$16 as install$69, install$8 as install$7, install$17 as install$70, install$18 as install$71, install$19 as install$72, install$1a as install$73, install$1b as install$74, install$1c as install$75, install as install$76, install$1d as install$77, install$1e as install$78, install$9 as install$8, install$a as install$9, installLabelLayout, installUniversalTransition, matrix_d, number_d, parseGeoJSON, registerAction, registerCoordinateSystem, registerLayout, registerLoading, registerLocale, registerMap, registerPostInit, registerPostUpdate, registerPreprocessor, registerProcessor, registerTheme, registerTransform, registerUpdateLifecycle, registerVisual, setCanvasCreator, setPlatformAPI, throttle, time_d, use, util_d, util_d$1, vector_d, version$1 as version, zrender_d };
@@ -0,0 +1,15 @@
1
+ import { StageHandler } from '../../util/types.js';
2
+ import { RectLike } from 'tvrender/lib/core/BoundingRect.js';
3
+ export interface HeikinAshiItemLayout {
4
+ sign: number;
5
+ initBaseline: number;
6
+ ends: number[][];
7
+ brushRect: RectLike;
8
+ }
9
+ export interface HeikinAshiLayoutMeta {
10
+ candleWidth: number;
11
+ isSimpleBox: boolean;
12
+ }
13
+ declare const heikinAshiLayout: StageHandler;
14
+ export declare function getRenderIndexX(bandWidth: number, x: number): number;
15
+ export default heikinAshiLayout;
@@ -0,0 +1,60 @@
1
+ import SeriesModel from '../../model/Series.js';
2
+ import { SeriesOption, SeriesOnCartesianOptionMixin, LayoutOrient, ItemStyleOption, ColorString, SeriesLabelOption, SeriesLargeOptionMixin, StatesOptionMixin, SeriesEncodeOptionMixin, DefaultEmphasisFocus, OptionDataValue } from '../../util/types.js';
3
+ import Cartesian2D from '../../coord/cartesian/Cartesian2D.js';
4
+ import { PathState } from 'tvrender/lib/graphic/Path.js';
5
+ declare type HeikinAshiDataValue = OptionDataValue[];
6
+ interface HeikinAshiItemStyleOption extends ItemStyleOption {
7
+ color0?: ColorString;
8
+ borderColor0?: ColorString;
9
+ borderColorDoji?: ColorString;
10
+ dataUpColor?: ColorString;
11
+ dataFallColor?: ColorString;
12
+ wickColor?: ColorString;
13
+ wickColor0?: ColorString;
14
+ }
15
+ export interface HeikinAshiStateOption {
16
+ itemStyle?: HeikinAshiItemStyleOption;
17
+ label?: SeriesLabelOption;
18
+ }
19
+ export interface HeikinAshiDataItemOption extends HeikinAshiStateOption, StatesOptionMixin<HeikinAshiStateOption, ExtraStateOption> {
20
+ value: HeikinAshiDataValue;
21
+ }
22
+ interface ExtraStateOption {
23
+ emphasis?: {
24
+ focus?: DefaultEmphasisFocus;
25
+ scale?: boolean;
26
+ emphasisState?: PathState;
27
+ };
28
+ }
29
+ export interface HeikinAshiSeriesOption extends SeriesOption<HeikinAshiStateOption, ExtraStateOption>, HeikinAshiStateOption, SeriesOnCartesianOptionMixin, SeriesLargeOptionMixin, SeriesEncodeOptionMixin {
30
+ type?: 'heikinAshi';
31
+ coordinateSystem?: 'cartesian2d';
32
+ layout?: LayoutOrient;
33
+ clip?: boolean;
34
+ barMaxWidth?: number | string;
35
+ barMinWidth?: number | string;
36
+ barWidth?: number | string;
37
+ signByPrev?: boolean;
38
+ data?: (HeikinAshiDataValue | HeikinAshiDataItemOption)[];
39
+ ignoreParentColor: boolean;
40
+ }
41
+ declare class HeikinAshiSeriesModel extends SeriesModel<HeikinAshiSeriesOption> {
42
+ static readonly type = "series.heikinAshi";
43
+ readonly type = "series.heikinAshi";
44
+ static readonly dependencies: string[];
45
+ notAddOrdinal: boolean;
46
+ ignoreStyleOnData: boolean;
47
+ coordinateSystem: Cartesian2D;
48
+ dimensions: string[];
49
+ defaultValueDimensions: {
50
+ name: string;
51
+ defaultTooltip: boolean;
52
+ }[];
53
+ static defaultOption: HeikinAshiSeriesOption;
54
+ /**
55
+ * Get dimension for shadow in dataZoom
56
+ * @return dimension name
57
+ */
58
+ getShadowDim(): string;
59
+ }
60
+ export default HeikinAshiSeriesModel;
@@ -0,0 +1,14 @@
1
+ import ChartView from '../../view/Chart.js';
2
+ import HeikinAshiSeriesModel from './heikinAshiSeries.js';
3
+ import GlobalModel from '../../model/Global.js';
4
+ import ExtensionAPI from '../../core/ExtensionAPI.js';
5
+ declare class HeikinAshiView extends ChartView {
6
+ static readonly type = "heikinAshi";
7
+ readonly type = "heikinAshi";
8
+ private _progressiveEls;
9
+ render(seriesModel: HeikinAshiSeriesModel, ecModel: GlobalModel, api: ExtensionAPI): void;
10
+ _renderNormal(seriesModel: HeikinAshiSeriesModel): void;
11
+ remove(ecModel: GlobalModel): void;
12
+ _clear(): void;
13
+ }
14
+ export default HeikinAshiView;
@@ -0,0 +1,2 @@
1
+ import { EChartsExtensionInstallRegisters } from '../../extension.js';
2
+ export declare function install(registers: EChartsExtensionInstallRegisters): void;
@@ -26,6 +26,8 @@ export interface IMarkLabelData {
26
26
  countDown?: {
27
27
  value: number;
28
28
  show: boolean;
29
+ dataTimeDiff?: number;
30
+ nextTime?: number;
29
31
  };
30
32
  }
31
33
  export interface MarkLabelOption extends ComponentOption, AnimationOptionMixin {
@@ -24,6 +24,7 @@ export { install as LineFillsChart } from '../chart/lineFills/install.js';
24
24
  export { install as BoxesChart } from '../chart/boxes/install.js';
25
25
  export { install as CharPlotChart } from '../chart/charPlot/install.js';
26
26
  export { install as CandlePlotChart } from '../chart/candlePlot/install.js';
27
+ export { install as HeikinAshiChart } from '../chart/heikinAshi/install.js';
27
28
  export { install as BarPlotChart } from '../chart/barPlot/install.js';
28
29
  export { install as ArrowsPlotChart } from '../chart/arrowsPlot/install.js';
29
30
  export { install as LabelsChart } from '../chart/labels/install.js';
@@ -1,3 +1,5 @@
1
+ import type SeriesModel from '../model/Series.js';
1
2
  declare function isCandle(type: string): boolean;
2
3
  declare function isPlot(type: string): boolean;
3
- export { isCandle, isPlot };
4
+ declare function formatUpdateData(seriesModel: SeriesModel, item: (string | number)[], index: number): (string | number)[];
5
+ export { isCandle, isPlot, formatUpdateData };