scichart 2.0.2195 → 2.1.2261

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 (232) hide show
  1. package/Charting/ChartModifiers/CursorModifier.d.ts +9 -0
  2. package/Charting/ChartModifiers/CursorModifier.js +10 -0
  3. package/Charting/ChartModifiers/DataPointSelectionModifier.js +0 -1
  4. package/Charting/ChartModifiers/RolloverModifier.d.ts +30 -3
  5. package/Charting/ChartModifiers/RolloverModifier.js +46 -80
  6. package/Charting/Drawing/BrushCache.d.ts +8 -2
  7. package/Charting/Drawing/BrushCache.js +16 -8
  8. package/Charting/Drawing/WebGlRenderContext2D.d.ts +1 -0
  9. package/Charting/Drawing/WebGlRenderContext2D.js +4 -1
  10. package/Charting/LayoutManager/BaseAxisLayoutStrategy.d.ts +2 -0
  11. package/Charting/LayoutManager/BaseAxisLayoutStrategy.js +33 -0
  12. package/Charting/LayoutManager/BottomAlignedOuterHorizontallyStackedAxisLayoutStrategy.js +18 -2
  13. package/Charting/LayoutManager/LeftAlignedOuterVerticallyStackedAxisLayoutStrategy.js +19 -2
  14. package/Charting/LayoutManager/RightAlignedOuterVerticallyStackedAxisLayoutStrategy.js +18 -2
  15. package/Charting/LayoutManager/TopAlignedOuterHorizontallyStackedAxisLayoutStrategy.js +18 -2
  16. package/Charting/Model/BaseDataSeries.d.ts +42 -15
  17. package/Charting/Model/BaseDataSeries.js +77 -28
  18. package/Charting/Model/BaseHeatmapDataSeries.d.ts +31 -23
  19. package/Charting/Model/BaseHeatmapDataSeries.js +45 -18
  20. package/Charting/Model/DataDistributionCalculator/DataDistributionCalculator.d.ts +23 -0
  21. package/Charting/Model/DataDistributionCalculator/DataDistributionCalculator.js +122 -0
  22. package/Charting/Model/DataDistributionCalculator/IDataDistributionCalculator.d.ts +57 -0
  23. package/Charting/Model/DataDistributionCalculator/IDataDistributionCalculator.js +2 -0
  24. package/Charting/Model/Filters/OhlcFilterBase.d.ts +2 -2
  25. package/Charting/Model/Filters/XyFilterBase.d.ts +3 -3
  26. package/Charting/Model/Filters/XyMovingAverageFilter.js +1 -1
  27. package/Charting/Model/Filters/XyyFilterBase.d.ts +4 -4
  28. package/Charting/Model/Filters/XyzFilterBase.d.ts +4 -4
  29. package/Charting/Model/IDataSeries.d.ts +37 -5
  30. package/Charting/Model/OhlcDataSeries.d.ts +12 -11
  31. package/Charting/Model/OhlcDataSeries.js +47 -44
  32. package/Charting/Model/PointSeries/BasePointSeriesResampled.d.ts +21 -0
  33. package/Charting/Model/PointSeries/BasePointSeriesResampled.js +56 -0
  34. package/Charting/Model/PointSeries/BasePointSeriesWrapped.d.ts +14 -0
  35. package/Charting/Model/PointSeries/BasePointSeriesWrapped.js +23 -0
  36. package/Charting/Model/PointSeries/IPointSeries.d.ts +31 -0
  37. package/Charting/Model/PointSeries/IPointSeries.js +2 -0
  38. package/Charting/Model/PointSeries/OhlcPointSeriesResampled.d.ts +13 -0
  39. package/Charting/Model/PointSeries/OhlcPointSeriesResampled.js +59 -0
  40. package/Charting/Model/PointSeries/OhlcPointSeriesWrapped.d.ts +11 -0
  41. package/Charting/Model/PointSeries/OhlcPointSeriesWrapped.js +32 -0
  42. package/Charting/Model/PointSeries/XyPointSeriesResampled.d.ts +7 -0
  43. package/Charting/Model/PointSeries/XyPointSeriesResampled.js +27 -0
  44. package/Charting/Model/PointSeries/XyPointSeriesWrapped.d.ts +6 -0
  45. package/Charting/Model/PointSeries/XyPointSeriesWrapped.js +27 -0
  46. package/Charting/Model/PointSeries/XyyPointSeriesResampled.d.ts +10 -0
  47. package/Charting/Model/PointSeries/XyyPointSeriesResampled.js +48 -0
  48. package/Charting/Model/PointSeries/XyyPointSeriesWrapped.d.ts +8 -0
  49. package/Charting/Model/PointSeries/XyyPointSeriesWrapped.js +29 -0
  50. package/Charting/Model/PointSeries/XyzPointSeriesWrapped.d.ts +8 -0
  51. package/Charting/Model/PointSeries/XyzPointSeriesWrapped.js +29 -0
  52. package/Charting/Model/XyDataSeries.d.ts +3 -2
  53. package/Charting/Model/XyDataSeries.js +26 -26
  54. package/Charting/Model/XyyDataSeries.d.ts +5 -5
  55. package/Charting/Model/XyyDataSeries.js +30 -27
  56. package/Charting/Model/XyzDataSeries.d.ts +5 -5
  57. package/Charting/Model/XyzDataSeries.js +30 -27
  58. package/Charting/Numerics/CoordinateCalculators/CategoryCoordinateCalculator.d.ts +2 -2
  59. package/Charting/Numerics/CoordinateCalculators/FlippedCategoryCoordinateCalculator.d.ts +2 -2
  60. package/Charting/Numerics/CoordinateCalculators/FlippedNumericCoordinateCalculator.d.ts +2 -1
  61. package/Charting/Numerics/CoordinateCalculators/FlippedNumericCoordinateCalculator.js +6 -2
  62. package/Charting/Numerics/CoordinateCalculators/NumericCoordinateCalculator.d.ts +2 -1
  63. package/Charting/Numerics/CoordinateCalculators/NumericCoordinateCalculator.js +6 -2
  64. package/Charting/Numerics/Resamplers/ExtremeResamplerHelper.d.ts +54 -0
  65. package/Charting/Numerics/Resamplers/ExtremeResamplerHelper.js +234 -0
  66. package/Charting/Numerics/Resamplers/ResamplingMode.d.ts +37 -0
  67. package/Charting/Numerics/Resamplers/ResamplingMode.js +41 -0
  68. package/Charting/Numerics/Resamplers/ResamplingParams.d.ts +39 -0
  69. package/Charting/Numerics/Resamplers/ResamplingParams.js +52 -0
  70. package/Charting/Services/RenderPassData.d.ts +6 -1
  71. package/Charting/Services/RenderPassData.js +5 -1
  72. package/Charting/Services/RenderPassInfo.d.ts +18 -0
  73. package/Charting/Services/RenderPassInfo.js +14 -0
  74. package/Charting/Services/SciChartRenderer.d.ts +14 -1
  75. package/Charting/Services/SciChartRenderer.js +127 -31
  76. package/Charting/Visuals/Annotations/AnnotationBase.d.ts +1 -1
  77. package/Charting/Visuals/Annotations/CursorTooltipSvgAnnotation.d.ts +1 -0
  78. package/Charting/Visuals/Annotations/CursorTooltipSvgAnnotation.js +6 -0
  79. package/Charting/Visuals/Annotations/RolloverMarkerSvgAnnotation.d.ts +5 -0
  80. package/Charting/Visuals/Annotations/RolloverMarkerSvgAnnotation.js +12 -1
  81. package/Charting/Visuals/Annotations/RolloverTooltipSvgAnnotation.d.ts +6 -8
  82. package/Charting/Visuals/Annotations/RolloverTooltipSvgAnnotation.js +12 -9
  83. package/Charting/Visuals/Annotations/SvgAnnotationBase.js +7 -2
  84. package/Charting/Visuals/Axis/AxisBase2D.d.ts +23 -0
  85. package/Charting/Visuals/Axis/AxisBase2D.js +71 -24
  86. package/Charting/Visuals/Axis/AxisCore.d.ts +11 -0
  87. package/Charting/Visuals/Axis/AxisCore.js +39 -18
  88. package/Charting/Visuals/Axis/AxisRenderer.d.ts +1 -0
  89. package/Charting/Visuals/Axis/AxisRenderer.js +37 -10
  90. package/Charting/Visuals/Axis/CategoryAxisBase.d.ts +51 -0
  91. package/Charting/Visuals/Axis/CategoryAxisBase.js +85 -20
  92. package/Charting/Visuals/Axis/IAxisCoreOptions.d.ts +5 -0
  93. package/Charting/Visuals/Axis/LabelProvider/LabelCache.js +2 -2
  94. package/Charting/Visuals/Axis/LabelProvider/LabelProviderBase2D.js +9 -4
  95. package/Charting/Visuals/Axis/LabelProvider/SmartDateLabelProvider.js +7 -4
  96. package/Charting/Visuals/Axis/NumericAxis.js +2 -2
  97. package/Charting/Visuals/Axis/constants.d.ts +1 -0
  98. package/Charting/Visuals/Axis/constants.js +1 -0
  99. package/Charting/Visuals/RenderableSeries/Animations/FadeAnimation.d.ts +2 -2
  100. package/Charting/Visuals/RenderableSeries/Animations/ScaleAnimation.d.ts +2 -2
  101. package/Charting/Visuals/RenderableSeries/Animations/SeriesAnimation.d.ts +3 -3
  102. package/Charting/Visuals/RenderableSeries/Animations/SweepAnimation.d.ts +2 -2
  103. package/Charting/Visuals/RenderableSeries/Animations/WaveAnimation.d.ts +2 -2
  104. package/Charting/Visuals/RenderableSeries/Animations/animationHelpers.d.ts +6 -6
  105. package/Charting/Visuals/RenderableSeries/Animations/animationHelpers.js +2 -2
  106. package/Charting/Visuals/RenderableSeries/BaseBandRenderableSeries.d.ts +9 -2
  107. package/Charting/Visuals/RenderableSeries/BaseBandRenderableSeries.js +45 -1
  108. package/Charting/Visuals/RenderableSeries/BaseLineRenderableSeries.d.ts +1 -0
  109. package/Charting/Visuals/RenderableSeries/BaseLineRenderableSeries.js +1 -0
  110. package/Charting/Visuals/RenderableSeries/BaseMountainRenderableSeries.d.ts +1 -0
  111. package/Charting/Visuals/RenderableSeries/BaseMountainRenderableSeries.js +1 -0
  112. package/Charting/Visuals/RenderableSeries/BaseOhlcRenderableSeries.d.ts +12 -5
  113. package/Charting/Visuals/RenderableSeries/BaseOhlcRenderableSeries.js +113 -0
  114. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.d.ts +42 -6
  115. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.js +131 -22
  116. package/Charting/Visuals/RenderableSeries/BaseStackedCollection.d.ts +36 -4
  117. package/Charting/Visuals/RenderableSeries/BaseStackedCollection.js +51 -3
  118. package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.d.ts +38 -4
  119. package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.js +54 -3
  120. package/Charting/Visuals/RenderableSeries/DrawingProviders/BandSeriesDrawingProvider.d.ts +1 -1
  121. package/Charting/Visuals/RenderableSeries/DrawingProviders/BandSeriesDrawingProvider.js +8 -14
  122. package/Charting/Visuals/RenderableSeries/DrawingProviders/BaseSeriesDrawingProvider.js +4 -3
  123. package/Charting/Visuals/RenderableSeries/DrawingProviders/BubbleSeriesDrawingProvider.js +5 -11
  124. package/Charting/Visuals/RenderableSeries/DrawingProviders/ColumnSeriesDrawingProvider.d.ts +1 -0
  125. package/Charting/Visuals/RenderableSeries/DrawingProviders/ColumnSeriesDrawingProvider.js +31 -19
  126. package/Charting/Visuals/RenderableSeries/DrawingProviders/LineSeriesDrawingProvider.d.ts +2 -1
  127. package/Charting/Visuals/RenderableSeries/DrawingProviders/LineSeriesDrawingProvider.js +17 -21
  128. package/Charting/Visuals/RenderableSeries/DrawingProviders/MountainSeriesDrawingProvider.js +16 -15
  129. package/Charting/Visuals/RenderableSeries/DrawingProviders/OhlcSeriesDrawingProvider.js +9 -15
  130. package/Charting/Visuals/RenderableSeries/DrawingProviders/PointMarkerDrawingProvider.d.ts +4 -3
  131. package/Charting/Visuals/RenderableSeries/DrawingProviders/PointMarkerDrawingProvider.js +16 -21
  132. package/Charting/Visuals/RenderableSeries/DrawingProviders/UniformContoursDrawingProvider.js +2 -9
  133. package/Charting/Visuals/RenderableSeries/DrawingProviders/UniformHeatmapDrawingProvider.js +0 -7
  134. package/Charting/Visuals/RenderableSeries/FastBubbleRenderableSeries.d.ts +11 -2
  135. package/Charting/Visuals/RenderableSeries/FastBubbleRenderableSeries.js +17 -0
  136. package/Charting/Visuals/RenderableSeries/FastColumnRenderableSeries.d.ts +1 -0
  137. package/Charting/Visuals/RenderableSeries/FastColumnRenderableSeries.js +1 -0
  138. package/Charting/Visuals/RenderableSeries/FastLineRenderableSeries.d.ts +1 -0
  139. package/Charting/Visuals/RenderableSeries/FastLineRenderableSeries.js +6 -0
  140. package/Charting/Visuals/RenderableSeries/HitTest/BandSeriesHitTestProvider.js +2 -2
  141. package/Charting/Visuals/RenderableSeries/HitTest/BaseHitTestProvider.js +1 -1
  142. package/Charting/Visuals/RenderableSeries/HitTest/BubbleSeriesHitTestProvider.js +1 -1
  143. package/Charting/Visuals/RenderableSeries/HitTest/ColumnSeriesHitTestProvider.js +2 -2
  144. package/Charting/Visuals/RenderableSeries/HitTest/LineSeriesHitTestProvider.js +2 -2
  145. package/Charting/Visuals/RenderableSeries/HitTest/MountainSeriesHitTestProvider.js +1 -1
  146. package/Charting/Visuals/RenderableSeries/HitTest/OhlcSeriesHitTestProvider.js +2 -2
  147. package/Charting/Visuals/RenderableSeries/HitTest/ScatterSeriesHitTestProvider.js +1 -1
  148. package/Charting/Visuals/RenderableSeries/HitTest/StackedColumnSeriesHitTestProvider.js +2 -2
  149. package/Charting/Visuals/RenderableSeries/HitTest/StackedMountainSeriesHitTestProvider.js +2 -2
  150. package/Charting/Visuals/RenderableSeries/HitTest/hitTestHelpers.d.ts +6 -6
  151. package/Charting/Visuals/RenderableSeries/HitTest/hitTestHelpers.js +1 -1
  152. package/Charting/Visuals/RenderableSeries/IBaseRenderableSeriesOptions.d.ts +12 -1
  153. package/Charting/Visuals/RenderableSeries/IRenderableSeries.d.ts +38 -2
  154. package/Charting/Visuals/RenderableSeries/ISpline.d.ts +3 -3
  155. package/Charting/Visuals/RenderableSeries/SplineBandRenderableSeries.d.ts +4 -4
  156. package/Charting/Visuals/RenderableSeries/SplineBandRenderableSeries.js +5 -5
  157. package/Charting/Visuals/RenderableSeries/SplineLineRenderableSeries.d.ts +3 -3
  158. package/Charting/Visuals/RenderableSeries/SplineLineRenderableSeries.js +3 -3
  159. package/Charting/Visuals/RenderableSeries/SplineMountainRenderableSeries.d.ts +3 -3
  160. package/Charting/Visuals/RenderableSeries/SplineMountainRenderableSeries.js +3 -3
  161. package/Charting/Visuals/RenderableSeries/StackedColumnCollection.js +0 -6
  162. package/Charting/Visuals/RenderableSeries/StackedMountainCollection.d.ts +1 -1
  163. package/Charting/Visuals/RenderableSeries/StackedMountainCollection.js +1 -7
  164. package/Charting/Visuals/RenderableSeries/UniformContoursRenderableSeries.d.ts +5 -0
  165. package/Charting/Visuals/RenderableSeries/UniformContoursRenderableSeries.js +6 -0
  166. package/Charting/Visuals/RenderableSeries/UniformHeatmapRenderableSeries.d.ts +5 -0
  167. package/Charting/Visuals/RenderableSeries/UniformHeatmapRenderableSeries.js +6 -0
  168. package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.d.ts +5 -3
  169. package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.js +6 -3
  170. package/Charting/Visuals/RenderableSeries/constants.d.ts +3 -0
  171. package/Charting/Visuals/RenderableSeries/constants.js +3 -0
  172. package/Charting/Visuals/SciChartDefaults.d.ts +9 -1
  173. package/Charting/Visuals/SciChartDefaults.js +9 -1
  174. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.d.ts +1 -0
  175. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.js +7 -2
  176. package/Charting/Visuals/SciChartSurface.d.ts +4 -4
  177. package/Charting/Visuals/SciChartSurface.js +18 -11
  178. package/Charting/Visuals/SciChartSurfaceBase.d.ts +3 -2
  179. package/Charting/Visuals/SciChartSurfaceBase.js +4 -4
  180. package/Charting/Visuals/createMaster.d.ts +1 -1
  181. package/Charting/Visuals/createMaster.js +11 -6
  182. package/Charting/Visuals/createSingle.d.ts +1 -1
  183. package/Charting/Visuals/createSingle.js +2 -2
  184. package/Charting/Visuals/licenseManager2D.js +24 -21
  185. package/Charting/Visuals/licenseManager2dState.d.ts +4 -0
  186. package/Charting/Visuals/licenseManager2dState.js +12 -0
  187. package/Charting/Visuals/loader.js +2 -0
  188. package/Charting/Visuals/sciChartInitCommon.d.ts +2 -2
  189. package/Charting/Visuals/sciChartInitCommon.js +22 -12
  190. package/Charting3D/Model/DataSeries/XyzDataSeries3D.d.ts +7 -7
  191. package/Charting3D/Model/DataSeries/XyzDataSeries3D.js +3 -3
  192. package/Charting3D/Visuals/SciChart3DSurface.d.ts +2 -2
  193. package/Charting3D/Visuals/SciChart3DSurface.js +3 -3
  194. package/Charting3D/Visuals/createMaster3d.d.ts +1 -1
  195. package/Charting3D/Visuals/createMaster3d.js +11 -6
  196. package/Charting3D/Visuals/createSingle3d.d.ts +1 -1
  197. package/Charting3D/Visuals/createSingle3d.js +2 -2
  198. package/Core/BuildStamp.d.ts +1 -1
  199. package/Core/BuildStamp.js +2 -2
  200. package/Core/NumberRange.d.ts +1 -0
  201. package/Core/NumberRange.js +8 -0
  202. package/Core/OneTimePerformanceWarning.d.ts +6 -0
  203. package/Core/OneTimePerformanceWarning.js +19 -0
  204. package/Core/storage/localStorageApi.d.ts +9 -0
  205. package/Core/storage/localStorageApi.js +32 -0
  206. package/_wasm/scichart.browser.js +1 -1
  207. package/_wasm/scichart2d.js +95 -95
  208. package/_wasm/scichart2d.wasm +0 -0
  209. package/_wasm/scichart3d.js +96 -96
  210. package/_wasm/scichart3d.wasm +0 -0
  211. package/constants/performanceWarnings.d.ts +5 -0
  212. package/constants/performanceWarnings.js +8 -0
  213. package/package.json +1 -1
  214. package/types/NumberArray.d.ts +1 -0
  215. package/types/NumberArray.js +5 -1
  216. package/types/SearchMode.d.ts +21 -0
  217. package/types/SearchMode.js +25 -0
  218. package/types/TSciChart.d.ts +144 -40
  219. package/types/TSciChart3D.d.ts +66 -28
  220. package/types/TStackedAxisLength.d.ts +4 -0
  221. package/types/TStackedAxisLength.js +4 -0
  222. package/utils/array.d.ts +7 -0
  223. package/utils/array.js +19 -1
  224. package/utils/calcAverage.d.ts +2 -2
  225. package/utils/ccall/appendDoubleVectorFromJsArray.d.ts +19 -0
  226. package/utils/ccall/appendDoubleVectorFromJsArray.js +91 -0
  227. package/utils/hash.d.ts +7 -0
  228. package/utils/hash.js +35 -0
  229. package/utils/tooltip.d.ts +42 -0
  230. package/utils/tooltip.js +119 -0
  231. package/utils/ccall/fillDoubleVectorFromJsArray.d.ts +0 -3
  232. package/utils/ccall/fillDoubleVectorFromJsArray.js +0 -33
@@ -1,6 +1,7 @@
1
1
  import { IIncludeSeries } from "../../Core/IIncludeSeries";
2
2
  import { Point } from "../../Core/Point";
3
3
  import { EChart2DModifierType } from "../../types/ChartModifierType";
4
+ import { EMousePosition } from "../../types/MousePosition";
4
5
  import { SeriesInfo } from "../Model/ChartData/SeriesInfo";
5
6
  import { IThemeProvider } from "../Themes/IThemeProvider";
6
7
  import { CursorTooltipSvgAnnotation } from "../Visuals/Annotations/CursorTooltipSvgAnnotation";
@@ -176,6 +177,9 @@ export declare class CursorModifier extends ChartModifierBase2D implements IIncl
176
177
  * @inheritDoc
177
178
  */
178
179
  getIncludedRenderableSeries(): IRenderableSeries[];
180
+ /**
181
+ * Gets or sets the tooltipDataTemplate, which allows to customize content for the tooltip
182
+ */
179
183
  get tooltipDataTemplate(): TCursorTooltipDataTemplate;
180
184
  set tooltipDataTemplate(value: TCursorTooltipDataTemplate);
181
185
  /**
@@ -184,6 +188,11 @@ export declare class CursorModifier extends ChartModifierBase2D implements IIncl
184
188
  * @param mousePoint
185
189
  */
186
190
  hitTestRenderableSeries(rs: IRenderableSeries, mousePoint: Point): HitTestInfo;
191
+ /**
192
+ * Returns current mouse position
193
+ */
194
+ getMousePosition(): EMousePosition;
195
+ /** @inheritDoc */
187
196
  toJSON(): {
188
197
  type: string;
189
198
  options: Required<Omit<IChartModifierBaseOptions, never>>;
@@ -300,6 +300,9 @@ var CursorModifier = /** @class */ (function (_super) {
300
300
  return allSeries;
301
301
  };
302
302
  Object.defineProperty(CursorModifier.prototype, "tooltipDataTemplate", {
303
+ /**
304
+ * Gets or sets the tooltipDataTemplate, which allows to customize content for the tooltip
305
+ */
303
306
  get: function () {
304
307
  return this.tooltipDataTemplateProperty;
305
308
  },
@@ -321,6 +324,13 @@ var CursorModifier = /** @class */ (function (_super) {
321
324
  }
322
325
  return rs.hitTestProvider.hitTestXSlice(mousePoint.x, mousePoint.y);
323
326
  };
327
+ /**
328
+ * Returns current mouse position
329
+ */
330
+ CursorModifier.prototype.getMousePosition = function () {
331
+ return this.mousePosition;
332
+ };
333
+ /** @inheritDoc */
324
334
  CursorModifier.prototype.toJSON = function () {
325
335
  var json = _super.prototype.toJSON.call(this);
326
336
  var options = {
@@ -410,7 +410,6 @@ var DataPointSelectionModifier = /** @class */ (function (_super) {
410
410
  topYData = yCalc.getDataValue(_this.startPoint.y);
411
411
  }
412
412
  if (rs.dataSeries.type === IDataSeries_1.EDataSeriesType.HeatmapUniform) {
413
- var heatmapSeries = rs.dataSeries;
414
413
  // TODO: Heatmap series
415
414
  }
416
415
  else {
@@ -49,8 +49,27 @@ export declare type TTooltipProps = {
49
49
  isCategoryAxis: boolean;
50
50
  isY1: boolean;
51
51
  height: number;
52
+ width: number;
52
53
  seriesInfo: SeriesInfo;
53
54
  };
55
+ /**
56
+ * @ignore
57
+ * Defines the MousePosition enum constants, used by the {@link RolloverModifier}
58
+ */
59
+ declare enum EMousePosition {
60
+ /**
61
+ * The mouse position is outside the main canvas
62
+ */
63
+ OutOfCanvas = "OutOfCanvas",
64
+ /**
65
+ * The mouse position is in the Axis area
66
+ */
67
+ AxisArea = "AxisArea",
68
+ /**
69
+ * The mouse position is in the Series area
70
+ */
71
+ SeriesArea = "SeriesArea"
72
+ }
54
73
  /**
55
74
  * Optional parameters used to configure a {@link RolloverModifier} at construct time
56
75
  */
@@ -173,10 +192,16 @@ export declare class RolloverModifier extends ChartModifierBase2D implements IIn
173
192
  * @param mousePoint
174
193
  */
175
194
  hitTestRenderableSeries(rs: IRenderableSeries, mousePoint: Point): HitTestInfo;
195
+ /**
196
+ * Returns current mouse position
197
+ */
198
+ getMousePosition(): EMousePosition;
199
+ /** @inheritDoc */
176
200
  toJSON(): {
177
201
  type: string;
178
202
  options: Required<Omit<IChartModifierBaseOptions, never>>;
179
203
  };
204
+ /** @inheritDoc */
180
205
  protected notifyPropertyChanged(propertyName: string): void;
181
206
  private isVerticalChart;
182
207
  private removeSeriesAnnotationsFromParentSurface;
@@ -213,14 +238,16 @@ export declare class RolloverModifier extends ChartModifierBase2D implements IIn
213
238
  * @param pixelRatio
214
239
  * @param isY1
215
240
  */
216
- export declare const calcTooltipProps: (index: number, rs: IRenderableSeries, rolloverProps: RolloverModifierRenderableSeriesProps, seriesViewRect: Rect, xValue: number, yValue: number, absoluteXCoord: number, absoluteYCoord: number, hitTestInfo: HitTestInfo, pixelRatio: number, isY1?: boolean) => TTooltipProps;
241
+ export declare const calcTooltipProps: (index: number, rs: IRenderableSeries, rolloverProps: RolloverModifierRenderableSeriesProps, seriesViewRect: Rect, xValue: number, yValue: number, absoluteXCoord: number, absoluteYCoord: number, hitTestInfo: HitTestInfo, pixelRatio: number, isY1?: boolean, isVerticalChart?: boolean) => TTooltipProps;
217
242
  /**
218
243
  * @ignore
219
244
  * @description Used internally, calculates tooltip positions to avoid overlapping
220
245
  * @param tooltipArray
221
246
  * @param allowTooltipOverlapping
222
- * @param tooltipPaddingTop
247
+ * @param spacing
223
248
  * @param seriesViewRect
224
249
  * @param pixelRatio
250
+ * @param isVerticalChart
225
251
  */
226
- export declare const calcTooltipPositions: (tooltipArray: TTooltipProps[], allowTooltipOverlapping: boolean, tooltipPaddingTop: number, seriesViewRect: Rect, pixelRatio: number) => TTooltipProps[];
252
+ export declare const calcTooltipPositions: (tooltipArray: TTooltipProps[], allowTooltipOverlapping: boolean, spacing: number, seriesViewRect: Rect, pixelRatio: number, isVerticalChart?: boolean) => TTooltipProps[];
253
+ export {};
@@ -20,6 +20,7 @@ var classFactory_1 = require("../../Builder/classFactory");
20
20
  var BaseType_1 = require("../../types/BaseType");
21
21
  var ChartModifierType_1 = require("../../types/ChartModifierType");
22
22
  var SeriesType_1 = require("../../types/SeriesType");
23
+ var tooltip_1 = require("../../utils/tooltip");
23
24
  var translate_1 = require("../../utils/translate");
24
25
  var AnnotationBase_1 = require("../Visuals/Annotations/AnnotationBase");
25
26
  var LineAnnotation_1 = require("../Visuals/Annotations/LineAnnotation");
@@ -50,7 +51,7 @@ var EMousePosition;
50
51
  EMousePosition["SeriesArea"] = "SeriesArea";
51
52
  })(EMousePosition || (EMousePosition = {}));
52
53
  /** @ignore */
53
- var TOOLTIP_PADDING_TOP = 4;
54
+ var TOOLTIP_SPACING = 4;
54
55
  /**
55
56
  * The RolloverModifier provides tooltip and cursor behavior on a 2D {@link SciChartSurface}
56
57
  * within SciChart - High Performance {@link https://www.scichart.com/javascript-chart-features | JavaScript Charts}
@@ -346,6 +347,13 @@ var RolloverModifier = /** @class */ (function (_super) {
346
347
  }
347
348
  return rs.hitTestProvider.hitTestXSlice(mousePoint.x, mousePoint.y);
348
349
  };
350
+ /**
351
+ * Returns current mouse position
352
+ */
353
+ RolloverModifier.prototype.getMousePosition = function () {
354
+ return this.mousePosition;
355
+ };
356
+ /** @inheritDoc */
349
357
  RolloverModifier.prototype.toJSON = function () {
350
358
  var json = _super.prototype.toJSON.call(this);
351
359
  var options = {
@@ -361,6 +369,7 @@ var RolloverModifier = /** @class */ (function (_super) {
361
369
  Object.assign(json.options, options);
362
370
  return json;
363
371
  };
372
+ /** @inheritDoc */
364
373
  RolloverModifier.prototype.notifyPropertyChanged = function (propertyName) {
365
374
  _super.prototype.notifyPropertyChanged.call(this, propertyName);
366
375
  if (propertyName === constants_1.PROPERTY.X_AXIS_ID) {
@@ -510,7 +519,7 @@ var RolloverModifier = /** @class */ (function (_super) {
510
519
  if (isVisible) {
511
520
  var absoluteXCoord = _this.isVerticalChart() ? hitTestInfo.yCoord : hitTestInfo.xCoord;
512
521
  var absoluteYCoord = _this.isVerticalChart() ? hitTestInfo.xCoord : hitTestInfo.yCoord;
513
- var tooltipProps = (0, exports.calcTooltipProps)(index, rs, rs.rolloverModifierProps, _this.parentSurface.seriesViewRect, hitTestInfo.xValue, hitTestInfo.yValue, absoluteXCoord, absoluteYCoord, hitTestInfo, DpiHelper_1.DpiHelper.PIXEL_RATIO);
522
+ var tooltipProps = (0, exports.calcTooltipProps)(index, rs, rs.rolloverModifierProps, _this.parentSurface.seriesViewRect, hitTestInfo.xValue, hitTestInfo.yValue, absoluteXCoord, absoluteYCoord, hitTestInfo, DpiHelper_1.DpiHelper.PIXEL_RATIO, false, _this.isVerticalChart());
514
523
  if (tooltipProps)
515
524
  tooltipArray.push(tooltipProps);
516
525
  }
@@ -520,7 +529,7 @@ var RolloverModifier = /** @class */ (function (_super) {
520
529
  if (isVisibleY1) {
521
530
  var absoluteXCoord = _this.isVerticalChart() ? hitTestInfo.y1Coord : hitTestInfo.xCoord;
522
531
  var absoluteYCoord = _this.isVerticalChart() ? hitTestInfo.xCoord : hitTestInfo.y1Coord;
523
- var tooltipY1Props = (0, exports.calcTooltipProps)(index, rs, rs.rolloverModifierProps1, _this.parentSurface.seriesViewRect, hitTestInfo.xValue, hitTestInfo.y1Value, absoluteXCoord, absoluteYCoord, hitTestInfo, DpiHelper_1.DpiHelper.PIXEL_RATIO, true);
532
+ var tooltipY1Props = (0, exports.calcTooltipProps)(index, rs, rs.rolloverModifierProps1, _this.parentSurface.seriesViewRect, hitTestInfo.xValue, hitTestInfo.y1Value, absoluteXCoord, absoluteYCoord, hitTestInfo, DpiHelper_1.DpiHelper.PIXEL_RATIO, true, _this.isVerticalChart());
524
533
  if (tooltipY1Props)
525
534
  tooltipArray.push(tooltipY1Props);
526
535
  }
@@ -530,7 +539,7 @@ var RolloverModifier = /** @class */ (function (_super) {
530
539
  var orderedTooltipArray = tooltipArray.sort(function (a, b) {
531
540
  return a.yCoord > b.yCoord ? 1 : b.yCoord > a.yCoord ? -1 : 0;
532
541
  });
533
- var tooltipPositions = (0, exports.calcTooltipPositions)(orderedTooltipArray, this.allowTooltipOverlapping, TOOLTIP_PADDING_TOP * DpiHelper_1.DpiHelper.PIXEL_RATIO, this.parentSurface.seriesViewRect, DpiHelper_1.DpiHelper.PIXEL_RATIO);
542
+ var tooltipPositions = (0, exports.calcTooltipPositions)(orderedTooltipArray, this.allowTooltipOverlapping, TOOLTIP_SPACING * DpiHelper_1.DpiHelper.PIXEL_RATIO, this.parentSurface.seriesViewRect, DpiHelper_1.DpiHelper.PIXEL_RATIO, this.isVerticalChart());
534
543
  tooltipPositions.forEach(function (el) {
535
544
  var rs = rsList[el.index];
536
545
  var showTooltip = _this.showTooltip && el.seriesInfo.isHit;
@@ -581,8 +590,9 @@ exports.RolloverModifier = RolloverModifier;
581
590
  * @param pixelRatio
582
591
  * @param isY1
583
592
  */
584
- var calcTooltipProps = function (index, rs, rolloverProps, seriesViewRect, xValue, yValue, absoluteXCoord, absoluteYCoord, hitTestInfo, pixelRatio, isY1) {
593
+ var calcTooltipProps = function (index, rs, rolloverProps, seriesViewRect, xValue, yValue, absoluteXCoord, absoluteYCoord, hitTestInfo, pixelRatio, isY1, isVerticalChart) {
585
594
  if (isY1 === void 0) { isY1 = false; }
595
+ if (isVerticalChart === void 0) { isVerticalChart = false; }
586
596
  var visibleRange = rs.yAxis.visibleRange;
587
597
  var isVisible = visibleRange.min <= yValue && yValue <= visibleRange.max;
588
598
  if (isVisible) {
@@ -593,13 +603,21 @@ var calcTooltipProps = function (index, rs, rolloverProps, seriesViewRect, xValu
593
603
  var scaledHeight = height * pixelRatio;
594
604
  var distTop = absoluteYCoord;
595
605
  var distBottom = seriesViewRect.height - absoluteYCoord;
606
+ var defaultVerticalShift = 5 * pixelRatio;
596
607
  var xCoordShift = seriesViewRect.width - absoluteXCoord < scaledWidth ? -width : 5;
597
- var yCoordShift = -height / 2;
598
- if (distTop < scaledHeight / 2) {
599
- yCoordShift = -distTop / pixelRatio;
608
+ var yCoordShift = isVerticalChart ? defaultVerticalShift : -height / 2;
609
+ if (isVerticalChart) {
610
+ if (distBottom < scaledHeight + defaultVerticalShift) {
611
+ yCoordShift = ((scaledHeight + defaultVerticalShift) / pixelRatio) * -1;
612
+ }
600
613
  }
601
- else if (distBottom < scaledHeight / 2) {
602
- yCoordShift = -(scaledHeight - distBottom) / pixelRatio;
614
+ else {
615
+ if (distTop < scaledHeight / 2) {
616
+ yCoordShift = -distTop / pixelRatio;
617
+ }
618
+ else if (distBottom < scaledHeight / 2) {
619
+ yCoordShift = -(scaledHeight - distBottom) / pixelRatio;
620
+ }
603
621
  }
604
622
  var newRecord = {
605
623
  index: index,
@@ -613,6 +631,7 @@ var calcTooltipProps = function (index, rs, rolloverProps, seriesViewRect, xValu
613
631
  xCoordShift: xCoordShift,
614
632
  yCoordShift: yCoordShift,
615
633
  height: scaledHeight,
634
+ width: scaledWidth,
616
635
  seriesInfo: seriesInfo
617
636
  };
618
637
  return newRecord;
@@ -620,85 +639,32 @@ var calcTooltipProps = function (index, rs, rolloverProps, seriesViewRect, xValu
620
639
  return undefined;
621
640
  };
622
641
  exports.calcTooltipProps = calcTooltipProps;
623
- /** @ignore */
624
- var spreadTooltips = function (tooltipArray, totalTooltipsHeight, startY, endY, pixelRatio) {
625
- var currentTotalPadding = endY - startY - totalTooltipsHeight;
626
- var currentPadding = currentTotalPadding / (tooltipArray.length - 1);
627
- tooltipArray.reduce(function (tooltipTopYCoord, tooltip) {
628
- tooltip.yCoordShift = (tooltipTopYCoord - tooltip.yCoord) / pixelRatio;
629
- return tooltipTopYCoord + tooltip.height + currentPadding;
630
- }, startY);
631
- };
632
642
  /**
633
643
  * @ignore
634
644
  * @description Used internally, calculates tooltip positions to avoid overlapping
635
645
  * @param tooltipArray
636
646
  * @param allowTooltipOverlapping
637
- * @param tooltipPaddingTop
647
+ * @param spacing
638
648
  * @param seriesViewRect
639
649
  * @param pixelRatio
650
+ * @param isVerticalChart
640
651
  */
641
- var calcTooltipPositions = function (tooltipArray, allowTooltipOverlapping, tooltipPaddingTop, seriesViewRect, pixelRatio) {
652
+ var calcTooltipPositions = function (tooltipArray, allowTooltipOverlapping, spacing, seriesViewRect, pixelRatio, isVerticalChart) {
653
+ if (isVerticalChart === void 0) { isVerticalChart = false; }
654
+ var positionProperties = (0, tooltip_1.getTooltipPositionProperties)(isVerticalChart);
655
+ var hasOverlap = (0, tooltip_1.checkHasOverlap)(tooltipArray, spacing, pixelRatio, positionProperties);
642
656
  var length = tooltipArray.length;
643
- if (!allowTooltipOverlapping && length >= 2) {
644
- var checkHasOverlap = function () {
645
- for (var i = 0; i < length - 1; i++) {
646
- var tooltip0 = tooltipArray[i];
647
- var scaledHeightTooltip0 = tooltip0.height;
648
- var scaledYShiftTooltip0 = tooltip0.yCoordShift * pixelRatio;
649
- var bottomYTooltip0 = tooltip0.yCoord + scaledHeightTooltip0 + scaledYShiftTooltip0;
650
- var tooltip1 = tooltipArray[i + 1];
651
- var scaledYShiftTooltip1 = tooltip1.yCoordShift * pixelRatio;
652
- var topYTooltip1 = tooltip1.yCoord + scaledYShiftTooltip1;
653
- var diff = topYTooltip1 - bottomYTooltip0;
654
- if (diff < tooltipPaddingTop)
655
- return true;
656
- }
657
- return false;
658
- };
659
- if (checkHasOverlap()) {
660
- var totalTooltipsHeight = tooltipArray.reduce(function (prev, cur) { return prev + cur.height; }, 0);
661
- var totalPadding = (length - 1) * tooltipPaddingTop;
662
- var totalTooltipsHeightWithPadding = totalTooltipsHeight + totalPadding;
663
- var notEnoughViewRectHeight = seriesViewRect.height <= totalTooltipsHeightWithPadding;
664
- if (notEnoughViewRectHeight) {
665
- var deltaYCoord = tooltipArray[length - 1].yCoord - tooltipArray[0].yCoord;
666
- var centerY = tooltipArray[0].yCoord + deltaYCoord / 2;
667
- var initialY_1 = centerY - totalTooltipsHeight / 2;
668
- tooltipArray.reduce(function (prevSum, cur, index, arr) {
669
- var sum = index === 0 ? initialY_1 : prevSum + arr[index - 1].height + tooltipPaddingTop;
670
- // need to get not scaled value
671
- cur.yCoordShift = (sum - cur.yCoord) / pixelRatio;
672
- return sum;
673
- }, 0);
674
- }
675
- else {
676
- var firstTooltip = tooltipArray[0];
677
- var lastTooltip = tooltipArray[length - 1];
678
- var startY = firstTooltip.yCoord + firstTooltip.yCoordShift * pixelRatio;
679
- var endY = lastTooltip.yCoord + lastTooltip.yCoordShift * pixelRatio + lastTooltip.height;
680
- var isEnoughHeight = endY - startY >= totalTooltipsHeightWithPadding;
681
- if (isEnoughHeight) {
682
- spreadTooltips(tooltipArray, totalTooltipsHeight, startY, endY, pixelRatio);
683
- }
684
- else {
685
- var additionalHeightNeeded = totalTooltipsHeightWithPadding - (endY - startY);
686
- var availableHeightFromStart = startY;
687
- var availableHeightFromEnd = seriesViewRect.height - endY;
688
- var newStartY = startY - additionalHeightNeeded / 2;
689
- var newEndY = endY + additionalHeightNeeded / 2;
690
- if (availableHeightFromStart < additionalHeightNeeded / 2) {
691
- newStartY = 0;
692
- newEndY = endY + (additionalHeightNeeded - availableHeightFromStart);
693
- }
694
- else if (availableHeightFromEnd < additionalHeightNeeded / 2) {
695
- newStartY = startY - (additionalHeightNeeded - availableHeightFromEnd);
696
- newEndY = seriesViewRect.height;
697
- }
698
- spreadTooltips(tooltipArray, totalTooltipsHeight, newStartY, newEndY, pixelRatio);
699
- }
700
- }
701
- }
657
+ if (!allowTooltipOverlapping && length >= 2 && hasOverlap) {
658
+ var spreadMap_1 = (0, tooltip_1.spreadTooltips)(tooltipArray, pixelRatio, positionProperties, spacing, seriesViewRect);
659
+ tooltipArray.forEach(function (tooltip) {
660
+ tooltip[positionProperties.shiftPropertyName] = spreadMap_1.get(tooltip.index);
661
+ });
662
+ }
663
+ // centering for vertical charts without overlapping
664
+ if (isVerticalChart && !hasOverlap) {
665
+ tooltipArray.forEach(function (tooltip) {
666
+ return (tooltip[positionProperties.shiftPropertyName] = -(tooltip.width / 2) / pixelRatio);
667
+ });
702
668
  }
703
669
  return tooltipArray;
704
670
  };
@@ -10,14 +10,18 @@ export declare class BrushCache extends BaseCache<WebGlBrush> {
10
10
  private opacity;
11
11
  private fillLinearGradient;
12
12
  private canvasTexture;
13
+ private textureHeightRatio;
14
+ private textureWidthRatio;
13
15
  get value(): WebGlBrush;
14
16
  /**
15
17
  * Creates or fetches a new brush with the specified params
16
18
  * @param fill
17
19
  * @param opacity
20
+ * @param textureHeightRatio
21
+ * @param textureWidthRatio
18
22
  * @param fillLinearGradient
19
23
  */
20
- create(fill: string, opacity: number, fillLinearGradient?: GradientParams): WebGlBrush;
24
+ create(fill: string, opacity: number, textureHeightRatio?: number, textureWidthRatio?: number, fillLinearGradient?: GradientParams): WebGlBrush;
21
25
  invalidateCache(): void;
22
26
  reset(): void;
23
27
  delete(): void;
@@ -43,7 +47,9 @@ export declare const getScrtBrushFromCache: (cache: BrushCache) => SCRTBrush;
43
47
  * @param cache The object that will store a brush
44
48
  * @param fill The HTML Color code
45
49
  * @param opacity The opacity factor.
50
+ * @param textureHeightRatio The height ratio of the main canvas to the WebGl canvas.
51
+ * @param textureWidthRatio The width ratio of the main canvas to the WebGl canvas.
46
52
  * @param fillGradientLinear The gradient params.
47
53
  * @returns new or existing instance of {@link SCRTBrush}}
48
54
  */
49
- export declare const createBrushInCache: (cache: BrushCache, fill: string, opacity: number, fillGradientLinear?: GradientParams) => SCRTBrush;
55
+ export declare const createBrushInCache: (cache: BrushCache, fill: string, opacity: number, textureHeightRatio?: number, textureWidthRatio?: number, fillGradientLinear?: GradientParams) => SCRTBrush;
@@ -35,7 +35,7 @@ var BrushCache = /** @class */ (function (_super) {
35
35
  Object.defineProperty(BrushCache.prototype, "value", {
36
36
  get: function () {
37
37
  if (!this.cachedEntity && (this.fill || this.fillLinearGradient)) {
38
- this.cachedEntity = this.create(this.fill, this.opacity, this.fillLinearGradient);
38
+ this.cachedEntity = this.create(this.fill, this.opacity, this.textureHeightRatio, this.textureWidthRatio, this.fillLinearGradient);
39
39
  }
40
40
  return this.cachedEntity;
41
41
  },
@@ -46,18 +46,24 @@ var BrushCache = /** @class */ (function (_super) {
46
46
  * Creates or fetches a new brush with the specified params
47
47
  * @param fill
48
48
  * @param opacity
49
+ * @param textureHeightRatio
50
+ * @param textureWidthRatio
49
51
  * @param fillLinearGradient
50
52
  */
51
- BrushCache.prototype.create = function (fill, opacity, fillLinearGradient) {
53
+ BrushCache.prototype.create = function (fill, opacity, textureHeightRatio, textureWidthRatio, fillLinearGradient) {
52
54
  if (this.cachedEntity &&
53
55
  fill === this.fill &&
54
56
  opacity === this.opacity &&
57
+ textureHeightRatio === this.textureHeightRatio &&
58
+ textureWidthRatio === this.textureWidthRatio &&
55
59
  fillLinearGradient === this.fillLinearGradient) {
56
60
  return this.cachedEntity;
57
61
  }
58
62
  this.invalidateCache();
59
63
  this.fill = fill;
60
64
  this.opacity = opacity;
65
+ this.textureHeightRatio = textureHeightRatio;
66
+ this.textureWidthRatio = textureWidthRatio;
61
67
  this.fillLinearGradient = fillLinearGradient;
62
68
  var brush = fillLinearGradient ? this.createGradientBrush() : this.createSolidBrush(fill, opacity);
63
69
  return (this.cachedEntity = new WebGlBrush_1.WebGlBrush(brush));
@@ -89,10 +95,10 @@ var BrushCache = /** @class */ (function (_super) {
89
95
  this.canvasTexture.clear();
90
96
  var ctx = this.canvasTexture.getContext();
91
97
  // BEGIN: Drawing gradient rectangle on canvas2D
92
- var x1 = convertRelativeToAbsolute(startPoint.x, TEXTURE_SIZE);
93
- var y1 = convertRelativeToAbsolute(startPoint.y, TEXTURE_SIZE);
94
- var x2 = convertRelativeToAbsolute(endPoint.x, TEXTURE_SIZE);
95
- var y2 = convertRelativeToAbsolute(endPoint.y, TEXTURE_SIZE);
98
+ var x1 = convertRelativeToAbsolute(startPoint.x, TEXTURE_SIZE * this.textureWidthRatio);
99
+ var y1 = convertRelativeToAbsolute(startPoint.y, TEXTURE_SIZE * this.textureHeightRatio);
100
+ var x2 = convertRelativeToAbsolute(endPoint.x, TEXTURE_SIZE * this.textureWidthRatio);
101
+ var y2 = convertRelativeToAbsolute(endPoint.y, TEXTURE_SIZE * this.textureHeightRatio);
96
102
  var gradient = ctx.createLinearGradient(x1, y1, x2, y2);
97
103
  gradientStops.forEach(function (el) {
98
104
  gradient.addColorStop(el.offset, el.color);
@@ -133,12 +139,14 @@ exports.getScrtBrushFromCache = getScrtBrushFromCache;
133
139
  * @param cache The object that will store a brush
134
140
  * @param fill The HTML Color code
135
141
  * @param opacity The opacity factor.
142
+ * @param textureHeightRatio The height ratio of the main canvas to the WebGl canvas.
143
+ * @param textureWidthRatio The width ratio of the main canvas to the WebGl canvas.
136
144
  * @param fillGradientLinear The gradient params.
137
145
  * @returns new or existing instance of {@link SCRTBrush}}
138
146
  */
139
- var createBrushInCache = function (cache, fill, opacity, fillGradientLinear) {
147
+ var createBrushInCache = function (cache, fill, opacity, textureHeightRatio, textureWidthRatio, fillGradientLinear) {
140
148
  Guard_1.Guard.notNull(cache, "brushCache");
141
- var brush = cache.create(fill, opacity, fillGradientLinear);
149
+ var brush = cache.create(fill, opacity, textureHeightRatio, textureWidthRatio, fillGradientLinear);
142
150
  return brush.scrtBrush;
143
151
  };
144
152
  exports.createBrushInCache = createBrushInCache;
@@ -39,6 +39,7 @@ export declare class WebGlRenderContext2D implements IRenderContext2D {
39
39
  private readonly layers;
40
40
  private readonly webAssemblyContext;
41
41
  private readonly effects;
42
+ private nativeContext;
42
43
  /**
43
44
  * Creates an instance of the WebGlRenderContext2D
44
45
  * @param webAssemblyContext The {@link TSciChart | SciChart WebAssembly Context} containing native methods and access to our WebGL2 Engine
@@ -43,7 +43,10 @@ var WebGlRenderContext2D = /** @class */ (function () {
43
43
  * Get the native {@link SCRTRenderContext} for direct access to SciChart's WebAssembly Visual Xccelerator engine
44
44
  */
45
45
  WebGlRenderContext2D.prototype.getNativeContext = function () {
46
- return this.webAssemblyContext.SCRTGetMainRenderContext2D();
46
+ if (!this.nativeContext) {
47
+ this.nativeContext = this.webAssemblyContext.SCRTGetMainRenderContext2D();
48
+ }
49
+ return this.nativeContext;
47
50
  };
48
51
  /**
49
52
  * Draw lines: grid lines, etc.
@@ -36,4 +36,6 @@ export declare abstract class BaseAxisLayoutStrategy {
36
36
  protected layoutAxesFromTopToBottom(left: number, top: number, right: number, bottom: number, axes: AxisBase2D[]): void;
37
37
  protected layoutAxesFromLeftToRight(left: number, top: number, right: number, bottom: number, axes: AxisBase2D[]): void;
38
38
  protected layoutAxesFromRightToLeft(left: number, top: number, right: number, bottom: number, axes: AxisBase2D[]): void;
39
+ protected calculateTotalAxisHeight(axis: AxisBase2D, totalAxisAreaHeight: number): number;
40
+ protected calculateTotalAxisWidth(axis: AxisBase2D, totalAxisAreaHeight: number): number;
39
41
  }
@@ -56,6 +56,39 @@ var BaseAxisLayoutStrategy = /** @class */ (function () {
56
56
  (0, AxisLayoutHelpers_1.layoutAxisParts)(axis, _this.layoutAxisPartsStrategy);
57
57
  });
58
58
  };
59
+ BaseAxisLayoutStrategy.prototype.calculateTotalAxisHeight = function (axis, totalAxisAreaHeight) {
60
+ return (parseSize(axis.stackedAxisLength, totalAxisAreaHeight) +
61
+ axis.axisLayoutState.additionalBottomSize +
62
+ axis.axisLayoutState.additionalTopSize);
63
+ };
64
+ BaseAxisLayoutStrategy.prototype.calculateTotalAxisWidth = function (axis, totalAxisAreaHeight) {
65
+ return (parseSize(axis.stackedAxisLength, totalAxisAreaHeight) +
66
+ axis.axisLayoutState.additionalRightSize +
67
+ axis.axisLayoutState.additionalLeftSize);
68
+ };
59
69
  return BaseAxisLayoutStrategy;
60
70
  }());
61
71
  exports.BaseAxisLayoutStrategy = BaseAxisLayoutStrategy;
72
+ var parseSize = function (value, containerSize) {
73
+ if (typeof value === "number") {
74
+ if (value < 0) {
75
+ throw new Error("stackedAxisLength must be a positive value!");
76
+ }
77
+ return value;
78
+ }
79
+ if (value.includes("%")) {
80
+ return parsePc(value, containerSize);
81
+ }
82
+ var parsedValue = parseFloat(value);
83
+ if (!isNaN(parsedValue)) {
84
+ return parsedValue;
85
+ }
86
+ throw new Error("stackedAxisLength must be a number or a percentage");
87
+ };
88
+ var parsePc = function (value, containerSize) {
89
+ var parsedPercentageValue = parseFloat(value);
90
+ if (parsedPercentageValue < 0 || parsedPercentageValue > 100) {
91
+ throw new Error("stackedAxisLength percentage must be from 0 to 100");
92
+ }
93
+ return Math.round((containerSize * parsedPercentageValue) / 10) / 10;
94
+ };
@@ -50,14 +50,30 @@ var BottomAlignedOuterHorizontallyStackedAxisLayoutStrategy = /** @class */ (fun
50
50
  BottomAlignedOuterHorizontallyStackedAxisLayoutStrategy.prototype.layoutAxes = function (left, top, right, bottom, axes) {
51
51
  var _this = this;
52
52
  var totalAxisAreaWidth = right - left;
53
- var singleAxisReservedWidth = totalAxisAreaWidth / axes.length;
54
53
  var firstAxis = axes[0];
54
+ var lastAxis = axes[axes.length - 1];
55
+ var axesWithDefinedLength = axes.filter(function (axis) { return axis.stackedAxisLength; });
56
+ var spaceWithoutBorders = axes.reduce(function (acc, axis) { return acc - axis.axisLayoutState.additionalBottomSize - axis.axisLayoutState.additionalTopSize; }, totalAxisAreaWidth +
57
+ (firstAxis === null || firstAxis === void 0 ? void 0 : firstAxis.axisLayoutState.additionalLeftSize) +
58
+ (lastAxis === null || lastAxis === void 0 ? void 0 : lastAxis.axisLayoutState.additionalRightSize));
59
+ var totalDefinedAxesLength = axesWithDefinedLength.reduce(function (acc, axis) { return acc + _this.calculateTotalAxisWidth(axis, spaceWithoutBorders); }, 0);
60
+ var availableSpaceForAxes = totalAxisAreaWidth +
61
+ (firstAxis === null || firstAxis === void 0 ? void 0 : firstAxis.axisLayoutState.additionalLeftSize) +
62
+ (lastAxis === null || lastAxis === void 0 ? void 0 : lastAxis.axisLayoutState.additionalRightSize) -
63
+ totalDefinedAxesLength;
64
+ if (availableSpaceForAxes < 0) {
65
+ throw new Error("Bottom stacked axes with defined size total ".concat(totalDefinedAxesLength, " pixels which is ").concat(-availableSpaceForAxes, " more than the space available"));
66
+ }
67
+ var defaultAxisReservedHeight = availableSpaceForAxes / (axes.length - axesWithDefinedLength.length);
55
68
  var leftOffset = left - (firstAxis === null || firstAxis === void 0 ? void 0 : firstAxis.axisLayoutState.additionalLeftSize);
56
69
  axes.forEach(function (axis) {
57
70
  var _a = axis.axisLayoutState, axisSize = _a.axisSize, additionalLeftSize = _a.additionalLeftSize, additionalRightSize = _a.additionalRightSize, additionalTopSize = _a.additionalTopSize;
58
71
  var topOffset = top + additionalTopSize;
59
72
  var bottomOffset = topOffset + axisSize;
60
- var rightOffset = leftOffset + singleAxisReservedWidth - additionalRightSize;
73
+ var axisReservedHeight = axis.stackedAxisLength
74
+ ? _this.calculateTotalAxisWidth(axis, spaceWithoutBorders)
75
+ : defaultAxisReservedHeight;
76
+ var rightOffset = leftOffset + axisReservedHeight - additionalRightSize;
61
77
  leftOffset += additionalLeftSize;
62
78
  axis.offset = leftOffset - left;
63
79
  axis.axisLength = rightOffset - leftOffset;
@@ -49,15 +49,32 @@ var LeftAlignedOuterVerticallyStackedAxisLayoutStrategy = /** @class */ (functio
49
49
  };
50
50
  LeftAlignedOuterVerticallyStackedAxisLayoutStrategy.prototype.layoutAxes = function (left, top, right, bottom, axes) {
51
51
  var _this = this;
52
+ // doesn't include top border of the first and bottom border of the last axis
52
53
  var totalAxisAreaHeight = bottom - top;
53
- var singleAxisReservedHeight = totalAxisAreaHeight / axes.length;
54
54
  var firstAxis = axes[0];
55
+ var lastAxis = axes[axes.length - 1];
56
+ var axesWithDefinedLength = axes.filter(function (axis) { return axis.stackedAxisLength; });
57
+ var spaceWithoutBorders = axes.reduce(function (acc, axis) { return acc - axis.axisLayoutState.additionalBottomSize - axis.axisLayoutState.additionalTopSize; }, totalAxisAreaHeight +
58
+ (firstAxis === null || firstAxis === void 0 ? void 0 : firstAxis.axisLayoutState.additionalTopSize) +
59
+ (lastAxis === null || lastAxis === void 0 ? void 0 : lastAxis.axisLayoutState.additionalBottomSize));
60
+ var totalDefinedAxesLength = axesWithDefinedLength.reduce(function (acc, axis) { return acc + _this.calculateTotalAxisHeight(axis, spaceWithoutBorders); }, 0);
61
+ var availableSpaceForAxes = totalAxisAreaHeight +
62
+ (firstAxis === null || firstAxis === void 0 ? void 0 : firstAxis.axisLayoutState.additionalTopSize) +
63
+ (lastAxis === null || lastAxis === void 0 ? void 0 : lastAxis.axisLayoutState.additionalBottomSize) -
64
+ totalDefinedAxesLength;
65
+ if (availableSpaceForAxes < 0) {
66
+ throw new Error("Left stacked axes with defined size total ".concat(totalDefinedAxesLength, " pixels which is ").concat(-availableSpaceForAxes, " more than the space available"));
67
+ }
68
+ var defaultAxisReservedHeight = availableSpaceForAxes / (axes.length - axesWithDefinedLength.length);
55
69
  var topOffset = top - (firstAxis === null || firstAxis === void 0 ? void 0 : firstAxis.axisLayoutState.additionalTopSize);
56
70
  axes.forEach(function (axis) {
57
71
  var _a = axis.axisLayoutState, axisSize = _a.axisSize, additionalRightSize = _a.additionalRightSize, additionalBottomSize = _a.additionalBottomSize, additionalTopSize = _a.additionalTopSize;
58
72
  var rightOffset = right - additionalRightSize;
59
73
  var leftOffset = rightOffset - axisSize;
60
- var bottomOffset = topOffset + singleAxisReservedHeight - additionalBottomSize;
74
+ var axisReservedHeight = axis.stackedAxisLength
75
+ ? _this.calculateTotalAxisHeight(axis, spaceWithoutBorders)
76
+ : defaultAxisReservedHeight;
77
+ var bottomOffset = topOffset + axisReservedHeight - additionalBottomSize;
61
78
  topOffset += additionalTopSize;
62
79
  axis.offset = topOffset - top;
63
80
  axis.axisLength = bottomOffset - topOffset;
@@ -50,14 +50,30 @@ var RightAlignedOuterVerticallyStackedAxisLayoutStrategy = /** @class */ (functi
50
50
  RightAlignedOuterVerticallyStackedAxisLayoutStrategy.prototype.layoutAxes = function (left, top, right, bottom, axes) {
51
51
  var _this = this;
52
52
  var totalAxisAreaHeight = bottom - top;
53
- var singleAxisReservedHeight = totalAxisAreaHeight / axes.length;
54
53
  var firstAxis = axes[0];
54
+ var lastAxis = axes[axes.length - 1];
55
+ var axesWithDefinedLength = axes.filter(function (axis) { return axis.stackedAxisLength; });
56
+ var spaceWithoutBorders = axes.reduce(function (acc, axis) { return acc - axis.axisLayoutState.additionalBottomSize - axis.axisLayoutState.additionalTopSize; }, totalAxisAreaHeight +
57
+ (firstAxis === null || firstAxis === void 0 ? void 0 : firstAxis.axisLayoutState.additionalTopSize) +
58
+ (lastAxis === null || lastAxis === void 0 ? void 0 : lastAxis.axisLayoutState.additionalBottomSize));
59
+ var totalDefinedAxesLength = axesWithDefinedLength.reduce(function (acc, axis) { return acc + _this.calculateTotalAxisHeight(axis, spaceWithoutBorders); }, 0);
60
+ var availableSpaceForAxes = totalAxisAreaHeight +
61
+ (firstAxis === null || firstAxis === void 0 ? void 0 : firstAxis.axisLayoutState.additionalTopSize) +
62
+ (lastAxis === null || lastAxis === void 0 ? void 0 : lastAxis.axisLayoutState.additionalBottomSize) -
63
+ totalDefinedAxesLength;
64
+ if (availableSpaceForAxes < 0) {
65
+ throw new Error("Right stacked axes with defined size total ".concat(totalDefinedAxesLength, " pixels which is ").concat(-availableSpaceForAxes, " more than the space available"));
66
+ }
67
+ var defaultAxisReservedHeight = availableSpaceForAxes / (axes.length - axesWithDefinedLength.length);
55
68
  var topOffset = top - (firstAxis === null || firstAxis === void 0 ? void 0 : firstAxis.axisLayoutState.additionalTopSize);
56
69
  axes.forEach(function (axis) {
57
70
  var _a = axis.axisLayoutState, axisSize = _a.axisSize, additionalLeftSize = _a.additionalLeftSize, additionalBottomSize = _a.additionalBottomSize, additionalTopSize = _a.additionalTopSize;
58
71
  var leftOffset = left + additionalLeftSize;
59
72
  var rightOffset = leftOffset + axisSize;
60
- var bottomOffset = topOffset + singleAxisReservedHeight - additionalBottomSize;
73
+ var axisReservedHeight = axis.stackedAxisLength
74
+ ? _this.calculateTotalAxisHeight(axis, spaceWithoutBorders)
75
+ : defaultAxisReservedHeight;
76
+ var bottomOffset = topOffset + axisReservedHeight - additionalBottomSize;
61
77
  topOffset += additionalTopSize;
62
78
  axis.offset = topOffset - top;
63
79
  axis.axisLength = bottomOffset - topOffset;