scichart 2.0.2228 → 2.1.2273

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 (199) hide show
  1. package/Charting/ChartModifiers/DataPointSelectionModifier.js +0 -1
  2. package/Charting/ChartModifiers/LegendModifier.d.ts +2 -2
  3. package/Charting/ChartModifiers/RolloverModifier.d.ts +5 -3
  4. package/Charting/ChartModifiers/RolloverModifier.js +38 -80
  5. package/Charting/Drawing/WebGlRenderContext2D.d.ts +1 -0
  6. package/Charting/Drawing/WebGlRenderContext2D.js +4 -1
  7. package/Charting/Model/BaseDataSeries.d.ts +42 -15
  8. package/Charting/Model/BaseDataSeries.js +77 -28
  9. package/Charting/Model/BaseHeatmapDataSeries.d.ts +31 -23
  10. package/Charting/Model/BaseHeatmapDataSeries.js +45 -18
  11. package/Charting/Model/DataDistributionCalculator/DataDistributionCalculator.d.ts +23 -0
  12. package/Charting/Model/DataDistributionCalculator/DataDistributionCalculator.js +122 -0
  13. package/Charting/Model/DataDistributionCalculator/IDataDistributionCalculator.d.ts +57 -0
  14. package/Charting/Model/DataDistributionCalculator/IDataDistributionCalculator.js +2 -0
  15. package/Charting/Model/Filters/OhlcFilterBase.d.ts +2 -2
  16. package/Charting/Model/Filters/XyFilterBase.d.ts +3 -3
  17. package/Charting/Model/Filters/XyMovingAverageFilter.js +1 -1
  18. package/Charting/Model/Filters/XyyFilterBase.d.ts +4 -4
  19. package/Charting/Model/Filters/XyzFilterBase.d.ts +4 -4
  20. package/Charting/Model/IDataSeries.d.ts +37 -5
  21. package/Charting/Model/OhlcDataSeries.d.ts +12 -11
  22. package/Charting/Model/OhlcDataSeries.js +37 -34
  23. package/Charting/Model/PointSeries/BasePointSeriesResampled.d.ts +21 -0
  24. package/Charting/Model/PointSeries/BasePointSeriesResampled.js +56 -0
  25. package/Charting/Model/PointSeries/BasePointSeriesWrapped.d.ts +14 -0
  26. package/Charting/Model/PointSeries/BasePointSeriesWrapped.js +23 -0
  27. package/Charting/Model/PointSeries/IPointSeries.d.ts +31 -0
  28. package/Charting/Model/PointSeries/IPointSeries.js +2 -0
  29. package/Charting/Model/PointSeries/OhlcPointSeriesResampled.d.ts +13 -0
  30. package/Charting/Model/PointSeries/OhlcPointSeriesResampled.js +59 -0
  31. package/Charting/Model/PointSeries/OhlcPointSeriesWrapped.d.ts +11 -0
  32. package/Charting/Model/PointSeries/OhlcPointSeriesWrapped.js +32 -0
  33. package/Charting/Model/PointSeries/XyPointSeriesResampled.d.ts +7 -0
  34. package/Charting/Model/PointSeries/XyPointSeriesResampled.js +27 -0
  35. package/Charting/Model/PointSeries/XyPointSeriesWrapped.d.ts +6 -0
  36. package/Charting/Model/PointSeries/XyPointSeriesWrapped.js +27 -0
  37. package/Charting/Model/PointSeries/XyyPointSeriesResampled.d.ts +10 -0
  38. package/Charting/Model/PointSeries/XyyPointSeriesResampled.js +48 -0
  39. package/Charting/Model/PointSeries/XyyPointSeriesWrapped.d.ts +8 -0
  40. package/Charting/Model/PointSeries/XyyPointSeriesWrapped.js +29 -0
  41. package/Charting/Model/PointSeries/XyzPointSeriesWrapped.d.ts +8 -0
  42. package/Charting/Model/PointSeries/XyzPointSeriesWrapped.js +29 -0
  43. package/Charting/Model/XyDataSeries.d.ts +3 -2
  44. package/Charting/Model/XyDataSeries.js +22 -22
  45. package/Charting/Model/XyyDataSeries.d.ts +5 -5
  46. package/Charting/Model/XyyDataSeries.js +24 -21
  47. package/Charting/Model/XyzDataSeries.d.ts +5 -5
  48. package/Charting/Model/XyzDataSeries.js +24 -21
  49. package/Charting/Numerics/CoordinateCalculators/CategoryCoordinateCalculator.d.ts +2 -2
  50. package/Charting/Numerics/CoordinateCalculators/FlippedCategoryCoordinateCalculator.d.ts +2 -2
  51. package/Charting/Numerics/CoordinateCalculators/FlippedNumericCoordinateCalculator.d.ts +2 -1
  52. package/Charting/Numerics/CoordinateCalculators/FlippedNumericCoordinateCalculator.js +6 -2
  53. package/Charting/Numerics/CoordinateCalculators/NumericCoordinateCalculator.d.ts +2 -1
  54. package/Charting/Numerics/CoordinateCalculators/NumericCoordinateCalculator.js +6 -2
  55. package/Charting/Numerics/Resamplers/ExtremeResamplerHelper.d.ts +54 -0
  56. package/Charting/Numerics/Resamplers/ExtremeResamplerHelper.js +234 -0
  57. package/Charting/Numerics/Resamplers/ResamplingMode.d.ts +37 -0
  58. package/Charting/Numerics/Resamplers/ResamplingMode.js +41 -0
  59. package/Charting/Numerics/Resamplers/ResamplingParams.d.ts +39 -0
  60. package/Charting/Numerics/Resamplers/ResamplingParams.js +52 -0
  61. package/Charting/Services/RenderPassData.d.ts +6 -1
  62. package/Charting/Services/RenderPassData.js +5 -1
  63. package/Charting/Services/RenderPassInfo.d.ts +18 -0
  64. package/Charting/Services/RenderPassInfo.js +14 -0
  65. package/Charting/Services/SciChartRenderer.d.ts +14 -1
  66. package/Charting/Services/SciChartRenderer.js +125 -31
  67. package/Charting/Visuals/Axis/AxisCore.d.ts +11 -0
  68. package/Charting/Visuals/Axis/AxisCore.js +39 -18
  69. package/Charting/Visuals/Axis/AxisRenderer.d.ts +1 -0
  70. package/Charting/Visuals/Axis/AxisRenderer.js +6 -6
  71. package/Charting/Visuals/Axis/CategoryAxisBase.d.ts +52 -0
  72. package/Charting/Visuals/Axis/CategoryAxisBase.js +94 -20
  73. package/Charting/Visuals/Axis/IAxisCoreOptions.d.ts +5 -0
  74. package/Charting/Visuals/Axis/LabelProvider/SmartDateLabelProvider.js +7 -4
  75. package/Charting/Visuals/Axis/NumericAxis.js +2 -2
  76. package/Charting/Visuals/Axis/constants.d.ts +1 -0
  77. package/Charting/Visuals/Axis/constants.js +1 -0
  78. package/Charting/Visuals/Legend/SciChartLegend.d.ts +6 -0
  79. package/Charting/Visuals/Legend/SciChartLegend.js +30 -13
  80. package/Charting/Visuals/Legend/SciChartLegendBase.d.ts +20 -6
  81. package/Charting/Visuals/Legend/SciChartLegendBase.js +22 -4
  82. package/Charting/Visuals/Legend/SciChartPieLegend.d.ts +2 -0
  83. package/Charting/Visuals/Legend/SciChartPieLegend.js +17 -6
  84. package/Charting/Visuals/RenderableSeries/Animations/FadeAnimation.d.ts +2 -2
  85. package/Charting/Visuals/RenderableSeries/Animations/ScaleAnimation.d.ts +2 -2
  86. package/Charting/Visuals/RenderableSeries/Animations/SeriesAnimation.d.ts +3 -3
  87. package/Charting/Visuals/RenderableSeries/Animations/SweepAnimation.d.ts +2 -2
  88. package/Charting/Visuals/RenderableSeries/Animations/WaveAnimation.d.ts +2 -2
  89. package/Charting/Visuals/RenderableSeries/Animations/animationHelpers.d.ts +6 -6
  90. package/Charting/Visuals/RenderableSeries/Animations/animationHelpers.js +2 -2
  91. package/Charting/Visuals/RenderableSeries/BaseBandRenderableSeries.d.ts +9 -2
  92. package/Charting/Visuals/RenderableSeries/BaseBandRenderableSeries.js +45 -1
  93. package/Charting/Visuals/RenderableSeries/BaseLineRenderableSeries.d.ts +1 -0
  94. package/Charting/Visuals/RenderableSeries/BaseLineRenderableSeries.js +1 -0
  95. package/Charting/Visuals/RenderableSeries/BaseMountainRenderableSeries.d.ts +1 -0
  96. package/Charting/Visuals/RenderableSeries/BaseMountainRenderableSeries.js +1 -0
  97. package/Charting/Visuals/RenderableSeries/BaseOhlcRenderableSeries.d.ts +12 -5
  98. package/Charting/Visuals/RenderableSeries/BaseOhlcRenderableSeries.js +113 -0
  99. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.d.ts +42 -6
  100. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.js +129 -21
  101. package/Charting/Visuals/RenderableSeries/BaseStackedCollection.d.ts +36 -4
  102. package/Charting/Visuals/RenderableSeries/BaseStackedCollection.js +51 -3
  103. package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.d.ts +38 -4
  104. package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.js +54 -3
  105. package/Charting/Visuals/RenderableSeries/DrawingProviders/BandSeriesDrawingProvider.d.ts +1 -1
  106. package/Charting/Visuals/RenderableSeries/DrawingProviders/BandSeriesDrawingProvider.js +8 -14
  107. package/Charting/Visuals/RenderableSeries/DrawingProviders/BaseSeriesDrawingProvider.js +4 -3
  108. package/Charting/Visuals/RenderableSeries/DrawingProviders/BubbleSeriesDrawingProvider.js +5 -11
  109. package/Charting/Visuals/RenderableSeries/DrawingProviders/ColumnSeriesDrawingProvider.d.ts +1 -0
  110. package/Charting/Visuals/RenderableSeries/DrawingProviders/ColumnSeriesDrawingProvider.js +31 -19
  111. package/Charting/Visuals/RenderableSeries/DrawingProviders/LineSeriesDrawingProvider.d.ts +2 -1
  112. package/Charting/Visuals/RenderableSeries/DrawingProviders/LineSeriesDrawingProvider.js +17 -21
  113. package/Charting/Visuals/RenderableSeries/DrawingProviders/MountainSeriesDrawingProvider.js +6 -12
  114. package/Charting/Visuals/RenderableSeries/DrawingProviders/OhlcSeriesDrawingProvider.js +9 -15
  115. package/Charting/Visuals/RenderableSeries/DrawingProviders/PointMarkerDrawingProvider.d.ts +4 -3
  116. package/Charting/Visuals/RenderableSeries/DrawingProviders/PointMarkerDrawingProvider.js +16 -21
  117. package/Charting/Visuals/RenderableSeries/DrawingProviders/UniformContoursDrawingProvider.js +2 -9
  118. package/Charting/Visuals/RenderableSeries/DrawingProviders/UniformHeatmapDrawingProvider.js +0 -7
  119. package/Charting/Visuals/RenderableSeries/FastBubbleRenderableSeries.d.ts +11 -2
  120. package/Charting/Visuals/RenderableSeries/FastBubbleRenderableSeries.js +17 -0
  121. package/Charting/Visuals/RenderableSeries/FastColumnRenderableSeries.d.ts +1 -0
  122. package/Charting/Visuals/RenderableSeries/FastColumnRenderableSeries.js +1 -0
  123. package/Charting/Visuals/RenderableSeries/FastLineRenderableSeries.d.ts +1 -0
  124. package/Charting/Visuals/RenderableSeries/FastLineRenderableSeries.js +6 -0
  125. package/Charting/Visuals/RenderableSeries/HitTest/BandSeriesHitTestProvider.js +2 -2
  126. package/Charting/Visuals/RenderableSeries/HitTest/BaseHitTestProvider.js +1 -1
  127. package/Charting/Visuals/RenderableSeries/HitTest/BubbleSeriesHitTestProvider.js +1 -1
  128. package/Charting/Visuals/RenderableSeries/HitTest/ColumnSeriesHitTestProvider.js +2 -2
  129. package/Charting/Visuals/RenderableSeries/HitTest/LineSeriesHitTestProvider.js +2 -2
  130. package/Charting/Visuals/RenderableSeries/HitTest/MountainSeriesHitTestProvider.js +1 -1
  131. package/Charting/Visuals/RenderableSeries/HitTest/OhlcSeriesHitTestProvider.js +2 -2
  132. package/Charting/Visuals/RenderableSeries/HitTest/ScatterSeriesHitTestProvider.js +1 -1
  133. package/Charting/Visuals/RenderableSeries/HitTest/StackedColumnSeriesHitTestProvider.js +2 -2
  134. package/Charting/Visuals/RenderableSeries/HitTest/StackedMountainSeriesHitTestProvider.js +2 -2
  135. package/Charting/Visuals/RenderableSeries/HitTest/hitTestHelpers.d.ts +6 -6
  136. package/Charting/Visuals/RenderableSeries/HitTest/hitTestHelpers.js +1 -1
  137. package/Charting/Visuals/RenderableSeries/IBaseRenderableSeriesOptions.d.ts +12 -1
  138. package/Charting/Visuals/RenderableSeries/IRenderableSeries.d.ts +38 -2
  139. package/Charting/Visuals/RenderableSeries/ISpline.d.ts +3 -3
  140. package/Charting/Visuals/RenderableSeries/SplineBandRenderableSeries.d.ts +4 -4
  141. package/Charting/Visuals/RenderableSeries/SplineBandRenderableSeries.js +5 -5
  142. package/Charting/Visuals/RenderableSeries/SplineLineRenderableSeries.d.ts +3 -3
  143. package/Charting/Visuals/RenderableSeries/SplineLineRenderableSeries.js +3 -3
  144. package/Charting/Visuals/RenderableSeries/SplineMountainRenderableSeries.d.ts +3 -3
  145. package/Charting/Visuals/RenderableSeries/SplineMountainRenderableSeries.js +3 -3
  146. package/Charting/Visuals/RenderableSeries/StackedColumnCollection.js +2 -7
  147. package/Charting/Visuals/RenderableSeries/StackedMountainCollection.d.ts +1 -1
  148. package/Charting/Visuals/RenderableSeries/StackedMountainCollection.js +1 -7
  149. package/Charting/Visuals/RenderableSeries/UniformContoursRenderableSeries.d.ts +5 -0
  150. package/Charting/Visuals/RenderableSeries/UniformContoursRenderableSeries.js +6 -0
  151. package/Charting/Visuals/RenderableSeries/UniformHeatmapRenderableSeries.d.ts +5 -0
  152. package/Charting/Visuals/RenderableSeries/UniformHeatmapRenderableSeries.js +6 -0
  153. package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.d.ts +5 -3
  154. package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.js +6 -3
  155. package/Charting/Visuals/RenderableSeries/constants.d.ts +3 -0
  156. package/Charting/Visuals/RenderableSeries/constants.js +3 -0
  157. package/Charting/Visuals/SciChartDefaults.d.ts +9 -1
  158. package/Charting/Visuals/SciChartDefaults.js +9 -1
  159. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.d.ts +4 -2
  160. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.js +46 -32
  161. package/Charting/Visuals/licenseManager2D.js +21 -20
  162. package/Charting/Visuals/licenseManager2dState.d.ts +4 -0
  163. package/Charting/Visuals/licenseManager2dState.js +12 -0
  164. package/Charting/Visuals/loader.js +2 -0
  165. package/Charting/Visuals/sciChartInitCommon.js +4 -0
  166. package/Charting3D/Model/DataSeries/XyzDataSeries3D.d.ts +7 -7
  167. package/Charting3D/Model/DataSeries/XyzDataSeries3D.js +3 -3
  168. package/Core/BuildStamp.d.ts +1 -1
  169. package/Core/BuildStamp.js +2 -2
  170. package/Core/OneTimePerformanceWarning.d.ts +6 -0
  171. package/Core/OneTimePerformanceWarning.js +19 -0
  172. package/Core/storage/localStorageApi.d.ts +9 -0
  173. package/Core/storage/localStorageApi.js +32 -0
  174. package/README.md +223 -1
  175. package/_wasm/scichart.browser.js +1 -1
  176. package/_wasm/scichart2d.js +12 -12
  177. package/_wasm/scichart2d.wasm +0 -0
  178. package/_wasm/scichart3d.js +13 -13
  179. package/_wasm/scichart3d.wasm +0 -0
  180. package/constants/performanceWarnings.d.ts +5 -0
  181. package/constants/performanceWarnings.js +8 -0
  182. package/package.json +1 -1
  183. package/types/SearchMode.d.ts +21 -0
  184. package/types/SearchMode.js +25 -0
  185. package/types/TSciChart.d.ts +144 -40
  186. package/types/TSciChart3D.d.ts +66 -28
  187. package/utils/array.d.ts +7 -0
  188. package/utils/array.js +19 -1
  189. package/utils/calcAverage.d.ts +2 -2
  190. package/utils/ccall/appendDoubleVectorFromJsArray.d.ts +19 -0
  191. package/utils/ccall/appendDoubleVectorFromJsArray.js +91 -0
  192. package/utils/hash.d.ts +7 -0
  193. package/utils/hash.js +35 -0
  194. package/utils/tooltip.d.ts +42 -0
  195. package/utils/tooltip.js +119 -0
  196. package/utils/ccall/fillDoubleVectorFromJsArray.d.ts +0 -3
  197. package/utils/ccall/fillDoubleVectorFromJsArray.js +0 -33
  198. package/utils/performance.d.ts +0 -5
  199. package/utils/performance.js +0 -11
@@ -11,15 +11,17 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SciChartRenderer = void 0;
13
13
  var Dictionary_1 = require("../../Core/Dictionary");
14
- var NumberRange_1 = require("../../Core/NumberRange");
15
14
  var Rect_1 = require("../../Core/Rect");
16
15
  var AutoRange_1 = require("../../types/AutoRange");
17
16
  var AxisAlignment_1 = require("../../types/AxisAlignment");
18
17
  var RenderLayer_1 = require("../../types/RenderLayer");
18
+ var hash_1 = require("../../utils/hash");
19
+ var ResamplingParams_1 = require("../Numerics/Resamplers/ResamplingParams");
19
20
  var IAnnotation_1 = require("../Visuals/Annotations/IAnnotation");
20
21
  var SciChartSurfaceBase_1 = require("../Visuals/SciChartSurfaceBase");
21
22
  var DpiHelper_1 = require("../Visuals/TextureManager/DpiHelper");
22
23
  var RenderPassData_1 = require("./RenderPassData");
24
+ var RenderPassInfo_1 = require("./RenderPassInfo");
23
25
  /**
24
26
  * A class used internally in SciChart to perform layout, arrangement, data-preparation and rendering on the Cartesian 2D {@link SciChartSurface}
25
27
  */
@@ -31,6 +33,66 @@ var SciChartRenderer = /** @class */ (function () {
31
33
  function SciChartRenderer(sciChartSurface) {
32
34
  this.sciChartSurface = sciChartSurface;
33
35
  }
36
+ /**
37
+ * Used internally
38
+ * @param xAxis
39
+ * @param rs
40
+ * @param seriesViewRect
41
+ */
42
+ SciChartRenderer.resampleSeries = function (xAxis, rs, seriesViewRect) {
43
+ /**
44
+ * Stacked series and Heatmap do not support resampling
45
+ * If a series does not support resampling, the pointSeries is not used in the drawing provider.
46
+ * For example, UniformHeatmapDrawingProvider does not use renderPassData.pointSeries,
47
+ * but LineSeriesDrawingProvider use renderPassData.pointSeries in the draw() method!
48
+ */
49
+ if (!rs.supportsResampling)
50
+ return {
51
+ pointSeries: rs.toPointSeries(),
52
+ renderableSeries: rs,
53
+ indicesRange: undefined,
54
+ resamplingHash: undefined
55
+ };
56
+ var rp = new ResamplingParams_1.ResamplingParams(seriesViewRect, rs, xAxis);
57
+ if (!rs.needsResampling(rp))
58
+ return {
59
+ pointSeries: rs.toPointSeries(),
60
+ renderableSeries: rs,
61
+ indicesRange: undefined,
62
+ resamplingHash: undefined
63
+ };
64
+ var resamplingHash = SciChartRenderer.calculateResamplingHash(rs, rp);
65
+ var prevRPD = rs.getCurrentRenderPassData();
66
+ var useFromCache = Boolean(prevRPD && prevRPD.resamplingHash === resamplingHash);
67
+ // console.log("resampling ...");
68
+ // console.log("useFromCache", useFromCache);
69
+ var pointSeries = useFromCache ? prevRPD.pointSeries : rs.toPointSeries(rp);
70
+ return {
71
+ pointSeries: pointSeries,
72
+ renderableSeries: rs,
73
+ indicesRange: rp.indexesRange,
74
+ resamplingHash: resamplingHash
75
+ };
76
+ };
77
+ SciChartRenderer.calculateResamplingHash = function (rs, rp) {
78
+ var hashes = [];
79
+ var enableDrawingOptimizationsHash = hash_1.hashUtils.generateBooleanHash(rs.enableDrawingOptimisations);
80
+ hashes.push(enableDrawingOptimizationsHash);
81
+ var dataSeries = rs.dataSeries;
82
+ if (dataSeries) {
83
+ var dataSeriesHash = hash_1.hashUtils.generateHash(dataSeries.id);
84
+ hashes.push(dataSeriesHash);
85
+ var dataSeriesCountHash = hash_1.hashUtils.generateNumberHash(dataSeries.count());
86
+ hashes.push(dataSeriesCountHash);
87
+ var dataSeriesSortedHash = hash_1.hashUtils.generateBooleanHash(dataSeries.dataDistributionCalculator.isSortedAscending);
88
+ hashes.push(dataSeriesSortedHash);
89
+ var dataSeriesChangeCountHash = hash_1.hashUtils.generateNumberHash(dataSeries.changeCount);
90
+ hashes.push(dataSeriesChangeCountHash);
91
+ }
92
+ var resamplingParamsHash = hash_1.hashUtils.generateObjectHash(rp);
93
+ hashes.push(resamplingParamsHash);
94
+ return hash_1.hashUtils.generateCombinedHash(hashes);
95
+ };
34
96
  /**
35
97
  * Render loop for the current {@SciChartSurface}
36
98
  * @param renderContext the {@WebGLRenderContext2D} used for drawing
@@ -61,7 +123,8 @@ var SciChartRenderer = /** @class */ (function () {
61
123
  var seriesViewRect = this.sciChartSurface.layoutManager.layoutChart(renderContext.viewportSize);
62
124
  this.updateSvgCanvasSize(seriesViewRect);
63
125
  // Step 4 prepare render data
64
- var xyAxesById = this.prepareRenderData();
126
+ var _a = this.prepareAxesRenderData(), xAxesById = _a.xAxesById, yAxesById = _a.yAxesById;
127
+ var renderPassInfo = this.prepareSeriesRenderData(seriesViewRect, xAxesById);
65
128
  // Draw seriesViewRect border
66
129
  this.sciChartSurface.drawBorder(renderContext);
67
130
  // Step 5 Draw X, Y axis and gridlines
@@ -81,22 +144,21 @@ var SciChartRenderer = /** @class */ (function () {
81
144
  el.type === IAnnotation_1.EAnnotationType.RenderContextAxisMarkerAnnotation);
82
145
  });
83
146
  renderContext.enqueueLayeredDraw(function () {
84
- _this.drawRenderContextAnnotations(renderContextAnnotations, xyAxesById[0], xyAxesById[1], IAnnotation_1.EAnnotationLayer.BelowChart, renderContext, seriesViewRect);
147
+ _this.drawRenderContextAnnotations(renderContextAnnotations, xAxesById, yAxesById, IAnnotation_1.EAnnotationLayer.BelowChart, renderContext, seriesViewRect);
85
148
  }, RenderLayer_1.ERenderLayer.Third);
86
- // queue series rendering after grid lines and bands, but before the axes
87
- renderContext.enqueueLayeredDraw(function () { return _this.drawSeries(_this.sciChartSurface, _this.sciChartSurface.renderableSeries.asArray(), renderContext); }, RenderLayer_1.ERenderLayer.Third);
149
+ // Step 7 Draw series. Queue series rendering after grid lines and bands, but before the axes
150
+ renderContext.enqueueLayeredDraw(function () { return _this.drawSeries(_this.sciChartSurface, renderPassInfo, renderContext); }, RenderLayer_1.ERenderLayer.Third);
88
151
  // Execute rendering of queued elements
89
152
  renderContext.drawLayers();
90
- // Step 7 Draw series
91
153
  // Step 8 Draw annotations above the series
92
- this.drawRenderContextAnnotations(renderContextAnnotations, xyAxesById[0], xyAxesById[1], IAnnotation_1.EAnnotationLayer.AboveChart, renderContext, seriesViewRect);
154
+ this.drawRenderContextAnnotations(renderContextAnnotations, xAxesById, yAxesById, IAnnotation_1.EAnnotationLayer.AboveChart, renderContext, seriesViewRect);
93
155
  // Step 9 Draw SVG or Html Overlays
94
156
  var svgAnnotations = annotations.filter(function (el) {
95
157
  return el.type === IAnnotation_1.EAnnotationType.SVG ||
96
158
  el.type === IAnnotation_1.EAnnotationType.SVGTextAnnotation ||
97
159
  el.type === IAnnotation_1.EAnnotationType.SVGCustomAnnotation;
98
160
  });
99
- this.drawSvgAnnotations(svgAnnotations, xyAxesById[0], xyAxesById[1]);
161
+ this.drawSvgAnnotations(svgAnnotations, xAxesById, yAxesById);
100
162
  // Update watermark
101
163
  this.updateWatermark(renderContext, seriesViewRect);
102
164
  // Step 10 Call OnParentSurfaceRendered
@@ -175,7 +237,7 @@ var SciChartRenderer = /** @class */ (function () {
175
237
  svgRootElement.currentScale = 1;
176
238
  }
177
239
  };
178
- SciChartRenderer.prototype.prepareRenderData = function () {
240
+ SciChartRenderer.prototype.prepareAxesRenderData = function () {
179
241
  var xAxesById = new Dictionary_1.Dictionary();
180
242
  var yAxesById = new Dictionary_1.Dictionary();
181
243
  // Prepare XAxes
@@ -188,7 +250,26 @@ var SciChartRenderer = /** @class */ (function () {
188
250
  yAxesById.add(yAxis.id, yAxis);
189
251
  yAxis.prepareRenderData();
190
252
  });
191
- return [xAxesById, yAxesById];
253
+ return { xAxesById: xAxesById, yAxesById: yAxesById };
254
+ };
255
+ SciChartRenderer.prototype.prepareSeriesRenderData = function (seriesViewRect, xAxesById) {
256
+ var seriesCount = this.sciChartSurface.renderableSeries.size();
257
+ var renderPassInfo = new RenderPassInfo_1.RenderPassInfo(seriesCount, seriesViewRect);
258
+ // TODO: Calculate XRange before resample but YRange after resample for faster autorange on large datasets
259
+ for (var i = 0; i < this.sciChartSurface.renderableSeries.size(); i++) {
260
+ var series = this.sciChartSurface.renderableSeries.get(i);
261
+ // don't try and draw series with no data
262
+ if (!series.isStacked && !series.dataSeries)
263
+ continue;
264
+ // TODO: Do resampling, store result for use in drawing
265
+ var xAxis = xAxesById.item(series.xAxisId);
266
+ var seriesRenderPassInfo = SciChartRenderer.resampleSeries(xAxis, series, seriesViewRect);
267
+ renderPassInfo.renderableSeriesArray.push(seriesRenderPassInfo.renderableSeries);
268
+ renderPassInfo.pointSeriesArray.push(seriesRenderPassInfo.pointSeries);
269
+ renderPassInfo.indicesRanges.push(seriesRenderPassInfo.indicesRange);
270
+ renderPassInfo.resamplingHashes.push(seriesRenderPassInfo.resamplingHash);
271
+ }
272
+ return renderPassInfo;
192
273
  };
193
274
  SciChartRenderer.prototype.drawAxes = function (scs, renderContext) {
194
275
  scs.xAxes.asArray().forEach(function (xAxis) {
@@ -198,31 +279,30 @@ var SciChartRenderer = /** @class */ (function () {
198
279
  yAxis.draw(renderContext);
199
280
  });
200
281
  };
201
- SciChartRenderer.prototype.drawSeries = function (scs, renderableSeries, renderContext) {
202
- var drawSeriesImpl = function (series) {
203
- var indexRange = new NumberRange_1.NumberRange(0, 0);
204
- var xAxis = scs.xAxes.asArray().find(function (a) { return a.id === series.xAxisId; });
205
- if (!xAxis) {
206
- throw Error("Cannot find an X Axis with ID = " + series.xAxisId);
207
- }
208
- var yAxis = scs.yAxes.asArray().find(function (a) { return a.id === series.yAxisId; });
209
- if (!yAxis) {
210
- throw Error("Cannot find a Y Axis with ID = " + series.yAxisId);
211
- }
212
- if (xAxis.isVerticalChart && ![AxisAlignment_1.EAxisAlignment.Top, AxisAlignment_1.EAxisAlignment.Bottom].includes(yAxis.axisAlignment)) {
282
+ SciChartRenderer.prototype.drawSeries = function (scs, renderPassInfo, renderContext) {
283
+ var renderableSeriesArray = renderPassInfo.renderableSeriesArray, pointSeriesArray = renderPassInfo.pointSeriesArray, resamplingHashes = renderPassInfo.resamplingHashes, indicesRanges = renderPassInfo.indicesRanges;
284
+ var drawSeriesImpl = function (index) {
285
+ var renderableSeries = renderableSeriesArray[index];
286
+ var pointSeries = pointSeriesArray[index];
287
+ var resamplingHash = resamplingHashes[index];
288
+ var indexRange = indicesRanges[index];
289
+ var xAxis = scs.xAxes.asArray().find(function (a) { return a.id === renderableSeries.xAxisId; });
290
+ if (!xAxis)
291
+ throw Error("Cannot find an X Axis with ID = " + renderableSeries.xAxisId);
292
+ var yAxis = scs.yAxes.asArray().find(function (a) { return a.id === renderableSeries.yAxisId; });
293
+ if (!yAxis)
294
+ throw Error("Cannot find a Y Axis with ID = " + renderableSeries.yAxisId);
295
+ if (xAxis.isVerticalChart && ![AxisAlignment_1.EAxisAlignment.Top, AxisAlignment_1.EAxisAlignment.Bottom].includes(yAxis.axisAlignment))
213
296
  throw Error("For vertical chart (chart with X Axis alignment Left or Right) Y Axis alignment should be Top or Bottom, X Axis ID = ".concat(xAxis.id));
214
- }
215
- if ((0, AxisAlignment_1.getIsVertical)(xAxis.axisAlignment) && (0, AxisAlignment_1.getIsVertical)(yAxis.axisAlignment)) {
297
+ if ((0, AxisAlignment_1.getIsVertical)(xAxis.axisAlignment) && (0, AxisAlignment_1.getIsVertical)(yAxis.axisAlignment))
216
298
  throw Error("Both x and y axes can't have vertical alignment");
217
- }
218
- if ((0, AxisAlignment_1.getIsHorizontal)(xAxis.axisAlignment) && (0, AxisAlignment_1.getIsHorizontal)(yAxis.axisAlignment)) {
299
+ if ((0, AxisAlignment_1.getIsHorizontal)(xAxis.axisAlignment) && (0, AxisAlignment_1.getIsHorizontal)(yAxis.axisAlignment))
219
300
  throw Error("Both x and y axes can't have horizontal alignment");
220
- }
221
301
  var xCalc = xAxis.getCurrentCoordinateCalculator();
222
302
  var yCalc = yAxis.getCurrentCoordinateCalculator();
223
303
  try {
224
- var renderPassData = new RenderPassData_1.RenderPassData(indexRange, xCalc, yCalc, xAxis.isVerticalChart);
225
- series.draw(renderContext, renderPassData);
304
+ var renderPassData = new RenderPassData_1.RenderPassData(indexRange, xCalc, yCalc, xAxis.isVerticalChart, pointSeries, resamplingHash);
305
+ renderableSeries.draw(renderContext, renderPassData);
226
306
  }
227
307
  finally {
228
308
  // We can not delete calculators because we use them in Hit Test
@@ -230,10 +310,24 @@ var SciChartRenderer = /** @class */ (function () {
230
310
  // yCalc.delete();
231
311
  }
232
312
  };
313
+ var nativeContext = renderContext.getNativeContext();
314
+ var viewRect = this.sciChartSurface.seriesViewRect;
315
+ nativeContext.PushMatrix();
316
+ nativeContext.PushState();
317
+ nativeContext.Translate(viewRect.x, viewRect.y);
318
+ nativeContext.SetClipRect(viewRect.x, viewRect.y, viewRect.width, viewRect.height);
233
319
  // Draw unselected series first
234
- renderableSeries.filter(function (rs) { return rs.isVisible && !rs.isSelected; }).forEach(drawSeriesImpl);
320
+ renderableSeriesArray.forEach(function (rs, index) {
321
+ if (rs.isVisible && !rs.isSelected)
322
+ drawSeriesImpl(index);
323
+ });
235
324
  // Draw selected series at higher z-index
236
- renderableSeries.filter(function (rs) { return rs.isVisible && rs.isSelected; }).forEach(drawSeriesImpl);
325
+ renderableSeriesArray.forEach(function (rs, index) {
326
+ if (rs.isVisible && rs.isSelected)
327
+ drawSeriesImpl(index);
328
+ });
329
+ nativeContext.PopMatrix();
330
+ nativeContext.PopState();
237
331
  };
238
332
  SciChartRenderer.prototype.drawDebugAxes = function (scs, renderContext) {
239
333
  scs.xAxes.asArray().forEach(function (xAxis) {
@@ -275,6 +275,7 @@ export declare abstract class AxisCore implements IAxisParams, IDeletable {
275
275
  protected maxAutoTicksProperty: number;
276
276
  protected visibleRangeAnimationToken: IGenericAnimation;
277
277
  protected readonly defaultVisibleRange: NumberRange;
278
+ protected allowFastMathProperty: boolean;
278
279
  /**
279
280
  * Creates an instance of an {@link AxisCore}
280
281
  * @param options Optional parameters of type {@link IAxisCoreOptions} used to define properties at instantiation time
@@ -290,6 +291,16 @@ export declare abstract class AxisCore implements IAxisParams, IDeletable {
290
291
  * See {@link AxisBase2D.axisAlignment} if you want to set a 2D Axis alignment to the left, right, top or bottom
291
292
  */
292
293
  get isXAxis(): boolean;
294
+ /**
295
+ * When true, 32-bit faster paths for coordinate calculation maths are used. This improves performance in
296
+ * edge-cases where every CPU cycle counts.
297
+ */
298
+ get allowFastMath(): boolean;
299
+ /**
300
+ * When true, 32-bit faster paths for coordinate calculation maths are used. This improves performance in
301
+ * edge-cases where every CPU cycle counts.
302
+ */
303
+ set allowFastMath(allowFastMath: boolean);
293
304
  /**
294
305
  * When true, the axis has a valid {@link AxisCore.visibleRange} which can be drawn
295
306
  * @remarks
@@ -44,7 +44,7 @@ var AxisCore = /** @class */ (function () {
44
44
  * @param options Optional parameters of type {@link IAxisCoreOptions} used to define properties at instantiation time
45
45
  */
46
46
  function AxisCore(options) {
47
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
47
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
48
48
  /**
49
49
  * An {@link EventHandler} which fires a callback when the {@link AxisCore.visibleRange} property changes.
50
50
  * @desc
@@ -161,6 +161,7 @@ var AxisCore = /** @class */ (function () {
161
161
  */
162
162
  this.maxAutoTicksProperty = 10;
163
163
  this.defaultVisibleRange = new NumberRange_1.NumberRange(0, 10);
164
+ this.allowFastMathProperty = false;
164
165
  this.visibleRange = (options === null || options === void 0 ? void 0 : options.visibleRange) || this.defaultVisibleRange;
165
166
  this.id = (_a = options === null || options === void 0 ? void 0 : options.id) !== null && _a !== void 0 ? _a : this.id;
166
167
  this.growBy = (_b = options === null || options === void 0 ? void 0 : options.growBy) !== null && _b !== void 0 ? _b : this.growBy;
@@ -168,23 +169,24 @@ var AxisCore = /** @class */ (function () {
168
169
  this.isVisible = (_d = options === null || options === void 0 ? void 0 : options.isVisible) !== null && _d !== void 0 ? _d : this.isVisible;
169
170
  this.axisTitle = (_e = options === null || options === void 0 ? void 0 : options.axisTitle) !== null && _e !== void 0 ? _e : this.axisTitle;
170
171
  this.axisTitleStyle = (_f = options === null || options === void 0 ? void 0 : options.axisTitleStyle) !== null && _f !== void 0 ? _f : this.axisTitleStyle;
171
- this.autoTicksProperty = (_g = options === null || options === void 0 ? void 0 : options.autoTicks) !== null && _g !== void 0 ? _g : this.autoTicksProperty;
172
- this.maxAutoTicksProperty = (_h = options === null || options === void 0 ? void 0 : options.maxAutoTicks) !== null && _h !== void 0 ? _h : this.maxAutoTicksProperty;
173
- this.minorsPerMajorProperty = (_j = options === null || options === void 0 ? void 0 : options.minorsPerMajor) !== null && _j !== void 0 ? _j : this.minorsPerMajorProperty;
174
- this.majorDeltaProperty = (_k = options === null || options === void 0 ? void 0 : options.majorDelta) !== null && _k !== void 0 ? _k : this.majorDeltaProperty;
175
- this.minorDeltaProperty = (_l = options === null || options === void 0 ? void 0 : options.minorDelta) !== null && _l !== void 0 ? _l : this.minorDeltaProperty;
176
- this.drawLabelsProperty = (_m = options === null || options === void 0 ? void 0 : options.drawLabels) !== null && _m !== void 0 ? _m : this.drawLabelsProperty;
177
- this.drawMajorTickLinesProperty = (_o = options === null || options === void 0 ? void 0 : options.drawMajorTickLines) !== null && _o !== void 0 ? _o : this.drawMajorTickLinesProperty;
178
- this.drawMinorTickLinesProperty = (_p = options === null || options === void 0 ? void 0 : options.drawMinorTickLines) !== null && _p !== void 0 ? _p : this.drawMinorTickLinesProperty;
179
- this.drawMinorGridLinesProperty = (_q = options === null || options === void 0 ? void 0 : options.drawMinorGridLines) !== null && _q !== void 0 ? _q : this.drawMinorGridLinesProperty;
180
- this.drawMajorGridLinesProperty = (_r = options === null || options === void 0 ? void 0 : options.drawMajorGridLines) !== null && _r !== void 0 ? _r : this.drawMajorGridLinesProperty;
181
- this.majorGridLineStyleProperty = (_s = options === null || options === void 0 ? void 0 : options.majorGridLineStyle) !== null && _s !== void 0 ? _s : this.majorGridLineStyleProperty;
182
- this.minorGridLineStyleProperty = (_t = options === null || options === void 0 ? void 0 : options.minorGridLineStyle) !== null && _t !== void 0 ? _t : this.minorGridLineStyleProperty;
183
- this.majorTickLineStyleProperty = (_u = options === null || options === void 0 ? void 0 : options.majorTickLineStyle) !== null && _u !== void 0 ? _u : this.majorTickLineStyleProperty;
184
- this.minorTickLineStyleProperty = (_v = options === null || options === void 0 ? void 0 : options.minorTickLineStyle) !== null && _v !== void 0 ? _v : this.minorTickLineStyleProperty;
185
- this.drawMajorBandsProperty = (_w = options === null || options === void 0 ? void 0 : options.drawMajorBands) !== null && _w !== void 0 ? _w : this.drawMajorBandsProperty;
186
- this.axisBandsFillProperty = (_x = options === null || options === void 0 ? void 0 : options.axisBandsFill) !== null && _x !== void 0 ? _x : this.axisBandsFillProperty;
187
- this.flippedCoordinatesProperty = (_y = options === null || options === void 0 ? void 0 : options.flippedCoordinates) !== null && _y !== void 0 ? _y : this.flippedCoordinatesProperty;
172
+ this.allowFastMath = (_g = options === null || options === void 0 ? void 0 : options.allowFastMath) !== null && _g !== void 0 ? _g : this.allowFastMathProperty;
173
+ this.autoTicksProperty = (_h = options === null || options === void 0 ? void 0 : options.autoTicks) !== null && _h !== void 0 ? _h : this.autoTicksProperty;
174
+ this.maxAutoTicksProperty = (_j = options === null || options === void 0 ? void 0 : options.maxAutoTicks) !== null && _j !== void 0 ? _j : this.maxAutoTicksProperty;
175
+ this.minorsPerMajorProperty = (_k = options === null || options === void 0 ? void 0 : options.minorsPerMajor) !== null && _k !== void 0 ? _k : this.minorsPerMajorProperty;
176
+ this.majorDeltaProperty = (_l = options === null || options === void 0 ? void 0 : options.majorDelta) !== null && _l !== void 0 ? _l : this.majorDeltaProperty;
177
+ this.minorDeltaProperty = (_m = options === null || options === void 0 ? void 0 : options.minorDelta) !== null && _m !== void 0 ? _m : this.minorDeltaProperty;
178
+ this.drawLabelsProperty = (_o = options === null || options === void 0 ? void 0 : options.drawLabels) !== null && _o !== void 0 ? _o : this.drawLabelsProperty;
179
+ this.drawMajorTickLinesProperty = (_p = options === null || options === void 0 ? void 0 : options.drawMajorTickLines) !== null && _p !== void 0 ? _p : this.drawMajorTickLinesProperty;
180
+ this.drawMinorTickLinesProperty = (_q = options === null || options === void 0 ? void 0 : options.drawMinorTickLines) !== null && _q !== void 0 ? _q : this.drawMinorTickLinesProperty;
181
+ this.drawMinorGridLinesProperty = (_r = options === null || options === void 0 ? void 0 : options.drawMinorGridLines) !== null && _r !== void 0 ? _r : this.drawMinorGridLinesProperty;
182
+ this.drawMajorGridLinesProperty = (_s = options === null || options === void 0 ? void 0 : options.drawMajorGridLines) !== null && _s !== void 0 ? _s : this.drawMajorGridLinesProperty;
183
+ this.majorGridLineStyleProperty = (_t = options === null || options === void 0 ? void 0 : options.majorGridLineStyle) !== null && _t !== void 0 ? _t : this.majorGridLineStyleProperty;
184
+ this.minorGridLineStyleProperty = (_u = options === null || options === void 0 ? void 0 : options.minorGridLineStyle) !== null && _u !== void 0 ? _u : this.minorGridLineStyleProperty;
185
+ this.majorTickLineStyleProperty = (_v = options === null || options === void 0 ? void 0 : options.majorTickLineStyle) !== null && _v !== void 0 ? _v : this.majorTickLineStyleProperty;
186
+ this.minorTickLineStyleProperty = (_w = options === null || options === void 0 ? void 0 : options.minorTickLineStyle) !== null && _w !== void 0 ? _w : this.minorTickLineStyleProperty;
187
+ this.drawMajorBandsProperty = (_x = options === null || options === void 0 ? void 0 : options.drawMajorBands) !== null && _x !== void 0 ? _x : this.drawMajorBandsProperty;
188
+ this.axisBandsFillProperty = (_y = options === null || options === void 0 ? void 0 : options.axisBandsFill) !== null && _y !== void 0 ? _y : this.axisBandsFillProperty;
189
+ this.flippedCoordinatesProperty = (_z = options === null || options === void 0 ? void 0 : options.flippedCoordinates) !== null && _z !== void 0 ? _z : this.flippedCoordinatesProperty;
188
190
  }
189
191
  Object.defineProperty(AxisCore.prototype, "isCategoryAxis", {
190
192
  /**
@@ -208,6 +210,25 @@ var AxisCore = /** @class */ (function () {
208
210
  enumerable: false,
209
211
  configurable: true
210
212
  });
213
+ Object.defineProperty(AxisCore.prototype, "allowFastMath", {
214
+ /**
215
+ * When true, 32-bit faster paths for coordinate calculation maths are used. This improves performance in
216
+ * edge-cases where every CPU cycle counts.
217
+ */
218
+ get: function () {
219
+ return this.allowFastMathProperty;
220
+ },
221
+ /**
222
+ * When true, 32-bit faster paths for coordinate calculation maths are used. This improves performance in
223
+ * edge-cases where every CPU cycle counts.
224
+ */
225
+ set: function (allowFastMath) {
226
+ this.allowFastMathProperty = allowFastMath;
227
+ this.notifyPropertyChanged(constants_1.PROPERTY.ALLOW_FAST_MATH);
228
+ },
229
+ enumerable: false,
230
+ configurable: true
231
+ });
211
232
  /**
212
233
  * When true, the axis has a valid {@link AxisCore.visibleRange} which can be drawn
213
234
  * @remarks
@@ -25,6 +25,7 @@ export declare class AxisRenderer implements IDeletable {
25
25
  private measureTextCanvas;
26
26
  private keepLabelsWithinAxisProperty;
27
27
  private hideOverlappingLabelsProperty;
28
+ private vertices;
28
29
  /**
29
30
  * Creates an instance of a {@link AxisRenderer}
30
31
  * @param webAssemblyContext The {@link TSciChart | SciChart 2D WebAssembly Context} containing native methods and
@@ -45,6 +45,7 @@ var AxisRenderer = /** @class */ (function () {
45
45
  this.hideOverlappingLabelsProperty = true;
46
46
  this.webAssemblyContext = webAssemblyContext;
47
47
  this.textureManager = new TextureManager_1.TextureManager(webAssemblyContext);
48
+ this.vertices = new webAssemblyContext.VectorColorVertex();
48
49
  if (!app_1.IS_TEST_ENV) {
49
50
  this.measureTextCanvas = document.createElement("canvas");
50
51
  this.measureTextCanvas.width = 1;
@@ -55,6 +56,7 @@ var AxisRenderer = /** @class */ (function () {
55
56
  AxisRenderer.prototype.delete = function () {
56
57
  this.measureTextCanvas = undefined;
57
58
  this.textureManager = (0, Deleter_1.deleteSafe)(this.textureManager);
59
+ this.vertices = (0, Deleter_1.deleteSafe)(this.vertices);
58
60
  };
59
61
  /**
60
62
  * Called when the {@link AxisRenderer} is attached to an {@link AxisBase2D | Axis}
@@ -311,7 +313,6 @@ var AxisRenderer = /** @class */ (function () {
311
313
  return;
312
314
  var viewRect = this.viewRect;
313
315
  var tickSize = tickStyle.tickSize;
314
- var vertices = new this.webAssemblyContext.VectorColorVertex();
315
316
  var isHorizontal = (0, AxisAlignment_1.getIsHorizontal)(axisAlignment);
316
317
  if (isHorizontal === undefined) {
317
318
  return;
@@ -347,17 +348,16 @@ var AxisRenderer = /** @class */ (function () {
347
348
  }
348
349
  }
349
350
  var vertex = new _this.webAssemblyContext.SCRTColorVertex(x1, y1);
350
- vertices.push_back(vertex);
351
+ _this.vertices.push_back(vertex);
351
352
  vertex.delete();
352
353
  var vertex2 = new _this.webAssemblyContext.SCRTColorVertex(x2, y2);
353
- vertices.push_back(vertex2);
354
+ _this.vertices.push_back(vertex2);
354
355
  vertex2.delete();
355
356
  });
356
357
  var leftOffset = viewRect.left - (isHorizontal ? axisOffset : 0);
357
358
  var topOffset = viewRect.top - (isHorizontal ? 0 : axisOffset);
358
- renderContext.drawLinesNative(vertices, pen, WebGlRenderContext2D_1.ELineDrawMode.DiscontinuousLine, leftOffset, topOffset);
359
- vertices.clear();
360
- vertices.delete();
359
+ renderContext.drawLinesNative(this.vertices, pen, WebGlRenderContext2D_1.ELineDrawMode.DiscontinuousLine, leftOffset, topOffset);
360
+ this.vertices.clear();
361
361
  };
362
362
  /**
363
363
  * Called internally - draws axis labels when needed, for example for line annotations
@@ -6,11 +6,30 @@ import { AxisBase2D, IAxisBase2dOptions } from "./AxisBase2D";
6
6
  import { ILabel2DOptions } from "./LabelProvider/LabelProviderBase2D";
7
7
  export declare type TCategoryCoordCalc = CategoryCoordinateCalculator | FlippedCategoryCoordinateCalculator;
8
8
  export interface ICategoryAxisBaseOptions extends IAxisBase2dOptions, ILabel2DOptions {
9
+ /**
10
+ * The default x values to use if no series or data is added to the chart.
11
+ * The tick values shown will depend on the visible range, which for category axis is by index, not by value.
12
+ * eg if you want default values [10, 20, 30, 40] you would need to set visibleRange: new NumberRange(0,3)
13
+ * By default it will start at 0 and increment by 1, up to the size of the visible range.
14
+ * To change the start and step set defaultXStart and defaultXStep
15
+ */
16
+ defaultXValues?: number[];
17
+ /**
18
+ * The starting value for default x values. See defaultXValues
19
+ */
20
+ defaultXStart?: number;
21
+ /**
22
+ * The step size for default x values. See defaultXValues
23
+ */
24
+ defaultXStep?: number;
9
25
  }
10
26
  /**
11
27
  * @summary A 2D Chart Category Axis Base type
12
28
  */
13
29
  export declare abstract class CategoryAxisBase extends AxisBase2D {
30
+ private defaultXValuesProperty;
31
+ private defaultXStartProperty;
32
+ private defaultXStepProperty;
14
33
  /**
15
34
  * Creates an instance of a {@link CategoryAxisBase}
16
35
  * @param webAssemblyContext The {@link TSciChart | SciChart 2D WebAssembly Context} containing native methods and
@@ -22,6 +41,38 @@ export declare abstract class CategoryAxisBase extends AxisBase2D {
22
41
  * @inheritDoc
23
42
  */
24
43
  get isCategoryAxis(): boolean;
44
+ /**
45
+ * The default x values to use if no series or data is added to the chart.
46
+ * The tick values shown will depend on the visible range, which for category axis is by index, not by value.
47
+ * eg if you want default values [10, 20, 30, 40] you would need to set visibleRange: new NumberRange(0,3)
48
+ * By default it will start at 0 and increment by 1, up to the size of the visible range.
49
+ * To change the start and step set defaultXStart and defaultXStep
50
+ */
51
+ get defaultXValues(): number[];
52
+ /**
53
+ * The default x values to use if no series or data is added to the chart.
54
+ * The tick values shown will depend on the visible range, which for category axis is by index, not by value.
55
+ * eg if you want default values [10, 20, 30, 40] you would need to set visibleRange: new NumberRange(0,3)
56
+ * By default it will start at 0 and increment by 1, up to the size of the visible range.
57
+ * To change the start and step set defaultXStart and defaultXStep
58
+ */
59
+ set defaultXValues(values: number[]);
60
+ /**
61
+ * The starting value for default x values. See defaultXValues
62
+ */
63
+ get defaultXStart(): number;
64
+ /**
65
+ * The starting value for default x values. See defaultXValues
66
+ */
67
+ set defaultXStart(value: number);
68
+ /**
69
+ * The step size for default x values. See defaultXValues
70
+ */
71
+ get defaultXStep(): number;
72
+ /**
73
+ * The step size for default x values. See defaultXValues
74
+ */
75
+ set defaultXStep(value: number);
25
76
  /**
26
77
  * @inheritDoc
27
78
  */
@@ -35,5 +86,6 @@ export declare abstract class CategoryAxisBase extends AxisBase2D {
35
86
  */
36
87
  protected getXDataRange(): NumberRange;
37
88
  protected getMaxAutoTicks(): number;
89
+ private generateDefaultXValuesForCategoryAxis;
38
90
  private setBaseXValues;
39
91
  }
@@ -19,6 +19,7 @@ exports.CategoryAxisBase = void 0;
19
19
  var Deleter_1 = require("../../../Core/Deleter");
20
20
  var NumberRange_1 = require("../../../Core/NumberRange");
21
21
  var SeriesType_1 = require("../../../types/SeriesType");
22
+ var appendDoubleVectorFromJsArray_1 = require("../../../utils/ccall/appendDoubleVectorFromJsArray");
22
23
  var CategoryCoordinateCalculator_1 = require("../../Numerics/CoordinateCalculators/CategoryCoordinateCalculator");
23
24
  var FlippedCategoryCoordinateCalculator_1 = require("../../Numerics/CoordinateCalculators/FlippedCategoryCoordinateCalculator");
24
25
  var NumericTickProvider_1 = require("../../Numerics/TickProviders/NumericTickProvider");
@@ -36,7 +37,14 @@ var CategoryAxisBase = /** @class */ (function (_super) {
36
37
  * @param options Optional parameters of type {@link ICategoryAxisBaseOptions} used to configure the axis at instantiation time
37
38
  */
38
39
  function CategoryAxisBase(webAssemblyContext, options) {
40
+ var _a, _b, _c;
39
41
  var _this = _super.call(this, webAssemblyContext, options) || this;
42
+ _this.defaultXValuesProperty = [];
43
+ _this.defaultXStartProperty = 0;
44
+ _this.defaultXStepProperty = 1;
45
+ _this.defaultXValuesProperty = (_a = options === null || options === void 0 ? void 0 : options.defaultXValues) !== null && _a !== void 0 ? _a : _this.defaultXValuesProperty;
46
+ _this.defaultXStartProperty = (_b = options === null || options === void 0 ? void 0 : options.defaultXStart) !== null && _b !== void 0 ? _b : _this.defaultXStartProperty;
47
+ _this.defaultXStepProperty = (_c = options === null || options === void 0 ? void 0 : options.defaultXStep) !== null && _c !== void 0 ? _c : _this.defaultXStepProperty;
40
48
  _this.tickProvider = new NumericTickProvider_1.NumericTickProvider(_this.webAssemblyContext2D);
41
49
  _this.deltaCalculator = new CategoryDeltaCalculator_1.CategoryDeltaCalculator(_this.webAssemblyContext2D);
42
50
  return _this;
@@ -51,6 +59,68 @@ var CategoryAxisBase = /** @class */ (function (_super) {
51
59
  enumerable: false,
52
60
  configurable: true
53
61
  });
62
+ Object.defineProperty(CategoryAxisBase.prototype, "defaultXValues", {
63
+ /**
64
+ * The default x values to use if no series or data is added to the chart.
65
+ * The tick values shown will depend on the visible range, which for category axis is by index, not by value.
66
+ * eg if you want default values [10, 20, 30, 40] you would need to set visibleRange: new NumberRange(0,3)
67
+ * By default it will start at 0 and increment by 1, up to the size of the visible range.
68
+ * To change the start and step set defaultXStart and defaultXStep
69
+ */
70
+ get: function () {
71
+ return this.defaultXValuesProperty;
72
+ },
73
+ /**
74
+ * The default x values to use if no series or data is added to the chart.
75
+ * The tick values shown will depend on the visible range, which for category axis is by index, not by value.
76
+ * eg if you want default values [10, 20, 30, 40] you would need to set visibleRange: new NumberRange(0,3)
77
+ * By default it will start at 0 and increment by 1, up to the size of the visible range.
78
+ * To change the start and step set defaultXStart and defaultXStep
79
+ */
80
+ set: function (values) {
81
+ this.defaultXValuesProperty = values;
82
+ if (this.invalidateParentCallback)
83
+ this.invalidateParentCallback();
84
+ },
85
+ enumerable: false,
86
+ configurable: true
87
+ });
88
+ Object.defineProperty(CategoryAxisBase.prototype, "defaultXStart", {
89
+ /**
90
+ * The starting value for default x values. See defaultXValues
91
+ */
92
+ get: function () {
93
+ return this.defaultXStartProperty;
94
+ },
95
+ /**
96
+ * The starting value for default x values. See defaultXValues
97
+ */
98
+ set: function (value) {
99
+ this.defaultXStartProperty = value;
100
+ if (this.invalidateParentCallback)
101
+ this.invalidateParentCallback();
102
+ },
103
+ enumerable: false,
104
+ configurable: true
105
+ });
106
+ Object.defineProperty(CategoryAxisBase.prototype, "defaultXStep", {
107
+ /**
108
+ * The step size for default x values. See defaultXValues
109
+ */
110
+ get: function () {
111
+ return this.defaultXStepProperty;
112
+ },
113
+ /**
114
+ * The step size for default x values. See defaultXValues
115
+ */
116
+ set: function (value) {
117
+ this.defaultXStepProperty = value;
118
+ if (this.invalidateParentCallback)
119
+ this.invalidateParentCallback();
120
+ },
121
+ enumerable: false,
122
+ configurable: true
123
+ });
54
124
  /**
55
125
  * @inheritDoc
56
126
  */
@@ -60,16 +130,6 @@ var CategoryAxisBase = /** @class */ (function (_super) {
60
130
  var coordCalc = this.getCurrentCoordinateCalculatorInternal();
61
131
  var scs = this.parentSurface;
62
132
  var renderableSeries = scs.renderableSeries.asArray().find(function (rs) { return rs.xAxisId === _this.id; });
63
- if (!renderableSeries) {
64
- throw new Error("category x axis with id=".concat(this.id, " should have renderable series"));
65
- }
66
- if (!renderableSeries.hasDataSeries()) {
67
- throw new Error("category x axis with id=".concat(this.id, " should have data series"));
68
- }
69
- var dataSeriesLength = renderableSeries.getDataSeriesValuesCount();
70
- if (dataSeriesLength === 0) {
71
- throw new Error("category x axis with id=".concat(this.id, " should have data series count > 0"));
72
- }
73
133
  this.setBaseXValues(coordCalc, renderableSeries);
74
134
  this.coordCalcCache = coordCalc;
75
135
  };
@@ -84,16 +144,6 @@ var CategoryAxisBase = /** @class */ (function (_super) {
84
144
  var shouldFlip = !(this.isXAxis !== this.flippedCoordinates);
85
145
  var scs = this.parentSurface;
86
146
  var renderableSeries = scs.renderableSeries.asArray().find(function (rs) { return rs.xAxisId === _this.id; });
87
- if (!renderableSeries) {
88
- throw new Error("category x axis with id=".concat(this.id, " should have renderable series"));
89
- }
90
- if (!renderableSeries.hasDataSeries()) {
91
- throw new Error("category x axis with id=".concat(this.id, " should have data series"));
92
- }
93
- var dataSeriesLength = renderableSeries.getDataSeriesValuesCount();
94
- if (dataSeriesLength === 0) {
95
- throw new Error("category x axis with id=".concat(this.id, " should have data series count > 0"));
96
- }
97
147
  var coordCalc = shouldFlip
98
148
  ? new FlippedCategoryCoordinateCalculator_1.FlippedCategoryCoordinateCalculator(this.webAssemblyContext2D, size, 0, 0, min, max, this.offset)
99
149
  : new CategoryCoordinateCalculator_1.CategoryCoordinateCalculator(this.webAssemblyContext2D, size, 0, 0, min, max, this.offset);
@@ -127,6 +177,19 @@ var CategoryAxisBase = /** @class */ (function (_super) {
127
177
  var coordCalc = this.getCurrentCoordinateCalculator();
128
178
  return Math.min(Math.max(1, this.maxAutoTicks), coordCalc.baseXValues.size());
129
179
  };
180
+ CategoryAxisBase.prototype.generateDefaultXValuesForCategoryAxis = function () {
181
+ var _this = this;
182
+ var defaultBaseXValues = new this.webAssemblyContext2D.SCRTDoubleVector();
183
+ if (this.defaultXValues && this.defaultXValues.length > 0) {
184
+ (0, appendDoubleVectorFromJsArray_1.appendDoubleVectorFromJsArray)(this.webAssemblyContext2D, defaultBaseXValues, this.defaultXValues);
185
+ }
186
+ else {
187
+ var length_1 = Math.ceil(this.visibleRange.diff);
188
+ var xValues = Array.from(Array(length_1), function (_, i) { return _this.defaultXStart + i * _this.defaultXStep; });
189
+ (0, appendDoubleVectorFromJsArray_1.appendDoubleVectorFromJsArray)(this.webAssemblyContext2D, defaultBaseXValues, xValues);
190
+ }
191
+ return defaultBaseXValues;
192
+ };
130
193
  CategoryAxisBase.prototype.setBaseXValues = function (coordCalc, renderableSeries) {
131
194
  if (renderableSeries.type === SeriesType_1.ESeriesType.UniformHeatmapSeries) {
132
195
  throw Error("Category Axis is not supported for UniformHeatmapRenderableSeries");
@@ -137,9 +200,20 @@ var CategoryAxisBase = /** @class */ (function (_super) {
137
200
  throw Error("BaseStackedCollection should have at least one BaseStackedRenderableSeries");
138
201
  }
139
202
  var firstStackedRS = stackedCollection.get(0);
203
+ if (!(firstStackedRS === null || firstStackedRS === void 0 ? void 0 : firstStackedRS.dataSeries)) {
204
+ if (!coordCalc.baseXValues)
205
+ coordCalc.baseXValues = this.generateDefaultXValuesForCategoryAxis();
206
+ return;
207
+ }
140
208
  coordCalc.baseXValues = firstStackedRS.dataSeries.getNativeXValues();
141
209
  }
142
210
  else {
211
+ // Not stacked renderable series
212
+ if (!(renderableSeries === null || renderableSeries === void 0 ? void 0 : renderableSeries.dataSeries)) {
213
+ if (!coordCalc.baseXValues)
214
+ coordCalc.baseXValues = this.generateDefaultXValuesForCategoryAxis();
215
+ return;
216
+ }
143
217
  coordCalc.baseXValues = renderableSeries.dataSeries.getNativeXValues();
144
218
  }
145
219
  };