scichart 2.2.2351 → 2.2.2393

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/Builder/buildAxis.d.ts +7 -0
  2. package/Builder/buildAxis.js +6 -0
  3. package/Builder/buildDataSeries.d.ts +19 -1
  4. package/Builder/buildDataSeries.js +22 -1
  5. package/Builder/buildSeries.d.ts +7 -2
  6. package/Builder/buildSeries.js +5 -1
  7. package/Charting/ChartModifiers/ModifierMouseArgs.d.ts +2 -2
  8. package/Charting/ChartModifiers/ModifierMouseArgs.js +4 -2
  9. package/Charting/Drawing/WebGlRenderContext2D.js +26 -42
  10. package/Charting/Model/BaseHeatmapDataSeries.js +1 -1
  11. package/Charting/Model/ChartData/HlcSeriesInfo.d.ts +12 -0
  12. package/Charting/Model/ChartData/HlcSeriesInfo.js +52 -0
  13. package/Charting/Model/Filters/HlcCustomFilter.d.ts +41 -0
  14. package/Charting/Model/Filters/HlcCustomFilter.js +119 -0
  15. package/Charting/Model/Filters/HlcFilterBase.d.ts +30 -0
  16. package/Charting/Model/Filters/HlcFilterBase.js +141 -0
  17. package/Charting/Model/Filters/HlcScaleOffsetFilter.d.ts +18 -0
  18. package/Charting/Model/Filters/HlcScaleOffsetFilter.js +86 -0
  19. package/Charting/Model/Filters/XyFilterBase.d.ts +2 -0
  20. package/Charting/Model/Filters/XyFilterBase.js +6 -0
  21. package/Charting/Model/Filters/XyyFilterBase.js +9 -0
  22. package/Charting/Model/Filters/XyzFilterBase.js +12 -3
  23. package/Charting/Model/HlcDataSeries.d.ts +189 -0
  24. package/Charting/Model/HlcDataSeries.js +557 -0
  25. package/Charting/Model/IDataSeries.d.ts +5 -1
  26. package/Charting/Model/IDataSeries.js +4 -0
  27. package/Charting/Model/PointSeries/HlcPointSeriesWrapped.d.ts +10 -0
  28. package/Charting/Model/PointSeries/HlcPointSeriesWrapped.js +31 -0
  29. package/Charting/Model/PointSeries/IPointSeries.d.ts +5 -0
  30. package/Charting/Numerics/CoordinateCalculators/LogarithmicCoordinateCalculator.d.ts +2 -2
  31. package/Charting/Numerics/CoordinateCalculators/LogarithmicCoordinateCalculator.js +15 -6
  32. package/Charting/Services/SciChartRenderer.d.ts +1 -0
  33. package/Charting/Services/SciChartRenderer.js +6 -0
  34. package/Charting/Visuals/Annotations/RolloverTooltipSvgAnnotation.js +8 -0
  35. package/Charting/Visuals/Axis/AxisBase2D.d.ts +1 -1
  36. package/Charting/Visuals/Axis/AxisBase2D.js +9 -22
  37. package/Charting/Visuals/Axis/AxisCore.d.ts +4 -0
  38. package/Charting/Visuals/Axis/AxisCore.js +6 -0
  39. package/Charting/Visuals/Axis/AxisRenderer.js +6 -10
  40. package/Charting/Visuals/Axis/DateTimeNumericAxis.d.ts +11 -0
  41. package/Charting/Visuals/Axis/DateTimeNumericAxis.js +36 -0
  42. package/Charting/Visuals/Axis/DeltaCalculator/DateTimeDeltaCalculator.d.ts +28 -0
  43. package/Charting/Visuals/Axis/DeltaCalculator/DateTimeDeltaCalculator.js +125 -0
  44. package/Charting/Visuals/Axis/LabelProvider/PieLabelProvider.d.ts +7 -2
  45. package/Charting/Visuals/Axis/LabelProvider/PieLabelProvider.js +9 -4
  46. package/Charting/Visuals/Axis/LabelProvider/SmartDateLabelProvider.js +18 -2
  47. package/Charting/Visuals/Axis/LogarithmicAxis.d.ts +1 -0
  48. package/Charting/Visuals/Axis/LogarithmicAxis.js +5 -3
  49. package/Charting/Visuals/Helpers/NativeObject.d.ts +13 -0
  50. package/Charting/Visuals/Helpers/NativeObject.js +101 -0
  51. package/Charting/Visuals/Helpers/createNativeRect.d.ts +2 -2
  52. package/Charting/Visuals/Helpers/createNativeRect.js +3 -1
  53. package/Charting/Visuals/Helpers/drawBorder.js +2 -2
  54. package/Charting/Visuals/Legend/SciChartLegend.js +1 -1
  55. package/Charting/Visuals/Legend/SciChartLegendBase.d.ts +1 -0
  56. package/Charting/Visuals/Legend/SciChartLegendBase.js +4 -2
  57. package/Charting/Visuals/Legend/SciChartPieLegend.js +1 -1
  58. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.d.ts +9 -2
  59. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.js +74 -22
  60. package/Charting/Visuals/RenderableSeries/DrawingProviders/BaseSeriesDrawingProvider.js +14 -11
  61. package/Charting/Visuals/RenderableSeries/DrawingProviders/ErrorSeriesDrawingProvider.d.ts +46 -0
  62. package/Charting/Visuals/RenderableSeries/DrawingProviders/ErrorSeriesDrawingProvider.js +252 -0
  63. package/Charting/Visuals/RenderableSeries/FastErrorBarsRenderableSeries.d.ts +188 -0
  64. package/Charting/Visuals/RenderableSeries/FastErrorBarsRenderableSeries.js +357 -0
  65. package/Charting/Visuals/RenderableSeries/FastImpulseRenderableSeries.js +3 -10
  66. package/Charting/Visuals/RenderableSeries/HitTest/ErrorSeriesHitTestProvider.d.ts +20 -0
  67. package/Charting/Visuals/RenderableSeries/HitTest/ErrorSeriesHitTestProvider.js +120 -0
  68. package/Charting/Visuals/RenderableSeries/HitTest/hitTestHelpers.d.ts +6 -0
  69. package/Charting/Visuals/RenderableSeries/HitTest/hitTestHelpers.js +36 -0
  70. package/Charting/Visuals/RenderableSeries/StackedColumnCollection.js +1 -2
  71. package/Charting/Visuals/RenderableSeries/constants.d.ts +5 -0
  72. package/Charting/Visuals/RenderableSeries/constants.js +5 -0
  73. package/Charting/Visuals/SciChartPieSurface/IPieSurfaceOptions.d.ts +2 -1
  74. package/Charting/Visuals/SciChartPieSurface/PieSegment/IPieSegment.d.ts +5 -0
  75. package/Charting/Visuals/SciChartPieSurface/PieSegment/PieSegment.d.ts +116 -1
  76. package/Charting/Visuals/SciChartPieSurface/PieSegment/PieSegment.js +139 -4
  77. package/Charting/Visuals/SciChartPieSurface/PieSegment/constants.d.ts +4 -1
  78. package/Charting/Visuals/SciChartPieSurface/PieSegment/constants.js +3 -0
  79. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.d.ts +13 -3
  80. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.js +114 -74
  81. package/Charting/Visuals/SciChartPieSurface/constants.d.ts +2 -1
  82. package/Charting/Visuals/SciChartPieSurface/constants.js +1 -0
  83. package/Charting/Visuals/createMaster.js +15 -11
  84. package/Charting/Visuals/createSingle.js +3 -1
  85. package/Charting/Visuals/licenseManager2D.d.ts +6 -0
  86. package/Charting/Visuals/licenseManager2D.js +98 -9
  87. package/Charting/Visuals/licenseManager2dState.d.ts +11 -0
  88. package/Charting/Visuals/licenseManager2dState.js +37 -1
  89. package/Charting/Visuals/loader.js +4 -1
  90. package/Charting3D/Visuals/SciChart3DRenderer.js +1 -1
  91. package/Charting3D/Visuals/SciChart3DSurface.d.ts +8 -3
  92. package/Charting3D/Visuals/SciChart3DSurface.js +12 -3
  93. package/Charting3D/Visuals/createMaster3d.js +22 -16
  94. package/Charting3D/Visuals/createSingle3d.js +5 -6
  95. package/Charting3D/Visuals/licenseManager3D.js +3 -1
  96. package/Core/BuildStamp.d.ts +1 -1
  97. package/Core/BuildStamp.js +2 -2
  98. package/Core/Telemetry.d.ts +7 -0
  99. package/Core/Telemetry.js +109 -0
  100. package/Core/storage/localStorageApi.d.ts +4 -0
  101. package/Core/storage/localStorageApi.js +12 -0
  102. package/README.md +49 -13
  103. package/_wasm/scichart.browser.js +1 -1
  104. package/_wasm/scichart2d.js +10 -10
  105. package/_wasm/scichart2d.wasm +0 -0
  106. package/_wasm/scichart3d.js +97 -97
  107. package/_wasm/scichart3d.wasm +0 -0
  108. package/package.json +1 -1
  109. package/types/AxisType.d.ts +5 -1
  110. package/types/AxisType.js +4 -0
  111. package/types/DataFilterType.d.ts +1 -0
  112. package/types/DataFilterType.js +1 -0
  113. package/types/DataPointWidthMode.d.ts +13 -0
  114. package/types/DataPointWidthMode.js +17 -0
  115. package/types/ErrorDirection.d.ts +13 -0
  116. package/types/ErrorDirection.js +17 -0
  117. package/types/ErrorMode.d.ts +17 -0
  118. package/types/ErrorMode.js +21 -0
  119. package/types/NumericFormat.d.ts +4 -0
  120. package/types/NumericFormat.js +4 -0
  121. package/types/SeriesType.d.ts +3 -1
  122. package/types/SeriesType.js +2 -0
  123. package/types/TSciChart.d.ts +8 -2
  124. package/types/TSciChart3D.d.ts +5 -2
  125. package/utils/date.d.ts +1 -0
  126. package/utils/date.js +15 -1
  127. package/utils/guid.d.ts +6 -0
  128. package/utils/guid.js +17 -1
  129. package/utils/number.js +15 -2
@@ -0,0 +1,557 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.HlcDataSeries = void 0;
19
+ var Deleter_1 = require("../../Core/Deleter");
20
+ var Guard_1 = require("../../Core/Guard");
21
+ var NumberRange_1 = require("../../Core/NumberRange");
22
+ var NumberArray_1 = require("../../types/NumberArray");
23
+ var appendDoubleVectorFromJsArray_1 = require("../../utils/ccall/appendDoubleVectorFromJsArray");
24
+ var isRealNumber_1 = require("../../utils/isRealNumber");
25
+ var animationHelpers_1 = require("../Visuals/RenderableSeries/Animations/animationHelpers");
26
+ var BaseDataSeries_1 = require("./BaseDataSeries");
27
+ var IDataSeries_1 = require("./IDataSeries");
28
+ /**
29
+ * HlcDataSeries is a DataSeries for holding X, Y, H, L data in SciChart's 2D
30
+ * {@link https://www.scichart.com/javascript-chart-features | JavaScript Charts}
31
+ * @remarks
32
+ * The HlcDataSeries is primarily used with our {@link FastErrorBarsRenderableSeries | JavaScript Error Bars Chart},
33
+ * which draws a High-Low Bars around points
34
+ *
35
+ * A DataSeries stores the data to render. This is independent from the {@link IRenderableSeries | RenderableSeries}
36
+ * which defines how that data should be rendered.
37
+ *
38
+ * See derived types of {@link BaseDataSeries} to find out what data-series are available.
39
+ * See derived types of {@link IRenderableSeries} to find out what 2D JavaScript Chart types are available.
40
+ */
41
+ var HlcDataSeries = /** @class */ (function (_super) {
42
+ __extends(HlcDataSeries, _super);
43
+ /**
44
+ * Creates an instance of {@link HlcDataSeries}
45
+ * @param webAssemblyContext the {@link TSciChart | SciChart WebAssembly Context} containing native methods
46
+ * and access to our underlying WebGL2 rendering engine
47
+ * @param options the {@link IHlcDataSeriesOptions} which can be passed to configure the DataSeries at construct time
48
+ */
49
+ function HlcDataSeries(webAssemblyContext, options) {
50
+ var _this = _super.call(this, webAssemblyContext, options) || this;
51
+ /** @inheritDoc */
52
+ _this.type = IDataSeries_1.EDataSeriesType.Hlc;
53
+ _this.highValues = new webAssemblyContext.SCRTDoubleVector();
54
+ _this.lowValues = new webAssemblyContext.SCRTDoubleVector();
55
+ _this.lInitialAnimationValues = new webAssemblyContext.SCRTDoubleVector();
56
+ _this.lFinalAnimationValues = new webAssemblyContext.SCRTDoubleVector();
57
+ _this.hInitialAnimationValues = new webAssemblyContext.SCRTDoubleVector();
58
+ _this.hFinalAnimationValues = new webAssemblyContext.SCRTDoubleVector();
59
+ if (options === null || options === void 0 ? void 0 : options.xValues) {
60
+ Guard_1.Guard.notNull(options.yValues, "options.yValues");
61
+ Guard_1.Guard.notNull(options.highValues, "options.highValues");
62
+ Guard_1.Guard.notNull(options.lowValues, "options.lowValues");
63
+ _this.appendRange(options.xValues, options.yValues, options.highValues, options.lowValues, options.metadata);
64
+ }
65
+ return _this;
66
+ }
67
+ /**
68
+ * Gets a native / WebAssembly vector of H-values in the DataSeries
69
+ */
70
+ HlcDataSeries.prototype.getNativeHighValues = function () {
71
+ return this.highValues;
72
+ };
73
+ /**
74
+ * Gets a native / WebAssembly vector of L-values in the DataSeries
75
+ */
76
+ HlcDataSeries.prototype.getNativeLowValues = function () {
77
+ return this.lowValues;
78
+ };
79
+ /**
80
+ * Appends a single X, Y, Y1 point to the DataSeries
81
+ * @remarks
82
+ * For best performance on drawing large datasets, use the {@link appendRange} method
83
+ *
84
+ * Any changes of the DataSeries will trigger a redraw on the parent {@link SciChartSurface}
85
+ * @param x The X-value
86
+ * @param y The Y1-value
87
+ * @param h The H-value
88
+ * @param l The L-value
89
+ * @param metadata The point metadata
90
+ */
91
+ HlcDataSeries.prototype.append = function (x, y, h, l, metadata) {
92
+ if (!this.getIsDeleted()) {
93
+ var nativeX = this.getNativeXValues();
94
+ this.dataDistributionCalculator.onAppend(this.isSorted, this.containsNaN, nativeX, [x], [y]);
95
+ // Push metadata should be done before push x values
96
+ this.appendMetadata(metadata);
97
+ nativeX.push_back(x);
98
+ this.getNativeYValues().push_back(y);
99
+ this.getNativeHighValues().push_back(h);
100
+ this.getNativeLowValues().push_back(l);
101
+ this.notifyDataChanged(IDataSeries_1.EDataChangeType.Append, null, 1);
102
+ }
103
+ };
104
+ /**
105
+ * Appends a range of X, Y, Y1 points to the DataSeries
106
+ * @remarks
107
+ * This method is considerably higher performance than {@link append} which appends a single point
108
+ *
109
+ * Any changes of the DataSeries will trigger a redraw on the parent {@link SciChartSurface}
110
+ * @param xValues The X-values
111
+ * @param yValues The Y-values
112
+ * @param y1Values The Y1-values
113
+ * @param metadata The array of point metadata
114
+ */
115
+ HlcDataSeries.prototype.appendRange = function (xValues, yValues, hValues, lValues, metadata) {
116
+ if (!this.getIsDeleted()) {
117
+ Guard_1.Guard.isTrue((0, NumberArray_1.isNumberArray)(xValues) || (0, NumberArray_1.isTypedArray)(xValues), "xValues must be an array of numbers");
118
+ Guard_1.Guard.isTrue((0, NumberArray_1.isNumberArray)(yValues) || (0, NumberArray_1.isTypedArray)(yValues), "yValues must be an array of numbers");
119
+ Guard_1.Guard.isTrue((0, NumberArray_1.isNumberArray)(hValues) || (0, NumberArray_1.isTypedArray)(hValues), "hValues must be an array of numbers");
120
+ Guard_1.Guard.isTrue((0, NumberArray_1.isNumberArray)(lValues) || (0, NumberArray_1.isTypedArray)(lValues), "lValues must be an array of numbers");
121
+ Guard_1.Guard.arraysSameLengthArr([
122
+ { arg: xValues, name: "xValues" },
123
+ { arg: yValues, name: "yValues" },
124
+ { arg: hValues, name: "hValues" },
125
+ { arg: lValues, name: "lValues" }
126
+ ]);
127
+ if (metadata) {
128
+ Guard_1.Guard.isTrue(Array.isArray(metadata), "metadata must be an array of IPointMetadata");
129
+ Guard_1.Guard.arraysSameLength(xValues, "xValues", metadata, "metadata");
130
+ }
131
+ var nativeX = this.getNativeXValues();
132
+ var nativeY = this.getNativeYValues();
133
+ var nativeH = this.getNativeHighValues();
134
+ var nativeL = this.getNativeLowValues();
135
+ this.dataDistributionCalculator.onAppend(this.isSorted, this.containsNaN, nativeX, xValues, yValues);
136
+ // Push metadata should be done before push x values
137
+ this.appendMetadataRange(metadata, xValues.length);
138
+ // New implementation passing array from JS
139
+ (0, appendDoubleVectorFromJsArray_1.appendDoubleVectorFromJsArray)(this.webAssemblyContext, nativeX, xValues);
140
+ (0, appendDoubleVectorFromJsArray_1.appendDoubleVectorFromJsArray)(this.webAssemblyContext, nativeY, yValues);
141
+ (0, appendDoubleVectorFromJsArray_1.appendDoubleVectorFromJsArray)(this.webAssemblyContext, nativeH, hValues);
142
+ (0, appendDoubleVectorFromJsArray_1.appendDoubleVectorFromJsArray)(this.webAssemblyContext, nativeL, lValues);
143
+ this.notifyDataChanged(IDataSeries_1.EDataChangeType.Append, null, xValues.length);
144
+ }
145
+ };
146
+ /**
147
+ * Updates a single Y, H, L-value by X-index
148
+ * @remarks Any changes of the DataSeries will trigger a redraw on the parent {@link SciChartSurface}
149
+ * @param index the index to update
150
+ * @param y The new Y value
151
+ * @param h The new H value
152
+ * @param l The new L value
153
+ * @param metadata The point metadata
154
+ */
155
+ HlcDataSeries.prototype.update = function (index, y, h, l, metadata) {
156
+ if (!this.getIsDeleted()) {
157
+ this.validateIndex(index);
158
+ this.dataDistributionCalculator.onUpdate(this.isSorted, this.containsNaN, undefined, undefined, [y], index);
159
+ this.getNativeYValues().set(index, y);
160
+ this.getNativeHighValues().set(index, h);
161
+ this.getNativeLowValues().set(index, l);
162
+ this.setMetadataAt(index, metadata);
163
+ this.notifyDataChanged(IDataSeries_1.EDataChangeType.Update, index, 1);
164
+ }
165
+ };
166
+ /**
167
+ * Updates a single X, Y, H, L-value by X-index. Might also need to set isSorted = false
168
+ * @remarks Any changes of the DataSeries will trigger a redraw on the parent {@link SciChartSurface}
169
+ * @param index the index to update
170
+ * @param x The new X value
171
+ * @param y The new Y value
172
+ * @param h The new H value
173
+ * @param l The new L value
174
+ * @param metadata The point metadata
175
+ */
176
+ HlcDataSeries.prototype.updateXyhl = function (index, x, y, h, l, metadata) {
177
+ // TODO probably update method signature
178
+ if (!this.getIsDeleted()) {
179
+ this.validateIndex(index);
180
+ var nativeX = this.getNativeXValues();
181
+ this.dataDistributionCalculator.onUpdate(this.isSorted, this.containsNaN, nativeX, [x], [y], index);
182
+ nativeX.set(index, x);
183
+ this.getNativeYValues().set(index, y);
184
+ this.getNativeHighValues().set(index, h);
185
+ this.getNativeLowValues().set(index, l);
186
+ this.setMetadataAt(index, metadata);
187
+ this.notifyDataChanged(IDataSeries_1.EDataChangeType.Update, index, 1);
188
+ }
189
+ };
190
+ /**
191
+ * Inserts a single X,Y, H, L value at the start index
192
+ * @remarks
193
+ * For best performance on drawing large datasets, use the {@link insertRange} method
194
+ *
195
+ * Any changes of the DataSeries will trigger a redraw on the parent {@link SciChartSurface}
196
+ * @param startIndex the index to insert at
197
+ * @param x the XValue
198
+ * @param y the YValue
199
+ * @param h the HighValue
200
+ * @param l the LowValue
201
+ * @param metadata The point metadata
202
+ */
203
+ HlcDataSeries.prototype.insert = function (startIndex, x, y, h, l, metadata) {
204
+ if (!this.getIsDeleted()) {
205
+ this.validateIndex(startIndex, "Start index is out of range");
206
+ var nativeX = this.getNativeXValues();
207
+ var nativeY = this.getNativeYValues();
208
+ var nativeH = this.getNativeHighValues();
209
+ var nativeL = this.getNativeLowValues();
210
+ this.dataDistributionCalculator.onInsert(this.isSorted, this.containsNaN, nativeX, [x], [y], startIndex);
211
+ nativeX.insertAt(startIndex, x);
212
+ nativeY.insertAt(startIndex, y);
213
+ nativeH.insertAt(startIndex, h);
214
+ nativeL.insertAt(startIndex, l);
215
+ this.insertMetadata(startIndex, metadata);
216
+ this.notifyDataChanged(IDataSeries_1.EDataChangeType.Insert, startIndex, 1);
217
+ }
218
+ };
219
+ /**
220
+ * Inserts a range of X,Y, H, L values at the startIndex
221
+ * @remarks
222
+ * Any changes of the DataSeries will trigger a redraw on the parent {@link SciChartSurface}
223
+ * @param startIndex the index to insert at
224
+ * @param xValues the XValues
225
+ * @param yValues the YValues
226
+ * @param hValues the HValues
227
+ * @param lValues the LValues
228
+ * @param metadata The array of point metadata
229
+ */
230
+ HlcDataSeries.prototype.insertRange = function (startIndex, xValues, yValues, hValues, lValues, metadata) {
231
+ if (!this.getIsDeleted()) {
232
+ Guard_1.Guard.isTrue((0, NumberArray_1.isNumberArray)(xValues) || (0, NumberArray_1.isTypedArray)(xValues), "xValues must be an array of numbers");
233
+ Guard_1.Guard.isTrue((0, NumberArray_1.isNumberArray)(yValues) || (0, NumberArray_1.isTypedArray)(yValues), "yValues must be an array of numbers");
234
+ Guard_1.Guard.isTrue((0, NumberArray_1.isNumberArray)(hValues) || (0, NumberArray_1.isTypedArray)(hValues), "hValues must be an array of numbers");
235
+ Guard_1.Guard.isTrue((0, NumberArray_1.isNumberArray)(lValues) || (0, NumberArray_1.isTypedArray)(lValues), "lValues must be an array of numbers");
236
+ this.validateIndex(startIndex, "Start index is out of range");
237
+ Guard_1.Guard.arraysSameLengthArr([
238
+ { arg: xValues, name: "xValues" },
239
+ { arg: yValues, name: "yValues" },
240
+ { arg: hValues, name: "hValues" },
241
+ { arg: lValues, name: "lValues" }
242
+ ]);
243
+ if (metadata) {
244
+ Guard_1.Guard.isTrue(Array.isArray(metadata), "metadata must be an array of IPointMetadata");
245
+ Guard_1.Guard.arraysSameLength(xValues, "xValues", metadata, "metadata");
246
+ }
247
+ var nativeX = this.getNativeXValues();
248
+ this.dataDistributionCalculator.onInsert(this.isSorted, this.containsNaN, nativeX, xValues, yValues, startIndex);
249
+ (0, appendDoubleVectorFromJsArray_1.insertDoubleVectorFromJsArray)(this.webAssemblyContext, xValues, nativeX, startIndex);
250
+ (0, appendDoubleVectorFromJsArray_1.insertDoubleVectorFromJsArray)(this.webAssemblyContext, yValues, this.getNativeYValues(), startIndex);
251
+ (0, appendDoubleVectorFromJsArray_1.insertDoubleVectorFromJsArray)(this.webAssemblyContext, hValues, this.getNativeHighValues(), startIndex);
252
+ (0, appendDoubleVectorFromJsArray_1.insertDoubleVectorFromJsArray)(this.webAssemblyContext, lValues, this.getNativeLowValues(), startIndex);
253
+ this.insertMetadataRange(startIndex, metadata);
254
+ this.notifyDataChanged(IDataSeries_1.EDataChangeType.Insert, startIndex, xValues.length);
255
+ }
256
+ };
257
+ /**
258
+ * Removes a single X,Y, H, L value at the specified index
259
+ * @remarks Any changes of the DataSeries will trigger a redraw on the parent {@link SciChartSurface}
260
+ * @param index the index to remove at
261
+ */
262
+ HlcDataSeries.prototype.removeAt = function (index) {
263
+ if (!this.getIsDeleted()) {
264
+ this.validateIndex(index);
265
+ this.getNativeXValues().removeAt(index);
266
+ this.getNativeYValues().removeAt(index);
267
+ this.getNativeHighValues().removeAt(index);
268
+ this.getNativeLowValues().removeAt(index);
269
+ this.removeMetadataAt(index);
270
+ this.notifyDataChanged(IDataSeries_1.EDataChangeType.Remove, index, 1);
271
+ }
272
+ };
273
+ /**
274
+ * Removes a range of X, Y, H, L values at the specified index
275
+ * @remarks Any changes of the DataSeries will trigger a redraw on the parent {@link SciChartSurface}
276
+ * @param startIndex the start index to remove at
277
+ * @param count the number of points to remove
278
+ */
279
+ HlcDataSeries.prototype.removeRange = function (startIndex, count) {
280
+ if (!this.getIsDeleted()) {
281
+ this.validateIndex(startIndex, "Start index is out of range");
282
+ this.getNativeXValues().removeRange(startIndex, count);
283
+ this.getNativeYValues().removeRange(startIndex, count);
284
+ this.getNativeHighValues().removeRange(startIndex, count);
285
+ this.getNativeLowValues().removeRange(startIndex, count);
286
+ this.removeMetadataRange(startIndex, count);
287
+ this.notifyDataChanged(IDataSeries_1.EDataChangeType.Remove, startIndex, count);
288
+ }
289
+ };
290
+ /**
291
+ * Clears the entire DataSeries.
292
+ * @remarks
293
+ * Note this does not free memory, WebAssembly/Native memory is released by calling {@link delete}, after which the
294
+ * DataSeries is no longer usable.
295
+ *
296
+ * Any changes of the DataSeries will trigger a redraw on the parent {@link SciChartSurface}
297
+ */
298
+ HlcDataSeries.prototype.clear = function () {
299
+ if (!this.getIsDeleted()) {
300
+ _super.prototype.clear.call(this);
301
+ this.getNativeXValues().clear();
302
+ this.getNativeYValues().clear();
303
+ this.getNativeHighValues().clear();
304
+ this.getNativeLowValues().clear();
305
+ this.setMetadata(undefined);
306
+ this.notifyDataChanged(IDataSeries_1.EDataChangeType.Clear, null, null);
307
+ }
308
+ };
309
+ /** @inheritDoc */
310
+ HlcDataSeries.prototype.getXRange = function (dataSeriesValueType, isHorizontalDirection, hasHighCap, hasLowCap) {
311
+ var xValues = this.getXValues(dataSeriesValueType);
312
+ var _a = this.getHlcValues(dataSeriesValueType), hValues = _a.hValues, lValues = _a.lValues;
313
+ var temp;
314
+ if (isHorizontalDirection) {
315
+ if (this.count() === 1) {
316
+ // TODO check if logic is valid here
317
+ var minValues = hasLowCap ? lValues : xValues;
318
+ var maxValues = hasHighCap ? hValues : xValues;
319
+ var min = minValues.get(0) - 1;
320
+ var max = maxValues.get(0) + 1;
321
+ return new NumberRange_1.NumberRange(min, max);
322
+ }
323
+ else if (this.count() > 1) {
324
+ var min = void 0;
325
+ var max = void 0;
326
+ var minMax = void 0;
327
+ try {
328
+ // TODO probably can be optimized, make sure there are no memory leaks here
329
+ minMax = this.webAssemblyContext.NumberUtil.MinMax(hasLowCap ? this.getNativeLowValues() : this.getNativeXValues());
330
+ min = minMax.minD;
331
+ minMax = this.webAssemblyContext.NumberUtil.MinMax(hasHighCap ? this.getNativeHighValues() : this.getNativeXValues());
332
+ max = minMax.maxD;
333
+ if (!(0, isRealNumber_1.isRealNumber)(min) || !(0, isRealNumber_1.isRealNumber)(max)) {
334
+ return new NumberRange_1.NumberRange(0, 0);
335
+ }
336
+ }
337
+ finally {
338
+ (0, Deleter_1.deleteSafe)(minMax);
339
+ }
340
+ if (min === max) {
341
+ return new NumberRange_1.NumberRange(min - 1, max + 1);
342
+ }
343
+ else if (min > max) {
344
+ temp = min;
345
+ min = max;
346
+ max = temp;
347
+ }
348
+ return new NumberRange_1.NumberRange(min, max);
349
+ }
350
+ }
351
+ else {
352
+ if (this.count() === 1) {
353
+ var min = xValues.get(0) - 1;
354
+ var max = xValues.get(0) + 1;
355
+ return new NumberRange_1.NumberRange(min, max);
356
+ }
357
+ else if (this.count() > 1) {
358
+ var min = xValues.get(0);
359
+ var max = xValues.get(this.count() - 1);
360
+ if (!this.dataDistributionCalculator.isSortedAscending) {
361
+ var minMax = void 0;
362
+ try {
363
+ minMax = this.webAssemblyContext.NumberUtil.MinMax(this.getNativeXValues());
364
+ if (!(0, isRealNumber_1.isRealNumber)(minMax.minD) || !(0, isRealNumber_1.isRealNumber)(minMax.maxD)) {
365
+ return new NumberRange_1.NumberRange(0, 0);
366
+ }
367
+ min = minMax.minD;
368
+ max = minMax.maxD;
369
+ }
370
+ finally {
371
+ (0, Deleter_1.deleteSafe)(minMax);
372
+ }
373
+ }
374
+ if (min === max) {
375
+ return new NumberRange_1.NumberRange(min - 1, max + 1);
376
+ }
377
+ else if (min > max) {
378
+ temp = min;
379
+ min = max;
380
+ max = temp;
381
+ }
382
+ return new NumberRange_1.NumberRange(min, max);
383
+ }
384
+ }
385
+ return new NumberRange_1.NumberRange(0, 0);
386
+ };
387
+ /** @inheritDoc */
388
+ HlcDataSeries.prototype.getWindowedYRange = function (xRange, getPositiveRange, isXCategoryAxis, dataSeriesValueType, isHorizontalDirection, hasHighCap, hasLowCap) {
389
+ if (isXCategoryAxis === void 0) { isXCategoryAxis = false; }
390
+ if (dataSeriesValueType === void 0) { dataSeriesValueType = IDataSeries_1.EDataSeriesValueType.Default; }
391
+ if (isHorizontalDirection === void 0) { isHorizontalDirection = false; }
392
+ var _a = this.getHlcValues(dataSeriesValueType), hValues = _a.hValues, lValues = _a.lValues, yValues = _a.yValues;
393
+ // TODO: getPositiveRange
394
+ // if one point
395
+ if (this.count() === 1 && !isHorizontalDirection) {
396
+ if (isHorizontalDirection) {
397
+ var min = yValues.get(0) - 1;
398
+ var max = yValues.get(0) + 1;
399
+ return new NumberRange_1.NumberRange(min, max);
400
+ }
401
+ else {
402
+ var min = Math.min(hValues.get(0), lValues.get(0)) - 1;
403
+ var max = Math.max(hValues.get(0), lValues.get(0)) + 1;
404
+ return new NumberRange_1.NumberRange(min, max);
405
+ }
406
+ }
407
+ var indicesRange = isXCategoryAxis ? xRange : this.getIndicesRange(xRange);
408
+ var yMin = Number.MAX_VALUE;
409
+ var yMax = Number.MIN_VALUE;
410
+ var iMin = Math.max(Math.floor(indicesRange.min), 0);
411
+ var iMax = Math.min(Math.ceil(indicesRange.max), this.count() - 1);
412
+ if (iMax < iMin) {
413
+ return undefined;
414
+ }
415
+ // TODO handle log axis
416
+ // TODO check for memory leaks
417
+ if (isHorizontalDirection) {
418
+ var minMax = void 0;
419
+ try {
420
+ minMax = this.webAssemblyContext.NumberUtil.MinMaxWithIndex(yValues, iMin, iMax - iMin + 1);
421
+ if (!(0, isRealNumber_1.isRealNumber)(minMax.minD) || !(0, isRealNumber_1.isRealNumber)(minMax.maxD)) {
422
+ return new NumberRange_1.NumberRange(0, 0);
423
+ }
424
+ yMin = minMax.minD;
425
+ yMax = minMax.maxD;
426
+ }
427
+ finally {
428
+ (0, Deleter_1.deleteSafe)(minMax);
429
+ }
430
+ }
431
+ else {
432
+ var maxValues = hasHighCap ? hValues : yValues;
433
+ var minValues = hasLowCap ? lValues : yValues;
434
+ var minMax = void 0;
435
+ try {
436
+ minMax = this.webAssemblyContext.NumberUtil.MinMaxWithIndex(maxValues, iMin, iMax - iMin + 1);
437
+ if (!(0, isRealNumber_1.isRealNumber)(minMax.minD) || !(0, isRealNumber_1.isRealNumber)(minMax.maxD)) {
438
+ return new NumberRange_1.NumberRange(0, 0);
439
+ }
440
+ yMax = minMax.maxD;
441
+ minMax = this.webAssemblyContext.NumberUtil.MinMaxWithIndex(minValues, iMin, iMax - iMin + 1);
442
+ if (!(0, isRealNumber_1.isRealNumber)(minMax.minD) || !(0, isRealNumber_1.isRealNumber)(minMax.maxD)) {
443
+ return new NumberRange_1.NumberRange(0, 0);
444
+ }
445
+ yMin = minMax.minD;
446
+ }
447
+ finally {
448
+ (0, Deleter_1.deleteSafe)(minMax);
449
+ }
450
+ }
451
+ return new NumberRange_1.NumberRange(yMin, yMax);
452
+ };
453
+ /** @inheritDoc */
454
+ HlcDataSeries.prototype.delete = function () {
455
+ this.highValues = (0, Deleter_1.deleteSafe)(this.highValues);
456
+ this.lowValues = (0, Deleter_1.deleteSafe)(this.lowValues);
457
+ this.hInitialAnimationValues = (0, Deleter_1.deleteSafe)(this.hInitialAnimationValues);
458
+ this.hFinalAnimationValues = (0, Deleter_1.deleteSafe)(this.hFinalAnimationValues);
459
+ this.lInitialAnimationValues = (0, Deleter_1.deleteSafe)(this.lInitialAnimationValues);
460
+ this.lFinalAnimationValues = (0, Deleter_1.deleteSafe)(this.lFinalAnimationValues);
461
+ _super.prototype.delete.call(this);
462
+ };
463
+ /** @inheritDoc */
464
+ HlcDataSeries.prototype.setInitialAnimationVectors = function (dataSeries) {
465
+ _super.prototype.setInitialAnimationVectors.call(this, dataSeries);
466
+ if (!dataSeries) {
467
+ this.hInitialAnimationValues.resize(0, 0);
468
+ this.lInitialAnimationValues.resize(0, 0);
469
+ return;
470
+ }
471
+ animationHelpers_1.animationHelpers.copyVector(dataSeries.getNativeHighValues(), this.hInitialAnimationValues);
472
+ animationHelpers_1.animationHelpers.copyVector(dataSeries.getNativeLowValues(), this.lInitialAnimationValues);
473
+ };
474
+ /** @inheritDoc */
475
+ HlcDataSeries.prototype.setFinalAnimationVectors = function (dataSeries) {
476
+ _super.prototype.setFinalAnimationVectors.call(this, dataSeries);
477
+ if (!dataSeries) {
478
+ this.hFinalAnimationValues.resize(0, 0);
479
+ this.lFinalAnimationValues.resize(0, 0);
480
+ return;
481
+ }
482
+ animationHelpers_1.animationHelpers.copyVector(dataSeries.getNativeHighValues(), this.hFinalAnimationValues);
483
+ animationHelpers_1.animationHelpers.copyVector(dataSeries.getNativeLowValues(), this.lFinalAnimationValues);
484
+ };
485
+ /** @inheritDoc */
486
+ HlcDataSeries.prototype.validateAnimationVectors = function () {
487
+ _super.prototype.validateAnimationVectors.call(this);
488
+ var size = this.xInitialAnimationValues.size();
489
+ if (size !== this.hInitialAnimationValues.size() ||
490
+ size !== this.hFinalAnimationValues.size() ||
491
+ size !== this.lInitialAnimationValues.size() ||
492
+ size !== this.lFinalAnimationValues.size()) {
493
+ throw Error("initialAnimationValues and finalAnimationValues must have the same length");
494
+ }
495
+ };
496
+ /** @inheritDoc */
497
+ HlcDataSeries.prototype.updateAnimationProperties = function (progress, animation) {
498
+ _super.prototype.updateAnimationProperties.call(this, progress, animation);
499
+ if (animation.isOnStartAnimation) {
500
+ animation.calculateAnimationValues(this.webAssemblyContext, this.hFinalAnimationValues, this.getNativeHighValues(), progress);
501
+ animation.calculateAnimationValues(this.webAssemblyContext, this.lFinalAnimationValues, this.getNativeLowValues(), progress);
502
+ }
503
+ else if (animation.isDataSeriesAnimation) {
504
+ animation.calculateDataSeriesAnimationValues(this.webAssemblyContext, this.hInitialAnimationValues, this.hFinalAnimationValues, this.getNativeHighValues(), progress);
505
+ animation.calculateDataSeriesAnimationValues(this.webAssemblyContext, this.lInitialAnimationValues, this.lFinalAnimationValues, this.getNativeLowValues(), progress);
506
+ }
507
+ };
508
+ /** @inheritDoc */
509
+ HlcDataSeries.prototype.toJSON = function (excludeData) {
510
+ if (excludeData === void 0) { excludeData = false; }
511
+ var json = _super.prototype.toJSON.call(this);
512
+ if (!excludeData) {
513
+ var xValues = [];
514
+ var yValues = [];
515
+ var highValues = [];
516
+ var lowValues = [];
517
+ for (var i = 0; i < this.count(); i++) {
518
+ xValues.push(this.xValues.get(i));
519
+ yValues.push(this.yValues.get(i));
520
+ highValues.push(this.highValues.get(i));
521
+ lowValues.push(this.lowValues.get(i));
522
+ }
523
+ var options = {
524
+ xValues: xValues,
525
+ yValues: yValues,
526
+ highValues: highValues,
527
+ lowValues: lowValues
528
+ };
529
+ Object.assign(json, options);
530
+ }
531
+ return json;
532
+ };
533
+ HlcDataSeries.prototype.getHlcValues = function (dataSeriesValueType) {
534
+ var hValues;
535
+ var lValues;
536
+ var yValues;
537
+ switch (dataSeriesValueType) {
538
+ case IDataSeries_1.EDataSeriesValueType.FinalAnimationValues:
539
+ hValues = this.hFinalAnimationValues;
540
+ lValues = this.lFinalAnimationValues;
541
+ yValues = this.yFinalAnimationValues;
542
+ break;
543
+ case IDataSeries_1.EDataSeriesValueType.InitialAnimationValues:
544
+ hValues = this.hInitialAnimationValues;
545
+ lValues = this.lInitialAnimationValues;
546
+ yValues = this.yInitialAnimationValues;
547
+ break;
548
+ default:
549
+ hValues = this.highValues;
550
+ lValues = this.lowValues;
551
+ yValues = this.yValues;
552
+ }
553
+ return { hValues: hValues, lValues: lValues, yValues: yValues };
554
+ };
555
+ return HlcDataSeries;
556
+ }(BaseDataSeries_1.BaseDataSeries));
557
+ exports.HlcDataSeries = HlcDataSeries;
@@ -30,7 +30,11 @@ export declare enum EDataSeriesType {
30
30
  /**
31
31
  * Defines a {@link UniformHeatmapDataSeries | DataSeries}
32
32
  */
33
- HeatmapUniform = "UniformHeatmap"
33
+ HeatmapUniform = "UniformHeatmap",
34
+ /**
35
+ * Defines a {@link HlcDataSeries}
36
+ */
37
+ Hlc = "Hlc"
34
38
  }
35
39
  export declare enum EDataChangeType {
36
40
  Append = 0,
@@ -29,6 +29,10 @@ var EDataSeriesType;
29
29
  * Defines a {@link UniformHeatmapDataSeries | DataSeries}
30
30
  */
31
31
  EDataSeriesType["HeatmapUniform"] = "UniformHeatmap";
32
+ /**
33
+ * Defines a {@link HlcDataSeries}
34
+ */
35
+ EDataSeriesType["Hlc"] = "Hlc";
32
36
  })(EDataSeriesType = exports.EDataSeriesType || (exports.EDataSeriesType = {}));
33
37
  var EDataChangeType;
34
38
  (function (EDataChangeType) {
@@ -0,0 +1,10 @@
1
+ import { SCRTDoubleVector } from "../../../types/TSciChart";
2
+ import { HlcDataSeries } from "../HlcDataSeries";
3
+ import { BasePointSeriesWrapped } from "./BasePointSeriesWrapped";
4
+ import { IHlcPointSeries } from "./IPointSeries";
5
+ export declare class HlcPointSeriesWrapped extends BasePointSeriesWrapped implements IHlcPointSeries {
6
+ readonly highValues: SCRTDoubleVector;
7
+ readonly lowValues: SCRTDoubleVector;
8
+ readonly closeValues: SCRTDoubleVector;
9
+ constructor(dataSeries: HlcDataSeries);
10
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.HlcPointSeriesWrapped = void 0;
19
+ var BasePointSeriesWrapped_1 = require("./BasePointSeriesWrapped");
20
+ var HlcPointSeriesWrapped = /** @class */ (function (_super) {
21
+ __extends(HlcPointSeriesWrapped, _super);
22
+ function HlcPointSeriesWrapped(dataSeries) {
23
+ var _this = _super.call(this, dataSeries) || this;
24
+ _this.highValues = dataSeries.getNativeHighValues();
25
+ _this.lowValues = dataSeries.getNativeLowValues();
26
+ _this.closeValues = _this.yValues;
27
+ return _this;
28
+ }
29
+ return HlcPointSeriesWrapped;
30
+ }(BasePointSeriesWrapped_1.BasePointSeriesWrapped));
31
+ exports.HlcPointSeriesWrapped = HlcPointSeriesWrapped;
@@ -23,6 +23,11 @@ export interface IXyyPointSeries extends IPointSeries {
23
23
  export interface IXyzPointSeries extends IPointSeries {
24
24
  readonly zValues: SCRTDoubleVector;
25
25
  }
26
+ export interface IHlcPointSeries extends IPointSeries {
27
+ readonly highValues: SCRTDoubleVector;
28
+ readonly lowValues: SCRTDoubleVector;
29
+ readonly closeValues: SCRTDoubleVector;
30
+ }
26
31
  export interface IOhlcPointSeries extends IPointSeries {
27
32
  readonly openValues: SCRTDoubleVector;
28
33
  readonly highValues: SCRTDoubleVector;
@@ -1,8 +1,8 @@
1
+ import { NumberRange } from "../../../Core/NumberRange";
1
2
  import { TSciChart } from "../../../types/TSciChart";
2
3
  import { TSciChart3D } from "../../../types/TSciChart3D";
3
- import { CoordinateCalculatorBase } from "./CoordinateCalculatorBase";
4
4
  import { EXyDirection } from "../../../types/XyDirection";
5
- import { NumberRange } from "../../../Core/NumberRange";
5
+ import { CoordinateCalculatorBase } from "./CoordinateCalculatorBase";
6
6
  /**
7
7
  * Provides an implementation of Numeric {@link CoordinateCalculatorBase | Coordinate Calculator} which transforms
8
8
  * numeric data-values to pixel coordinates using logarithmic scaling and vice versa.