scichart 2.2.2417 → 3.0.0-beta.224

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 (389) hide show
  1. package/Builder/buildDataSeries.d.ts +16 -1
  2. package/Builder/buildDataSeries.js +24 -1
  3. package/Builder/buildSeries.d.ts +60 -3
  4. package/Builder/buildSeries.js +28 -1
  5. package/Builder/buildSurface.d.ts +28 -2
  6. package/Builder/buildSurface.js +53 -31
  7. package/Builder/chartBuilder.d.ts +20 -7
  8. package/Builder/chartBuilder.js +37 -3
  9. package/Charting/ChartModifiers/ChartModifierBase.d.ts +21 -0
  10. package/Charting/ChartModifiers/ChartModifierBase.js +12 -0
  11. package/Charting/ChartModifiers/ChartModifierBase2D.js +2 -1
  12. package/Charting/ChartModifiers/CursorModifier.d.ts +83 -10
  13. package/Charting/ChartModifiers/CursorModifier.js +147 -58
  14. package/Charting/ChartModifiers/DataPointSelectionModifier.js +2 -1
  15. package/Charting/ChartModifiers/LegendModifier.js +2 -1
  16. package/Charting/ChartModifiers/ModifierMouseArgs.d.ts +6 -1
  17. package/Charting/ChartModifiers/ModifierMouseArgs.js +13 -3
  18. package/Charting/ChartModifiers/MouseWheelZoomModifier.d.ts +2 -2
  19. package/Charting/ChartModifiers/MouseWheelZoomModifier.js +16 -4
  20. package/Charting/ChartModifiers/OverviewRangeSelectionModifier.d.ts +2 -1
  21. package/Charting/ChartModifiers/OverviewRangeSelectionModifier.js +8 -4
  22. package/Charting/ChartModifiers/PinchZoomModifier.js +2 -1
  23. package/Charting/ChartModifiers/RolloverModifier.d.ts +40 -0
  24. package/Charting/ChartModifiers/RolloverModifier.js +40 -3
  25. package/Charting/ChartModifiers/RubberBandXyZoomModifier.js +2 -1
  26. package/Charting/ChartModifiers/SeriesSelectionModifier.js +2 -1
  27. package/Charting/ChartModifiers/XAxisDragModifier.d.ts +1 -1
  28. package/Charting/ChartModifiers/XAxisDragModifier.js +2 -1
  29. package/Charting/ChartModifiers/YAxisDragModifier.d.ts +1 -1
  30. package/Charting/ChartModifiers/YAxisDragModifier.js +2 -1
  31. package/Charting/ChartModifiers/ZoomExtentsModifier.js +2 -1
  32. package/Charting/ChartModifiers/ZoomPanModifier.js +2 -1
  33. package/Charting/ChartModifiers/constants.d.ts +3 -1
  34. package/Charting/ChartModifiers/constants.js +2 -0
  35. package/Charting/Drawing/BatchRenderContext.d.ts +6 -0
  36. package/Charting/Drawing/BatchRenderContext.js +40 -0
  37. package/Charting/Drawing/RenderSurface.d.ts +2 -1
  38. package/Charting/Drawing/RenderSurface.js +3 -2
  39. package/Charting/Drawing/WebGlRenderContext2D.d.ts +19 -4
  40. package/Charting/Drawing/WebGlRenderContext2D.js +70 -41
  41. package/Charting/LayoutManager/BaseCenteredAxisLayoutStrategy.js +2 -1
  42. package/Charting/LayoutManager/BottomAlignedInnerAxisLayoutStrategy.js +1 -1
  43. package/Charting/LayoutManager/CentralAxesLayoutManager.js +2 -1
  44. package/Charting/LayoutManager/LayoutManager.d.ts +2 -1
  45. package/Charting/LayoutManager/LayoutManager.js +6 -5
  46. package/Charting/LayoutManager/LeftAlignedInnerAxisLayoutStrategy.js +1 -1
  47. package/Charting/LayoutManager/RightAlignedInnerAxisLayoutStrategy.js +1 -1
  48. package/Charting/LayoutManager/TopAlignedInnerAxisLayoutStrategy.js +1 -1
  49. package/Charting/Model/BaseDataSeries.d.ts +10 -1
  50. package/Charting/Model/BaseDataSeries.js +9 -8
  51. package/Charting/Model/BaseHeatmapDataSeries.d.ts +18 -5
  52. package/Charting/Model/BaseHeatmapDataSeries.js +21 -13
  53. package/Charting/Model/ChartData/SeriesInfo.d.ts +6 -0
  54. package/Charting/Model/ChartData/SeriesInfo.js +5 -0
  55. package/Charting/Model/ChartData/XyySeriesInfo.d.ts +2 -0
  56. package/Charting/Model/ChartData/XyySeriesInfo.js +2 -0
  57. package/Charting/Model/DataDistributionCalculator/DataDistributionCalculator.js +4 -3
  58. package/Charting/Model/Filters/HlcCustomFilter.js +12 -9
  59. package/Charting/Model/Filters/HlcFilterBase.js +2 -1
  60. package/Charting/Model/Filters/HlcScaleOffsetFilter.js +2 -1
  61. package/Charting/Model/Filters/OhlcCustomFilter.js +12 -9
  62. package/Charting/Model/Filters/OhlcScaleOffsetFilter.js +2 -1
  63. package/Charting/Model/Filters/XyCustomFilter.js +12 -9
  64. package/Charting/Model/Filters/XyFilterBase.d.ts +14 -5
  65. package/Charting/Model/Filters/XyFilterBase.js +47 -15
  66. package/Charting/Model/Filters/XyMovingAverageFilter.js +2 -1
  67. package/Charting/Model/Filters/XyRatioFilter.js +2 -1
  68. package/Charting/Model/Filters/XyScaleOffsetFilter.js +2 -1
  69. package/Charting/Model/Filters/XyyCustomFilter.js +12 -9
  70. package/Charting/Model/Filters/XyyFilterBase.js +2 -1
  71. package/Charting/Model/Filters/XyyScaleOffsetFilter.js +2 -1
  72. package/Charting/Model/Filters/XyzCustomFilter.js +12 -9
  73. package/Charting/Model/Filters/XyzFilterBase.js +2 -1
  74. package/Charting/Model/Filters/XyzScaleOffsetFilter.js +2 -1
  75. package/Charting/Model/IDataSeries.d.ts +9 -1
  76. package/Charting/Model/IDataSeries.js +8 -0
  77. package/Charting/Model/NonUniformHeatmapDataSeries.d.ts +112 -0
  78. package/Charting/Model/NonUniformHeatmapDataSeries.js +261 -0
  79. package/Charting/Model/PaletteFactory.d.ts +40 -4
  80. package/Charting/Model/PaletteFactory.js +37 -11
  81. package/Charting/Model/XyTextDataSeries.d.ts +121 -0
  82. package/Charting/Model/XyTextDataSeries.js +274 -0
  83. package/Charting/Numerics/CoordinateCalculators/CoordinateCalculatorBase.d.ts +1 -1
  84. package/Charting/Numerics/Resamplers/ExtremeResamplerHelper.js +1 -1
  85. package/Charting/Services/RenderPassData.d.ts +15 -5
  86. package/Charting/Services/RenderPassData.js +27 -5
  87. package/Charting/Services/SciChartRenderer.d.ts +2 -1
  88. package/Charting/Services/SciChartRenderer.js +92 -29
  89. package/Charting/Themes/IThemeProvider.d.ts +61 -0
  90. package/Charting/Themes/IThemeProvider.js +67 -1
  91. package/Charting/Themes/SciChartJSDarkTheme.d.ts +4 -0
  92. package/Charting/Themes/SciChartJSDarkTheme.js +6 -2
  93. package/Charting/Themes/SciChartJSDarkv2Theme.js +3 -0
  94. package/Charting/Themes/SciChartJSLightTheme.d.ts +8 -0
  95. package/Charting/Themes/SciChartJSLightTheme.js +8 -0
  96. package/Charting/Themes/SciChartJsNavyTheme.d.ts +10 -0
  97. package/Charting/Themes/SciChartJsNavyTheme.js +49 -0
  98. package/Charting/Visuals/Annotations/AdornerLayer.js +4 -8
  99. package/Charting/Visuals/Annotations/AnnotationBase.d.ts +80 -7
  100. package/Charting/Visuals/Annotations/AnnotationBase.js +238 -28
  101. package/Charting/Visuals/Annotations/AnnotationClickEventArgs.d.ts +11 -0
  102. package/Charting/Visuals/Annotations/AnnotationClickEventArgs.js +12 -0
  103. package/Charting/Visuals/Annotations/AxisMarkerAnnotation.d.ts +1 -0
  104. package/Charting/Visuals/Annotations/AxisMarkerAnnotation.js +18 -19
  105. package/Charting/Visuals/Annotations/BoxAnnotation.d.ts +1 -0
  106. package/Charting/Visuals/Annotations/BoxAnnotation.js +69 -67
  107. package/Charting/Visuals/Annotations/CursorTooltipSvgAnnotation.d.ts +2 -2
  108. package/Charting/Visuals/Annotations/CursorTooltipSvgAnnotation.js +20 -20
  109. package/Charting/Visuals/Annotations/CustomAnnotation.d.ts +1 -1
  110. package/Charting/Visuals/Annotations/CustomAnnotation.js +3 -2
  111. package/Charting/Visuals/Annotations/HorizontalLineAnnotation.js +6 -3
  112. package/Charting/Visuals/Annotations/IAdornerProvider.d.ts +12 -0
  113. package/Charting/Visuals/Annotations/IAnnotation.d.ts +9 -0
  114. package/Charting/Visuals/Annotations/IAnnotation.js +9 -0
  115. package/Charting/Visuals/Annotations/LineAnnotation.d.ts +1 -0
  116. package/Charting/Visuals/Annotations/LineAnnotation.js +29 -35
  117. package/Charting/Visuals/Annotations/NativeTextAnnotation.d.ts +193 -0
  118. package/Charting/Visuals/Annotations/NativeTextAnnotation.js +536 -0
  119. package/Charting/Visuals/Annotations/OverviewCustomResizableAnnotation.d.ts +4 -2
  120. package/Charting/Visuals/Annotations/OverviewCustomResizableAnnotation.js +19 -14
  121. package/Charting/Visuals/Annotations/RolloverLegendSvgAnnotation.d.ts +2 -2
  122. package/Charting/Visuals/Annotations/RolloverLegendSvgAnnotation.js +9 -8
  123. package/Charting/Visuals/Annotations/RolloverMarkerSvgAnnotation.d.ts +2 -2
  124. package/Charting/Visuals/Annotations/RolloverMarkerSvgAnnotation.js +6 -6
  125. package/Charting/Visuals/Annotations/RolloverTooltipSvgAnnotation.d.ts +2 -2
  126. package/Charting/Visuals/Annotations/RolloverTooltipSvgAnnotation.js +16 -17
  127. package/Charting/Visuals/Annotations/SvgAnnotationBase.d.ts +13 -2
  128. package/Charting/Visuals/Annotations/SvgAnnotationBase.js +34 -42
  129. package/Charting/Visuals/Annotations/TextAnnotation.d.ts +2 -2
  130. package/Charting/Visuals/Annotations/TextAnnotation.js +41 -22
  131. package/Charting/Visuals/Annotations/VerticalLineAnnotation.js +6 -3
  132. package/Charting/Visuals/Annotations/annotationHelpers.d.ts +6 -6
  133. package/Charting/Visuals/Annotations/annotationHelpers.js +7 -6
  134. package/Charting/Visuals/Annotations/constants.d.ts +13 -1
  135. package/Charting/Visuals/Annotations/constants.js +12 -0
  136. package/Charting/Visuals/Axis/AxisBase2D.d.ts +24 -4
  137. package/Charting/Visuals/Axis/AxisBase2D.js +115 -38
  138. package/Charting/Visuals/Axis/AxisCore.d.ts +10 -5
  139. package/Charting/Visuals/Axis/AxisCore.js +11 -10
  140. package/Charting/Visuals/Axis/AxisRenderer.js +114 -20
  141. package/Charting/Visuals/Axis/CategoryAxis.js +2 -1
  142. package/Charting/Visuals/Axis/CategoryAxisBase.d.ts +15 -15
  143. package/Charting/Visuals/Axis/CategoryAxisBase.js +14 -12
  144. package/Charting/Visuals/Axis/DateTimeNumericAxis.js +2 -1
  145. package/Charting/Visuals/Axis/DeltaCalculator/DateTimeDeltaCalculator.js +2 -1
  146. package/Charting/Visuals/Axis/LabelProvider/DateLabelProvider.js +2 -1
  147. package/Charting/Visuals/Axis/LabelProvider/LabelCache.js +2 -0
  148. package/Charting/Visuals/Axis/LabelProvider/LabelProviderBase2D.d.ts +14 -0
  149. package/Charting/Visuals/Axis/LabelProvider/LabelProviderBase2D.js +140 -33
  150. package/Charting/Visuals/Axis/LabelProvider/LogarithmicLabelProvider.js +2 -1
  151. package/Charting/Visuals/Axis/LabelProvider/NumericLabelProvider.js +2 -1
  152. package/Charting/Visuals/Axis/LabelProvider/PieLabelProvider.js +2 -1
  153. package/Charting/Visuals/Axis/LabelProvider/SmartDateLabelProvider.d.ts +31 -1
  154. package/Charting/Visuals/Axis/LabelProvider/SmartDateLabelProvider.js +64 -42
  155. package/Charting/Visuals/Axis/LabelProvider/TextLabelProvider.d.ts +2 -2
  156. package/Charting/Visuals/Axis/LabelProvider/TextLabelProvider.js +16 -19
  157. package/Charting/Visuals/Axis/LogarithmicAxis.js +9 -6
  158. package/Charting/Visuals/Axis/NumericAxis.js +3 -3
  159. package/Charting/Visuals/Axis/constants.d.ts +1 -0
  160. package/Charting/Visuals/Axis/constants.js +1 -0
  161. package/Charting/Visuals/HeatmapLegend.d.ts +95 -0
  162. package/Charting/Visuals/HeatmapLegend.js +192 -0
  163. package/Charting/Visuals/Helpers/NativeObject.d.ts +15 -2
  164. package/Charting/Visuals/Helpers/NativeObject.js +72 -6
  165. package/Charting/Visuals/I2DSurfaceOptions.d.ts +46 -0
  166. package/Charting/Visuals/PointMarkers/BasePointMarker.d.ts +5 -0
  167. package/Charting/Visuals/PointMarkers/BasePointMarker.js +28 -0
  168. package/Charting/Visuals/PointMarkers/IPointMarker.d.ts +8 -0
  169. package/Charting/Visuals/RenderableSeries/Animations/BandAnimation.js +2 -1
  170. package/Charting/Visuals/RenderableSeries/Animations/BandAnimationStyle.js +2 -1
  171. package/Charting/Visuals/RenderableSeries/Animations/BubbleAnimation.js +2 -1
  172. package/Charting/Visuals/RenderableSeries/Animations/CandlestickAnimation.js +2 -1
  173. package/Charting/Visuals/RenderableSeries/Animations/CandlestickAnimationStyle.js +2 -1
  174. package/Charting/Visuals/RenderableSeries/Animations/ColumnAnimation.js +2 -1
  175. package/Charting/Visuals/RenderableSeries/Animations/ColumnAnimationStyle.js +2 -1
  176. package/Charting/Visuals/RenderableSeries/Animations/CustomPointMarkerStyle.js +2 -1
  177. package/Charting/Visuals/RenderableSeries/Animations/FadeAnimation.js +2 -1
  178. package/Charting/Visuals/RenderableSeries/Animations/LineAnimation.js +2 -1
  179. package/Charting/Visuals/RenderableSeries/Animations/MountainAnimation.js +2 -1
  180. package/Charting/Visuals/RenderableSeries/Animations/MountainAnimationStyle.js +2 -1
  181. package/Charting/Visuals/RenderableSeries/Animations/OhlcAnimation.js +2 -1
  182. package/Charting/Visuals/RenderableSeries/Animations/OhlcAnimationStyle.js +2 -1
  183. package/Charting/Visuals/RenderableSeries/Animations/PointMarkerStyle.js +2 -1
  184. package/Charting/Visuals/RenderableSeries/Animations/ScaleAnimation.js +2 -1
  185. package/Charting/Visuals/RenderableSeries/Animations/ScatterAnimation.js +2 -1
  186. package/Charting/Visuals/RenderableSeries/Animations/SeriesAnimation.d.ts +8 -2
  187. package/Charting/Visuals/RenderableSeries/Animations/SeriesAnimation.js +3 -3
  188. package/Charting/Visuals/RenderableSeries/Animations/WaveAnimation.js +2 -1
  189. package/Charting/Visuals/RenderableSeries/BaseBandRenderableSeries.d.ts +7 -0
  190. package/Charting/Visuals/RenderableSeries/BaseBandRenderableSeries.js +42 -10
  191. package/Charting/Visuals/RenderableSeries/BaseHeatmapRenderableSeries.d.ts +128 -0
  192. package/Charting/Visuals/RenderableSeries/BaseHeatmapRenderableSeries.js +201 -0
  193. package/Charting/Visuals/RenderableSeries/BaseLineRenderableSeries.d.ts +26 -0
  194. package/Charting/Visuals/RenderableSeries/BaseLineRenderableSeries.js +39 -3
  195. package/Charting/Visuals/RenderableSeries/BaseMountainRenderableSeries.d.ts +7 -0
  196. package/Charting/Visuals/RenderableSeries/BaseMountainRenderableSeries.js +17 -2
  197. package/Charting/Visuals/RenderableSeries/BaseOhlcRenderableSeries.d.ts +2 -0
  198. package/Charting/Visuals/RenderableSeries/BaseOhlcRenderableSeries.js +15 -2
  199. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.d.ts +10 -0
  200. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.js +93 -17
  201. package/Charting/Visuals/RenderableSeries/BaseStackedCollection.d.ts +8 -1
  202. package/Charting/Visuals/RenderableSeries/BaseStackedCollection.js +21 -1
  203. package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.d.ts +1 -0
  204. package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.js +4 -0
  205. package/Charting/Visuals/RenderableSeries/DataLabels/BandSeriesDataLabelProvider.d.ts +43 -0
  206. package/Charting/Visuals/RenderableSeries/DataLabels/BandSeriesDataLabelProvider.js +142 -0
  207. package/Charting/Visuals/RenderableSeries/DataLabels/BaseDataLabelProvider.d.ts +92 -0
  208. package/Charting/Visuals/RenderableSeries/DataLabels/BaseDataLabelProvider.js +129 -0
  209. package/Charting/Visuals/RenderableSeries/DataLabels/BubbleSeriesDataLabelProvider.d.ts +17 -0
  210. package/Charting/Visuals/RenderableSeries/DataLabels/BubbleSeriesDataLabelProvider.js +62 -0
  211. package/Charting/Visuals/RenderableSeries/DataLabels/ColumnSeriesDataLabelProvider.d.ts +47 -0
  212. package/Charting/Visuals/RenderableSeries/DataLabels/ColumnSeriesDataLabelProvider.js +125 -0
  213. package/Charting/Visuals/RenderableSeries/DataLabels/ContoursDataLabelProvider.d.ts +71 -0
  214. package/Charting/Visuals/RenderableSeries/DataLabels/ContoursDataLabelProvider.js +221 -0
  215. package/Charting/Visuals/RenderableSeries/DataLabels/DataLabelLayoutManager.d.ts +5 -0
  216. package/Charting/Visuals/RenderableSeries/DataLabels/DataLabelLayoutManager.js +2 -0
  217. package/Charting/Visuals/RenderableSeries/DataLabels/DataLabelProvider.d.ts +208 -0
  218. package/Charting/Visuals/RenderableSeries/DataLabels/DataLabelProvider.js +410 -0
  219. package/Charting/Visuals/RenderableSeries/DataLabels/DataLabelState.d.ts +40 -0
  220. package/Charting/Visuals/RenderableSeries/DataLabels/DataLabelState.js +141 -0
  221. package/Charting/Visuals/RenderableSeries/DataLabels/HeatMapDataLabelProvider.d.ts +63 -0
  222. package/Charting/Visuals/RenderableSeries/DataLabels/HeatMapDataLabelProvider.js +198 -0
  223. package/Charting/Visuals/RenderableSeries/DataLabels/LineSeriesDataLabelProvider.d.ts +35 -0
  224. package/Charting/Visuals/RenderableSeries/DataLabels/LineSeriesDataLabelProvider.js +92 -0
  225. package/Charting/Visuals/RenderableSeries/DataLabels/NonUniformHeatmapDataLabelProvider.d.ts +12 -0
  226. package/Charting/Visuals/RenderableSeries/DataLabels/NonUniformHeatmapDataLabelProvider.js +134 -0
  227. package/Charting/Visuals/RenderableSeries/DataLabels/TextDataLabelProvider.d.ts +56 -0
  228. package/Charting/Visuals/RenderableSeries/DataLabels/TextDataLabelProvider.js +167 -0
  229. package/Charting/Visuals/RenderableSeries/DrawingProviders/BandSeriesDrawingProvider.d.ts +0 -1
  230. package/Charting/Visuals/RenderableSeries/DrawingProviders/BandSeriesDrawingProvider.js +1 -2
  231. package/Charting/Visuals/RenderableSeries/DrawingProviders/BaseSeriesDrawingProvider.d.ts +5 -2
  232. package/Charting/Visuals/RenderableSeries/DrawingProviders/BaseSeriesDrawingProvider.js +47 -40
  233. package/Charting/Visuals/RenderableSeries/DrawingProviders/BubbleSeriesDrawingProvider.js +1 -1
  234. package/Charting/Visuals/RenderableSeries/DrawingProviders/ColumnSeriesDrawingProvider.d.ts +1 -0
  235. package/Charting/Visuals/RenderableSeries/DrawingProviders/ColumnSeriesDrawingProvider.js +18 -5
  236. package/Charting/Visuals/RenderableSeries/DrawingProviders/ErrorSeriesDrawingProvider.d.ts +0 -1
  237. package/Charting/Visuals/RenderableSeries/DrawingProviders/ErrorSeriesDrawingProvider.js +14 -27
  238. package/Charting/Visuals/RenderableSeries/DrawingProviders/LineSeriesDrawingProvider.d.ts +17 -4
  239. package/Charting/Visuals/RenderableSeries/DrawingProviders/LineSeriesDrawingProvider.js +34 -11
  240. package/Charting/Visuals/RenderableSeries/DrawingProviders/NonUniformHeatmapDrawingProvider.d.ts +36 -0
  241. package/Charting/Visuals/RenderableSeries/DrawingProviders/NonUniformHeatmapDrawingProvider.js +493 -0
  242. package/Charting/Visuals/RenderableSeries/DrawingProviders/PointMarkerDrawingProvider.d.ts +5 -2
  243. package/Charting/Visuals/RenderableSeries/DrawingProviders/PointMarkerDrawingProvider.js +8 -5
  244. package/Charting/Visuals/RenderableSeries/DrawingProviders/UniformContoursDrawingProvider.js +4 -4
  245. package/Charting/Visuals/RenderableSeries/DrawingProviders/UniformHeatmapDrawingProvider.d.ts +3 -0
  246. package/Charting/Visuals/RenderableSeries/DrawingProviders/UniformHeatmapDrawingProvider.js +15 -4
  247. package/Charting/Visuals/RenderableSeries/FastBandRenderableSeries.js +2 -1
  248. package/Charting/Visuals/RenderableSeries/FastBubbleRenderableSeries.d.ts +21 -0
  249. package/Charting/Visuals/RenderableSeries/FastBubbleRenderableSeries.js +40 -4
  250. package/Charting/Visuals/RenderableSeries/FastCandlestickRenderableSeries.d.ts +2 -0
  251. package/Charting/Visuals/RenderableSeries/FastCandlestickRenderableSeries.js +18 -3
  252. package/Charting/Visuals/RenderableSeries/FastColumnRenderableSeries.d.ts +36 -2
  253. package/Charting/Visuals/RenderableSeries/FastColumnRenderableSeries.js +77 -8
  254. package/Charting/Visuals/RenderableSeries/FastErrorBarsRenderableSeries.js +2 -1
  255. package/Charting/Visuals/RenderableSeries/FastImpulseRenderableSeries.d.ts +7 -0
  256. package/Charting/Visuals/RenderableSeries/FastImpulseRenderableSeries.js +16 -4
  257. package/Charting/Visuals/RenderableSeries/FastLineRenderableSeries.js +2 -1
  258. package/Charting/Visuals/RenderableSeries/FastMountainRenderableSeries.js +2 -1
  259. package/Charting/Visuals/RenderableSeries/FastOhlcRenderableSeries.js +2 -1
  260. package/Charting/Visuals/RenderableSeries/FastTextRenderableSeries.d.ts +17 -0
  261. package/Charting/Visuals/RenderableSeries/FastTextRenderableSeries.js +45 -0
  262. package/Charting/Visuals/RenderableSeries/HeatmapColorMap.js +3 -2
  263. package/Charting/Visuals/RenderableSeries/HitTest/BandSeriesHitTestProvider.js +35 -5
  264. package/Charting/Visuals/RenderableSeries/HitTest/BaseHitTestProvider.js +17 -1
  265. package/Charting/Visuals/RenderableSeries/HitTest/HitTestInfo.d.ts +8 -0
  266. package/Charting/Visuals/RenderableSeries/HitTest/MountainSeriesHitTestProvider.js +7 -1
  267. package/Charting/Visuals/RenderableSeries/HitTest/NonUniformHeatmapHitTestProvider.d.ts +20 -0
  268. package/Charting/Visuals/RenderableSeries/HitTest/NonUniformHeatmapHitTestProvider.js +86 -0
  269. package/Charting/Visuals/RenderableSeries/HitTest/TextSeriesHitTestProvider.d.ts +6 -0
  270. package/Charting/Visuals/RenderableSeries/HitTest/TextSeriesHitTestProvider.js +56 -0
  271. package/Charting/Visuals/RenderableSeries/HitTest/UniformHeatmapHitTestProvider.js +1 -1
  272. package/Charting/Visuals/RenderableSeries/HitTest/hitTestHelpers.d.ts +7 -1
  273. package/Charting/Visuals/RenderableSeries/HitTest/hitTestHelpers.js +34 -2
  274. package/Charting/Visuals/RenderableSeries/IBaseRenderableSeriesOptions.d.ts +6 -1
  275. package/Charting/Visuals/RenderableSeries/IRenderableSeries.d.ts +12 -0
  276. package/Charting/Visuals/RenderableSeries/NonUniformHeatmapRenderableSeries.d.ts +74 -0
  277. package/Charting/Visuals/RenderableSeries/NonUniformHeatmapRenderableSeries.js +99 -0
  278. package/Charting/Visuals/RenderableSeries/ShaderEffect.js +2 -2
  279. package/Charting/Visuals/RenderableSeries/SplineBandRenderableSeries.js +2 -1
  280. package/Charting/Visuals/RenderableSeries/SplineLineRenderableSeries.d.ts +2 -3
  281. package/Charting/Visuals/RenderableSeries/SplineLineRenderableSeries.js +2 -1
  282. package/Charting/Visuals/RenderableSeries/SplineMountainRenderableSeries.js +2 -1
  283. package/Charting/Visuals/RenderableSeries/StackedColumnCollection.js +2 -1
  284. package/Charting/Visuals/RenderableSeries/StackedColumnRenderableSeries.d.ts +3 -0
  285. package/Charting/Visuals/RenderableSeries/StackedColumnRenderableSeries.js +13 -2
  286. package/Charting/Visuals/RenderableSeries/StackedMountainCollection.js +4 -1
  287. package/Charting/Visuals/RenderableSeries/StackedMountainRenderableSeries.d.ts +7 -0
  288. package/Charting/Visuals/RenderableSeries/StackedMountainRenderableSeries.js +33 -9
  289. package/Charting/Visuals/RenderableSeries/UniformContoursRenderableSeries.d.ts +5 -0
  290. package/Charting/Visuals/RenderableSeries/UniformContoursRenderableSeries.js +7 -1
  291. package/Charting/Visuals/RenderableSeries/UniformHeatmapRenderableSeries.d.ts +2 -75
  292. package/Charting/Visuals/RenderableSeries/UniformHeatmapRenderableSeries.js +8 -130
  293. package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.d.ts +5 -0
  294. package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.js +7 -1
  295. package/Charting/Visuals/RenderableSeries/constants.d.ts +5 -1
  296. package/Charting/Visuals/RenderableSeries/constants.js +4 -0
  297. package/Charting/Visuals/RubberBandSvgRect/RubberBandSvgRect.js +3 -3
  298. package/Charting/Visuals/SciChartDefaults.d.ts +4 -0
  299. package/Charting/Visuals/SciChartDefaults.js +4 -0
  300. package/Charting/Visuals/SciChartOverview.js +5 -3
  301. package/Charting/Visuals/SciChartPieSurface/PieSegment/IPieSegment.d.ts +4 -0
  302. package/Charting/Visuals/SciChartPieSurface/PieSegment/PieSegment.d.ts +13 -0
  303. package/Charting/Visuals/SciChartPieSurface/PieSegment/PieSegment.js +22 -4
  304. package/Charting/Visuals/SciChartPieSurface/PieSegment/constants.d.ts +2 -1
  305. package/Charting/Visuals/SciChartPieSurface/PieSegment/constants.js +1 -0
  306. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.d.ts +5 -0
  307. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.js +17 -19
  308. package/Charting/Visuals/SciChartSurface.d.ts +225 -7
  309. package/Charting/Visuals/SciChartSurface.js +782 -28
  310. package/Charting/Visuals/SciChartSurfaceBase.d.ts +16 -1
  311. package/Charting/Visuals/SciChartSurfaceBase.js +34 -2
  312. package/Charting/Visuals/TextureManager/CanvasTexture.js +1 -1
  313. package/Charting/Visuals/TextureManager/DpiHelper.js +3 -7
  314. package/Charting/Visuals/TextureManager/TextureManager.d.ts +11 -0
  315. package/Charting/Visuals/TextureManager/TextureManager.js +37 -1
  316. package/Charting/Visuals/createMaster.js +7 -10
  317. package/Charting/Visuals/createSingle.js +2 -0
  318. package/Charting/Visuals/licenseManager2D.js +9 -9
  319. package/Charting/Visuals/sciChartInitCommon.js +16 -12
  320. package/Charting3D/CameraController.d.ts +5 -0
  321. package/Charting3D/CameraController.js +6 -0
  322. package/Charting3D/ChartModifiers/ResetCamera3DModifier.js +2 -1
  323. package/Charting3D/Visuals/Axis/AxisBase3D.js +7 -5
  324. package/Charting3D/Visuals/Axis/NumericAxis3D.js +2 -1
  325. package/Charting3D/Visuals/Primitives/ScatterPointsSceneEntity.d.ts +4 -0
  326. package/Charting3D/Visuals/Primitives/ScatterPointsSceneEntity.js +7 -0
  327. package/Charting3D/Visuals/Primitives/SurfaceMeshSceneEntity.js +6 -4
  328. package/Charting3D/Visuals/RenderableSeries/BaseRenderableSeries3D.d.ts +7 -2
  329. package/Charting3D/Visuals/RenderableSeries/BaseRenderableSeries3D.js +3 -2
  330. package/Charting3D/Visuals/RenderableSeries/SurfaceMesh/SurfaceMeshRenderableSeries3D.d.ts +0 -5
  331. package/Charting3D/Visuals/RenderableSeries/SurfaceMesh/SurfaceMeshRenderableSeries3D.js +12 -11
  332. package/Charting3D/Visuals/SciChart3DSurface.d.ts +2 -2
  333. package/Charting3D/Visuals/SciChart3DSurface.js +18 -11
  334. package/Charting3D/Visuals/createMaster3d.js +10 -18
  335. package/Charting3D/Visuals/createSingle3d.js +12 -10
  336. package/Core/Animations/GenericAnimation.d.ts +2 -0
  337. package/Core/Animations/GenericAnimation.js +3 -0
  338. package/Core/Animations/NumberRangeAnimator.js +7 -2
  339. package/Core/BuildStamp.d.ts +1 -1
  340. package/Core/BuildStamp.js +2 -2
  341. package/Core/Mouse/MouseManager.d.ts +20 -0
  342. package/Core/Mouse/MouseManager.js +199 -30
  343. package/README.md +91 -403
  344. package/_wasm/scichart.browser.js +1 -1
  345. package/_wasm/scichart2d.data +0 -0
  346. package/_wasm/scichart2d.js +280 -267
  347. package/_wasm/scichart2d.wasm +0 -0
  348. package/_wasm/scichart3d.data +0 -0
  349. package/_wasm/scichart3d.js +280 -268
  350. package/_wasm/scichart3d.wasm +0 -0
  351. package/constants/performanceWarnings.d.ts +2 -0
  352. package/constants/performanceWarnings.js +3 -1
  353. package/package.json +2 -2
  354. package/types/AutoColorMode.d.ts +9 -0
  355. package/types/AutoColorMode.js +13 -0
  356. package/types/BaseType.d.ts +3 -1
  357. package/types/BaseType.js +2 -0
  358. package/types/DataLabelProviderType.d.ts +15 -0
  359. package/types/DataLabelProviderType.js +19 -0
  360. package/types/DataLabelSkipMode.d.ts +21 -0
  361. package/types/DataLabelSkipMode.js +25 -0
  362. package/types/DefaultRenderLayer.d.ts +10 -0
  363. package/types/DefaultRenderLayer.js +14 -0
  364. package/types/SeriesType.d.ts +7 -1
  365. package/types/SeriesType.js +6 -0
  366. package/types/SvgClippingMode.d.ts +17 -0
  367. package/types/SvgClippingMode.js +21 -0
  368. package/types/TDataLabelStyle.d.ts +16 -0
  369. package/types/TDataLabelStyle.js +2 -0
  370. package/types/TSciChart.d.ts +214 -118
  371. package/types/TSciChart3D.d.ts +104 -70
  372. package/types/TextPosition.d.ts +17 -0
  373. package/types/TextPosition.js +39 -0
  374. package/types/ThemeProviderType.d.ts +3 -1
  375. package/types/ThemeProviderType.js +2 -0
  376. package/utils/ccall/appendDoubleVectorFromJsArray.d.ts +10 -1
  377. package/utils/ccall/appendDoubleVectorFromJsArray.js +24 -1
  378. package/utils/memoize.d.ts +1 -0
  379. package/utils/memoize.js +26 -0
  380. package/utils/number.d.ts +1 -0
  381. package/utils/number.js +5 -1
  382. package/utils/parseColor.d.ts +2 -0
  383. package/utils/parseColor.js +3 -3
  384. package/utils/text.d.ts +5 -0
  385. package/utils/text.js +48 -0
  386. package/utils/translate.d.ts +8 -0
  387. package/utils/translate.js +27 -5
  388. package/utils/zeroArray2D.d.ts +5 -0
  389. package/utils/zeroArray2D.js +5 -0
@@ -26,10 +26,11 @@ var __assign = (this && this.__assign) || function () {
26
26
  return __assign.apply(this, arguments);
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.SciChartSurface = exports.sciChartConfig = void 0;
29
+ exports.SciChartSubSurface = exports.SciChartSurface = exports.sciChartConfig = void 0;
30
30
  var chartBuilder_1 = require("../../Builder/chartBuilder");
31
31
  var classFactory_1 = require("../../Builder/classFactory");
32
32
  var app_1 = require("../../constants/app");
33
+ var performanceWarnings_1 = require("../../constants/performanceWarnings");
33
34
  var EasingFunctions_1 = require("../../Core/Animations/EasingFunctions");
34
35
  var BuildStamp_1 = require("../../Core/BuildStamp");
35
36
  var Deleter_1 = require("../../Core/Deleter");
@@ -38,11 +39,17 @@ var EventHandler_1 = require("../../Core/EventHandler");
38
39
  var ObservableArray_1 = require("../../Core/ObservableArray");
39
40
  var Rect_1 = require("../../Core/Rect");
40
41
  var Thickness_1 = require("../../Core/Thickness");
42
+ var AutoColorMode_1 = require("../../types/AutoColorMode");
41
43
  var BaseType_1 = require("../../types/BaseType");
42
44
  var SeriesType_1 = require("../../types/SeriesType");
43
45
  var Size_1 = require("../../types/Size");
46
+ var SvgClippingMode_1 = require("../../types/SvgClippingMode");
44
47
  var ZoomState_1 = require("../../types/ZoomState");
48
+ var parseColor_1 = require("../../utils/parseColor");
49
+ var translate_1 = require("../../utils/translate");
45
50
  var ChartModifierBase_1 = require("../ChartModifiers/ChartModifierBase");
51
+ var BatchRenderContext_1 = require("../Drawing/BatchRenderContext");
52
+ var BrushCache_1 = require("../Drawing/BrushCache");
46
53
  var RenderContext2D_1 = require("../Drawing/RenderContext2D");
47
54
  var RenderSurface_1 = require("../Drawing/RenderSurface");
48
55
  var SolidBrushCache_1 = require("../Drawing/SolidBrushCache");
@@ -50,14 +57,20 @@ var LayoutManager_1 = require("../LayoutManager/LayoutManager");
50
57
  var SciChartRenderer_1 = require("../Services/SciChartRenderer");
51
58
  var TextureWorker_1 = require("../Services/Workers/TextureWorker");
52
59
  var AdornerLayer_1 = require("./Annotations/AdornerLayer");
60
+ var AnnotationBase_1 = require("./Annotations/AnnotationBase");
61
+ var AxisBase2D_1 = require("./Axis/AxisBase2D");
62
+ var AxisCore_1 = require("./Axis/AxisCore");
53
63
  var createMaster_1 = require("./createMaster");
54
64
  var createSingle_1 = require("./createSingle");
65
+ var createNativeRect_1 = require("./Helpers/createNativeRect");
55
66
  var drawBorder_1 = require("./Helpers/drawBorder");
67
+ var NativeObject_1 = require("./Helpers/NativeObject");
56
68
  var StackedColumnCollection_1 = require("./RenderableSeries/StackedColumnCollection");
57
69
  var StackedMountainCollection_1 = require("./RenderableSeries/StackedMountainCollection");
58
70
  var sciChartInitCommon_1 = require("./sciChartInitCommon");
59
71
  var SciChartSurfaceBase_1 = require("./SciChartSurfaceBase");
60
72
  var DpiHelper_1 = require("./TextureManager/DpiHelper");
73
+ var UpdateSuspender_1 = require("./UpdateSuspender");
61
74
  exports.sciChartConfig = {};
62
75
  // To force the worker to be created before it is needed, so we know if it alive or not
63
76
  var t = TextureWorker_1.textureWorker;
@@ -88,16 +101,35 @@ var SciChartSurface = /** @class */ (function (_super) {
88
101
  * @param options optional parameters of type {@link ISciChartSurfaceOptions} used to configure the {@link SciChartSurface}
89
102
  */
90
103
  function SciChartSurface(webAssemblyContext, options) {
91
- var _a, _b, _c, _d;
92
- var _this = _super.call(this, webAssemblyContext, options === null || options === void 0 ? void 0 : options.canvases) || this;
104
+ var _this = this;
105
+ var _a, _b, _c, _d, _e;
106
+ _this = _super.call(this, webAssemblyContext, options === null || options === void 0 ? void 0 : options.canvases) || this;
93
107
  /**
94
- * An event handler which notifies its subsribers when a render operation has finished. Use this
108
+ * An event handler which notifies its subscribers when a render operation has finished. Use this
95
109
  * to time render performance, or to update elements of the chart or your UI on redraw.
96
110
  */
97
111
  _this.rendered = new EventHandler_1.EventHandler();
112
+ /**
113
+ * An event handler which notifies its subscribers when a render operation starts. Use this
114
+ * to update elements of the chart for the current render. Any updates made here will not trigger a subsequent render.
115
+ */
116
+ _this.preRender = new EventHandler_1.EventHandler();
117
+ // TODO make these properties internal only; or add some provider
118
+ _this.layersOffset = 0;
119
+ _this.stepBetweenLayers = 10;
120
+ _this.isSubSurface = false;
121
+ /**
122
+ * Sets / Gets the clipping mode for SVG Annotations
123
+ */
124
+ _this.svgClippingMode = SvgClippingMode_1.ESvgClippingMode.SeriesViewRect;
125
+ /**
126
+ * Normally, native labels are drawn all at once at the end of the render cycle to improve performance.
127
+ * In circumstances where you want to draw over the labels, eg with a subchart, set this true to have them drawn earlier.
128
+ */
129
+ _this.renderNativeAxisLabelsImmediately = false;
98
130
  _this.animationList = [];
99
- _this.zoomStateProperty = ZoomState_1.EZoomState.AtExtents;
100
131
  _this.paddingProperty = Thickness_1.Thickness.fromNumber(10);
132
+ _this.zoomStateProperty = ZoomState_1.EZoomState.AtExtents;
101
133
  _this.viewportBorderProperty = {
102
134
  borderBottom: undefined,
103
135
  borderLeft: undefined,
@@ -114,7 +146,11 @@ var SciChartSurface = /** @class */ (function (_super) {
114
146
  color: "#00000000",
115
147
  border: undefined
116
148
  };
149
+ _this.subChartsProperty = [];
117
150
  _this.drawSeriesBehindAxisProperty = false;
151
+ _this.autoColorModeProperty = AutoColorMode_1.EAutoColorMode.OnAddRemoveSeries;
152
+ _this.autoColorRequired = true;
153
+ _this.subChartCounter = 0;
118
154
  var canvasWidth = (_b = (_a = _this.domCanvas2D) === null || _a === void 0 ? void 0 : _a.width) !== null && _b !== void 0 ? _b : app_1.DEFAULT_WIDTH;
119
155
  var canvasHeight = (_d = (_c = _this.domCanvas2D) === null || _c === void 0 ? void 0 : _c.height) !== null && _d !== void 0 ? _d : app_1.DEFAULT_HEIGHT;
120
156
  _this.webAssemblyContext2D = webAssemblyContext;
@@ -133,7 +169,7 @@ var SciChartSurface = /** @class */ (function (_super) {
133
169
  var viewportSize = _this.domCanvas2D
134
170
  ? new Size_1.Size(canvasWidth, canvasHeight)
135
171
  : new Size_1.Size(app_1.DEFAULT_WIDTH, app_1.DEFAULT_HEIGHT);
136
- _this.renderSurface = new RenderSurface_1.RenderSurface(webAssemblyContext, viewportSize);
172
+ _this.renderSurface = new RenderSurface_1.RenderSurface(webAssemblyContext, viewportSize, (_e = _this.domCanvas2D) === null || _e === void 0 ? void 0 : _e.id);
137
173
  _this.renderSurface.handleDraw = _this.onRenderSurfaceDraw;
138
174
  _this.sciChartRenderer = new SciChartRenderer_1.SciChartRenderer(_this);
139
175
  _this.layoutManager = new LayoutManager_1.LayoutManager();
@@ -191,7 +227,6 @@ var SciChartSurface = /** @class */ (function (_super) {
191
227
  _this.watermarkProperties.SetOpacity(0.5);
192
228
  webAssemblyContext.SCRTSetWaterMarkProperties(_this.watermarkProperties);
193
229
  }
194
- _this.applySciChartBackground(SciChartSurfaceBase_1.SciChartSurfaceBase.DEFAULT_THEME.sciChartBackground);
195
230
  return _this;
196
231
  }
197
232
  /**
@@ -214,7 +249,9 @@ var SciChartSurface = /** @class */ (function (_super) {
214
249
  }
215
250
  };
216
251
  /**
217
- * USED INTERNALLY - performs a similar operation to {@link SciChartSurface.create} but used internally for testing
252
+ * Performs a similar operation to {@link SciChartSurface.create} but uses a dedicated WebAssembly context for this chart, and draws directly to the target canvas
253
+ * This provides better performance for a single chart, but there is a limit (16) to how many you can have on one page.
254
+ * If you need large numbers of charts all updating at the same time, use this, together with {@link addSubChart} to create many charts on one surface.
218
255
  * @param divElement The Div Element ID or reference where the {@link SciChartSurface} will reside
219
256
  * @param options - optional parameters for chart creation. See {@link I2DSurfaceOptions} for more details
220
257
  */
@@ -268,6 +305,76 @@ var SciChartSurface = /** @class */ (function (_super) {
268
305
  return resolve({ wasmContext: sciChartSurface.webAssemblyContext2D, sciChartSurface: sciChartSurface });
269
306
  });
270
307
  };
308
+ /**
309
+ * Add another chart to an existing surface.
310
+ * This is a performance optimization if you need to have multiple charts all updating together, eg because they have synced axes.
311
+ * We suggest you use SciChartSurface.createSingle for the parent surface. The parent surface does not have to have any chart elements defined.
312
+ * The position property required in the options determines the placement and size of the subchart. Its values are interpreted differently depending on the coordinateMode
313
+ * Modifiers using modifierGroup will work across other subcharts on the surface, but not to any other surface.
314
+ */
315
+ SciChartSurface.prototype.addSubChart = function (options) {
316
+ var optionsBase = SciChartSurface.resolveOptions(options);
317
+ options = __assign(__assign({}, options), optionsBase);
318
+ this.subChartCounter++;
319
+ var divElementId = this.domChartRoot.id + "_" + this.subChartCounter.toString();
320
+ var chartRoot = this.domChartRoot;
321
+ var width = chartRoot.clientWidth;
322
+ var height = chartRoot.clientHeight;
323
+ // SVG Root Element
324
+ var svgRootElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
325
+ svgRootElement.id = "".concat(divElementId, "_SVG");
326
+ svgRootElement.setAttribute("width", width.toString());
327
+ svgRootElement.setAttribute("height", height.toString());
328
+ svgRootElement.setAttribute("role", "img");
329
+ svgRootElement.setAttribute("xmlns", "http://www.w3.org/2000/svg");
330
+ svgRootElement.style.position = "absolute";
331
+ svgRootElement.style.left = "0";
332
+ svgRootElement.style.top = "0";
333
+ svgRootElement.style.display = "block";
334
+ svgRootElement.style.pointerEvents = "none";
335
+ chartRoot.appendChild(svgRootElement);
336
+ var canvases = {
337
+ domChartRoot: this.domChartRoot,
338
+ domCanvasWebGL: this.domCanvasWebGL,
339
+ domCanvas2D: this.domCanvas2D,
340
+ domSvgContainer: svgRootElement,
341
+ domSvgAdornerLayer: this.domSvgAdornerLayer,
342
+ domDivContainer: this.domDivContainer
343
+ };
344
+ var subSurface = new SciChartSubSurface(this.webAssemblyContext2D, {
345
+ canvases: canvases,
346
+ parentSurface: this,
347
+ subSurfaceOptions: options
348
+ });
349
+ if (options === null || options === void 0 ? void 0 : options.theme) {
350
+ subSurface.applyTheme(options.theme);
351
+ }
352
+ // subcharts get mouse events from parent
353
+ subSurface.mouseManager.unsubscribe();
354
+ this.subChartsProperty.push(subSurface);
355
+ this.onAttachSubSurface(subSurface);
356
+ return subSurface;
357
+ };
358
+ /**
359
+ * Remove an existing subChart from a parent surface. See {@link addSubChart}
360
+ */
361
+ SciChartSurface.prototype.removeSubChart = function (subChart) {
362
+ var index = this.subChartsProperty.findIndex(function (s) { return s === subChart; });
363
+ if (index > -1) {
364
+ this.subChartsProperty.splice(index, 1);
365
+ subChart.delete();
366
+ }
367
+ };
368
+ Object.defineProperty(SciChartSurface.prototype, "subCharts", {
369
+ /**
370
+ * The list of subCharts on this surface. See {@link addSubChart}
371
+ */
372
+ get: function () {
373
+ return this.subChartsProperty;
374
+ },
375
+ enumerable: false,
376
+ configurable: true
377
+ });
271
378
  Object.defineProperty(SciChartSurface.prototype, "surfaceType", {
272
379
  /**
273
380
  * @inheritDoc
@@ -296,6 +403,23 @@ var SciChartSurface = /** @class */ (function (_super) {
296
403
  enumerable: false,
297
404
  configurable: true
298
405
  });
406
+ Object.defineProperty(SciChartSurface.prototype, "dataLabelLayoutManager", {
407
+ /**
408
+ * Gets or sets the {@link ISeriesTextLayoutManager} for performing text layout across multiple series
409
+ */
410
+ get: function () {
411
+ return this.dataLabelLayoutManagerProperty;
412
+ },
413
+ /**
414
+ * Used internally - gets or sets the {@link ISeriesTextLayoutManager} for performing text layout across multiple series
415
+ */
416
+ set: function (value) {
417
+ this.dataLabelLayoutManagerProperty = value;
418
+ this.invalidateElement();
419
+ },
420
+ enumerable: false,
421
+ configurable: true
422
+ });
299
423
  Object.defineProperty(SciChartSurface.prototype, "padding", {
300
424
  /**
301
425
  * Gets or sets the Padding between the SciChartSurface and it's inner elements, in order top, right, bottom, left
@@ -313,8 +437,10 @@ var SciChartSurface = /** @class */ (function (_super) {
313
437
  * set a new Thickness when you want to change the padding.
314
438
  */
315
439
  set: function (padding) {
316
- this.paddingProperty = padding;
317
- this.invalidateElement();
440
+ if (!this.paddingProperty.equals(padding)) {
441
+ this.paddingProperty = padding;
442
+ this.invalidateElement();
443
+ }
318
444
  },
319
445
  enumerable: false,
320
446
  configurable: true
@@ -349,6 +475,29 @@ var SciChartSurface = /** @class */ (function (_super) {
349
475
  enumerable: false,
350
476
  configurable: true
351
477
  });
478
+ Object.defineProperty(SciChartSurface.prototype, "autoColorMode", {
479
+ /**
480
+ * Gets or sets the EAutoColorMode which determines when resolution of AUTO_COLOR should occur
481
+ */
482
+ get: function () {
483
+ return this.autoColorModeProperty;
484
+ },
485
+ /**
486
+ * Gets or sets the EAutoColorMode which determines when resolution of AUTO_COLOR should occur
487
+ */
488
+ set: function (autoColorMode) {
489
+ this.autoColorModeProperty = autoColorMode;
490
+ if (autoColorMode !== AutoColorMode_1.EAutoColorMode.Never && !this.autoColorRequired) {
491
+ this.autoColorRequired = true;
492
+ }
493
+ else if (autoColorMode === AutoColorMode_1.EAutoColorMode.Never) {
494
+ this.autoColorRequired = false;
495
+ }
496
+ this.invalidateElement();
497
+ },
498
+ enumerable: false,
499
+ configurable: true
500
+ });
352
501
  /**
353
502
  * @inheritDoc
354
503
  */
@@ -383,8 +532,9 @@ var SciChartSurface = /** @class */ (function (_super) {
383
532
  this.domSvgAdornerLayer.setAttribute("width", pixelWidth.toString());
384
533
  this.domSvgAdornerLayer.setAttribute("height", pixelHeight.toString());
385
534
  }
386
- if (this.domDivContainer) {
387
- this.domDivContainer.style.height = "".concat(pixelHeight, "px");
535
+ for (var _i = 0, _a = this.subChartsProperty; _i < _a.length; _i++) {
536
+ var chart = _a[_i];
537
+ chart.updateSubLayout();
388
538
  }
389
539
  this.invalidateElement();
390
540
  };
@@ -402,14 +552,43 @@ var SciChartSurface = /** @class */ (function (_super) {
402
552
  this.renderSurface.invalidateElement(canvasId);
403
553
  };
404
554
  // Step_5: Get context and pass drawing to SciChartRenderer
405
- SciChartSurface.prototype.doDrawingLoop = function () {
406
- var context = this.renderSurface.getRenderContext();
555
+ SciChartSurface.prototype.doDrawingLoop = function (context) {
556
+ context = context !== null && context !== void 0 ? context : this.renderSurface.getRenderContext();
407
557
  try {
408
- // console.log("Drawing ", this.domChartRoot.id);
558
+ var sus = new UpdateSuspender_1.UpdateSuspender(this, false); // Don't want to invalidate on resume
559
+ try {
560
+ if (this.autoColorRequired &&
561
+ this.themeProvider.strokePalette &&
562
+ this.themeProvider.strokePalette.length > 0) {
563
+ this.resolveAutoColors();
564
+ if (this.autoColorMode !== AutoColorMode_1.EAutoColorMode.Always) {
565
+ this.autoColorRequired = false;
566
+ }
567
+ }
568
+ this.preRender.raiseEvent(context);
569
+ }
570
+ catch (err) {
571
+ console.error(err);
572
+ }
573
+ finally {
574
+ sus.resume();
575
+ }
409
576
  this.sciChartRenderer.render(context);
410
577
  }
411
578
  catch (err) {
412
- console.error("Error from chart in div ".concat(this.domChartRoot.id), err);
579
+ // @ts-ignore
580
+ if (err.name === "BindingError") {
581
+ console.error(err);
582
+ console.warn("Binding errors can occur if a previous chart using the same div id was not deleted correctly, or if you try to share data or series between charts that use different webassembly contexts.");
583
+ (0, NativeObject_1.freeCache)(this.webAssemblyContext2D);
584
+ }
585
+ else if (this.domChartRoot) {
586
+ console.error("Error from chart in div ".concat(this.domChartRoot.id), err);
587
+ }
588
+ else {
589
+ // Surface the error for tests
590
+ throw err;
591
+ }
413
592
  }
414
593
  };
415
594
  /**
@@ -418,6 +597,11 @@ var SciChartSurface = /** @class */ (function (_super) {
418
597
  SciChartSurface.prototype.delete = function (clearHtml) {
419
598
  if (clearHtml === void 0) { clearHtml = true; }
420
599
  _super.prototype.delete.call(this);
600
+ for (var _i = 0, _a = this.subChartsProperty; _i < _a.length; _i++) {
601
+ var chart = _a[_i];
602
+ chart.delete();
603
+ }
604
+ this.subChartsProperty = [];
421
605
  this.renderableSeries.asArray().forEach(function (rs) { return rs.delete(); });
422
606
  this.renderableSeries.clear();
423
607
  this.xAxes.asArray().forEach(function (xAxis) { return xAxis.delete(); });
@@ -452,6 +636,8 @@ var SciChartSurface = /** @class */ (function (_super) {
452
636
  this.renderableSeries.asArray().forEach(function (rs) { return rs.onDpiChanged(args); });
453
637
  this.annotations.asArray().forEach(function (a) { return a.onDpiChanged(args); });
454
638
  this.modifierAnnotations.asArray().forEach(function (a) { return a.onDpiChanged(args); });
639
+ this.xAxes.asArray().forEach(function (a) { return a.onDpiChanged(); });
640
+ this.yAxes.asArray().forEach(function (a) { return a.onDpiChanged(); });
455
641
  // Force a viewport size change as size-changed may not fire when parent div has width, height
456
642
  this.changeViewportSize((_a = this.getMainCanvas()) === null || _a === void 0 ? void 0 : _a.clientWidth, (_b = this.getMainCanvas()) === null || _b === void 0 ? void 0 : _b.clientHeight);
457
643
  _super.prototype.onDpiChanged.call(this, args);
@@ -461,20 +647,28 @@ var SciChartSurface = /** @class */ (function (_super) {
461
647
  * @param axisId The AxisId to search for
462
648
  */
463
649
  SciChartSurface.prototype.getXAxisById = function (axisId) {
464
- return this.xAxes.asArray().find(function (x) { return x.id === axisId; });
650
+ var axis = this.xAxes.getById(axisId);
651
+ if (!axis && axisId === AxisCore_1.AxisCore.DEFAULT_AXIS_ID && this.xAxes.size() > 0) {
652
+ axis = this.xAxes.get(0);
653
+ }
654
+ return axis;
465
655
  };
466
656
  /**
467
657
  * Gets the {@link AxisBase2D | YAxis} which matches the axisId. Returns undefined if not axis found
468
658
  * @param axisId The AxisId to search for
469
659
  */
470
660
  SciChartSurface.prototype.getYAxisById = function (axisId) {
471
- return this.yAxes.asArray().find(function (y) { return y.id === axisId; });
661
+ var axis = this.yAxes.getById(axisId);
662
+ if (!axis && axisId === AxisCore_1.AxisCore.DEFAULT_AXIS_ID && this.yAxes.size() > 0) {
663
+ axis = this.yAxes.get(0);
664
+ }
665
+ return axis;
472
666
  };
473
667
  /**
474
668
  * Update accumulated vectors for all stacked collections
475
669
  */
476
670
  SciChartSurface.prototype.updateStackedCollectionAccumulatedVectors = function () {
477
- var stackedCollection = this.renderableSeries.asArray().filter(function (el) { return el.isStacked; });
671
+ var stackedCollection = this.renderableSeries.asArray().filter(function (el) { return el.isStacked && "size" in el; });
478
672
  stackedCollection.forEach(function (el) { return el.updateAccumulatedVectors(); });
479
673
  };
480
674
  /**
@@ -525,10 +719,14 @@ var SciChartSurface = /** @class */ (function (_super) {
525
719
  * @inheritDoc
526
720
  */
527
721
  SciChartSurface.prototype.updateWatermark = function (left, bottom) {
722
+ var _a;
528
723
  if (!app_1.IS_TEST_ENV) {
529
724
  this.watermarkPropertyPosition.x = left;
530
725
  this.watermarkPropertyPosition.y = bottom;
726
+ this.watermarkProperties.m_fCanvasWidth = this.renderSurface.viewportSize.width;
531
727
  this.watermarkProperties.SetPosition(this.watermarkPropertyPosition);
728
+ var isLightBackground = (_a = this.themeProvider) === null || _a === void 0 ? void 0 : _a.isLightBackground;
729
+ this.watermarkProperties.m_bIsDarkBackground = isLightBackground !== undefined ? !isLightBackground : false;
532
730
  this.webAssemblyContext2D.SCRTSetWaterMarkProperties(this.watermarkProperties);
533
731
  }
534
732
  };
@@ -715,10 +913,15 @@ var SciChartSurface = /** @class */ (function (_super) {
715
913
  * Multiple animations will be run in parallel, so if you want to run one after another, use the onCompleted callback
716
914
  * to add another animation after the first completes
717
915
  */
718
- SciChartSurface.prototype.addAnimation = function (animation) {
719
- if (!animation)
916
+ SciChartSurface.prototype.addAnimation = function () {
917
+ var _this = this;
918
+ var animations = [];
919
+ for (var _i = 0; _i < arguments.length; _i++) {
920
+ animations[_i] = arguments[_i];
921
+ }
922
+ if (animations === undefined)
720
923
  return;
721
- this.animationList.push(animation);
924
+ animations.forEach(function (a) { return _this.animationList.push(a); });
722
925
  this.invalidateElement();
723
926
  };
724
927
  Object.defineProperty(SciChartSurface.prototype, "isRunningAnimation", {
@@ -751,6 +954,32 @@ var SciChartSurface = /** @class */ (function (_super) {
751
954
  var bottom = (this.domCanvas2D.height - seriesViewRect.bottom) / divider;
752
955
  return new Thickness_1.Thickness(top, right, bottom, left);
753
956
  };
957
+ /** Calls resolveAutoColors on each series to resolve colors marked as auto based on the seriesColorPalette */
958
+ SciChartSurface.prototype.resolveAutoColors = function (maxSeries) {
959
+ if (!maxSeries) {
960
+ var stackedCollections = this.renderableSeries
961
+ .asArray()
962
+ .filter(function (el) { return el.isStacked && "size" in el; });
963
+ maxSeries = this.renderableSeries.size() - stackedCollections.length;
964
+ for (var _i = 0, stackedCollections_1 = stackedCollections; _i < stackedCollections_1.length; _i++) {
965
+ var sc = stackedCollections_1[_i];
966
+ maxSeries += sc.size();
967
+ }
968
+ }
969
+ var index = 0;
970
+ for (var i = 0; i < this.renderableSeries.size(); i++) {
971
+ var rs = this.renderableSeries.get(i);
972
+ if (rs) {
973
+ rs.resolveAutoColors(index, maxSeries, this.themeProvider);
974
+ }
975
+ if (rs.isStacked && "size" in rs) {
976
+ index += rs.size();
977
+ }
978
+ else {
979
+ index += 1;
980
+ }
981
+ }
982
+ };
754
983
  /**
755
984
  * Convert the object to a definition that can be serialized to JSON, or used directly with the builder api
756
985
  * @param excludeData if set true, data values will not be included in the json.
@@ -767,6 +996,7 @@ var SciChartSurface = /** @class */ (function (_super) {
767
996
  theme = this.themeProvider;
768
997
  }
769
998
  var options = {
999
+ id: this.id,
770
1000
  canvasBorder: this.canvasBorder,
771
1001
  heightAspect: this.heightAspect,
772
1002
  widthAspect: this.widthAspect,
@@ -774,7 +1004,10 @@ var SciChartSurface = /** @class */ (function (_super) {
774
1004
  padding: this.padding,
775
1005
  theme: theme,
776
1006
  viewportBorder: this.viewportBorder,
777
- loader: this.loaderJson
1007
+ loader: this.loaderJson,
1008
+ drawSeriesBehindAxis: this.drawSeriesBehindAxis,
1009
+ disableAspect: this.disableAspect,
1010
+ autoColorMode: this.autoColorMode
778
1011
  };
779
1012
  var definition = {
780
1013
  surface: options,
@@ -783,7 +1016,9 @@ var SciChartSurface = /** @class */ (function (_super) {
783
1016
  series: this.renderableSeries.asArray().map(function (series) { return series.toJSON(excludeData); }),
784
1017
  modifiers: this.chartModifiers.asArray().map(function (modifier) { return modifier.toJSON(); }),
785
1018
  annotations: this.annotations.asArray().map(function (annotation) { return annotation.toJSON(); }),
786
- onCreated: this.onCreatedName
1019
+ onCreated: this.onCreatedName,
1020
+ subCharts: this.subCharts.map(function (sc) { return sc.toJSON(); }),
1021
+ createSingle: this.webAssemblyContext2D.canvas.id !== "SciChartMasterCanvas"
787
1022
  };
788
1023
  return definition;
789
1024
  };
@@ -811,12 +1046,18 @@ var SciChartSurface = /** @class */ (function (_super) {
811
1046
  if (options === null || options === void 0 ? void 0 : options.drawSeriesBehindAxis) {
812
1047
  this.drawSeriesBehindAxisProperty = options.drawSeriesBehindAxis;
813
1048
  }
1049
+ if (options === null || options === void 0 ? void 0 : options.autoColorMode) {
1050
+ this.autoColorMode = options.autoColorMode;
1051
+ }
814
1052
  };
815
1053
  /**
816
1054
  * @inheritDoc
817
1055
  */
818
1056
  SciChartSurface.prototype.detachChartModifier = function (chartModifier) {
819
1057
  _super.prototype.detachChartModifier.call(this, chartModifier);
1058
+ this.subCharts.forEach(function (subChart) {
1059
+ chartModifier.onDetachSubSurface(subChart);
1060
+ });
820
1061
  };
821
1062
  /**
822
1063
  * @inheritDoc
@@ -827,6 +1068,9 @@ var SciChartSurface = /** @class */ (function (_super) {
827
1068
  chartModifier.setParentSurface(this);
828
1069
  chartModifier.invalidateParentCallback = this.invalidateElement;
829
1070
  chartModifier.onAttach();
1071
+ this.subCharts.forEach(function (subChart) {
1072
+ chartModifier.onAttachSubSurface(subChart);
1073
+ });
830
1074
  this.invalidateElement();
831
1075
  }
832
1076
  };
@@ -857,7 +1101,9 @@ var SciChartSurface = /** @class */ (function (_super) {
857
1101
  if (onCompleted === void 0) { onCompleted = function () { }; }
858
1102
  this.yAxes.asArray().forEach(function (yAxis) {
859
1103
  var yRange = yAxis.getWindowedYRange(xRanges);
860
- yAxis.animateVisibleRange(yRange, animationDurationMs, easingFunction, onCompleted);
1104
+ if (yRange) {
1105
+ yAxis.animateVisibleRange(yRange, animationDurationMs, easingFunction, onCompleted);
1106
+ }
861
1107
  });
862
1108
  };
863
1109
  SciChartSurface.prototype.zoomExtentsXInternal = function (animationDurationMs, easingFunction, onCompleted) {
@@ -874,8 +1120,29 @@ var SciChartSurface = /** @class */ (function (_super) {
874
1120
  };
875
1121
  // Step_4: Start drawing
876
1122
  SciChartSurface.prototype.onRenderSurfaceDraw = function () {
877
- // Logger.log("onRenderSurfaceDraw! " + Date.now().toLocaleString());
878
- this.doDrawingLoop();
1123
+ var _a;
1124
+ if (this.subChartsProperty.length > 0) {
1125
+ var batchContext_1 = new BatchRenderContext_1.BatchRenderContext(this.webAssemblyContext2D, this.renderSurface.viewportSize, (_a = this.domCanvas2D) === null || _a === void 0 ? void 0 : _a.id);
1126
+ var visibleSubCharts_1 = this.subChartsProperty.filter(function (sc) { return sc.isVisible; });
1127
+ if (visibleSubCharts_1.length === 0) {
1128
+ // Draw on parent if no visible SubCharts
1129
+ batchContext_1.doDraw = true;
1130
+ }
1131
+ // Render parent
1132
+ this.doDrawingLoop(batchContext_1);
1133
+ var middleChartLayersOffset_1 = 100;
1134
+ visibleSubCharts_1.forEach(function (chart, index) {
1135
+ chart.layersOffset = middleChartLayersOffset_1 * (index + 1);
1136
+ if (index === visibleSubCharts_1.length - 1) {
1137
+ // If this is the last subChart, draw
1138
+ batchContext_1.doDraw = true;
1139
+ }
1140
+ chart.doDrawingLoop(batchContext_1);
1141
+ });
1142
+ }
1143
+ else {
1144
+ this.doDrawingLoop();
1145
+ }
879
1146
  };
880
1147
  SciChartSurface.prototype.detachSeries = function (renderableSeries) {
881
1148
  if (renderableSeries.type === SeriesType_1.ESeriesType.StackedColumnSeries ||
@@ -886,6 +1153,9 @@ var SciChartSurface = /** @class */ (function (_super) {
886
1153
  cm.onDetachSeries(renderableSeries);
887
1154
  });
888
1155
  renderableSeries.onDetach();
1156
+ if (this.autoColorMode === AutoColorMode_1.EAutoColorMode.OnAddRemoveSeries) {
1157
+ this.autoColorRequired = true;
1158
+ }
889
1159
  this.invalidateElement();
890
1160
  };
891
1161
  SciChartSurface.prototype.attachSeries = function (renderableSeries) {
@@ -916,13 +1186,18 @@ var SciChartSurface = /** @class */ (function (_super) {
916
1186
  col.add(renderableSeries);
917
1187
  this.renderableSeries.remove(renderableSeries);
918
1188
  }
919
- renderableSeries.onAttach(this);
1189
+ if (!renderableSeries.isStacked || "size" in renderableSeries) {
1190
+ renderableSeries.onAttach(this);
1191
+ }
920
1192
  if (this.themeProviderProperty) {
921
1193
  renderableSeries.applyTheme(this.themeProviderProperty);
922
1194
  }
923
1195
  this.chartModifiers.asArray().forEach(function (cm) {
924
1196
  cm.onAttachSeries(renderableSeries);
925
1197
  });
1198
+ if (this.autoColorMode === AutoColorMode_1.EAutoColorMode.OnAddRemoveSeries) {
1199
+ this.autoColorRequired = true;
1200
+ }
926
1201
  this.invalidateElement();
927
1202
  };
928
1203
  SciChartSurface.prototype.detachAxis = function (axis) {
@@ -963,6 +1238,16 @@ var SciChartSurface = /** @class */ (function (_super) {
963
1238
  annotation.onAttach(this);
964
1239
  this.invalidateElement();
965
1240
  };
1241
+ SciChartSurface.prototype.onAttachSubSurface = function (subSurface) {
1242
+ this.chartModifiers.asArray().forEach(function (modifier) {
1243
+ modifier.onAttachSubSurface(subSurface);
1244
+ });
1245
+ };
1246
+ SciChartSurface.prototype.onDetachSubSurface = function (subSurface) {
1247
+ this.chartModifiers.asArray().forEach(function (modifier) {
1248
+ modifier.onDetachSubSurface(subSurface);
1249
+ });
1250
+ };
966
1251
  Object.defineProperty(SciChartSurface.prototype, "drawSeriesBehindAxis", {
967
1252
  /**
968
1253
  * Gets or sets the boolean flag for switching behaviour of Axises rendering
@@ -983,3 +1268,472 @@ var SciChartSurface = /** @class */ (function (_super) {
983
1268
  return SciChartSurface;
984
1269
  }(SciChartSurfaceBase_1.SciChartSurfaceBase));
985
1270
  exports.SciChartSurface = SciChartSurface;
1271
+ /**
1272
+ * @summary The {@link SciChartSubSurface} is the surface created within another surface
1273
+ * @description
1274
+ * It can be added using {@link SciChartSurface.addSubChart} method.
1275
+ *
1276
+ * To update the positioning of the {@link SciChartSubSurface}, use {@link SciChartSubSurface.subPosition};
1277
+ * also you can call {@link SciChartSubSurface.updateSubLayout} to refresh the layout of the sub-surface.
1278
+ * @remarks
1279
+ * It is not possible to have more than one level of nested sub-surfaces.
1280
+ */
1281
+ // tslint:disable-next-line: max-classes-per-file
1282
+ var SciChartSubSurface = /** @class */ (function (_super) {
1283
+ __extends(SciChartSubSurface, _super);
1284
+ /**
1285
+ * Creates an instance of the {@link SciChartSurface}
1286
+ * @param webAssemblyContext The {@link TSciChart | SciChart 2D WebAssembly Context} containing native methods and
1287
+ * access to our WebGL2 Engine and WebAssembly numerical methods
1288
+ * @param options optional parameters of type {@link ISciChartSurfaceOptions} used to configure the {@link SciChart2DSurfaceBase}
1289
+ */
1290
+ function SciChartSubSurface(webAssemblyContext, options) {
1291
+ var _this = this;
1292
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
1293
+ _this = _super.call(this, webAssemblyContext, options) || this;
1294
+ _this.isSubSurface = true;
1295
+ _this.topSectionClass = "top-section";
1296
+ _this.leftSectionClass = "left-section";
1297
+ _this.bottomSectionClass = "bottom-section";
1298
+ _this.rightSectionClass = "right-section";
1299
+ // TODO move to constant for subCharts
1300
+ _this.backgroundProperty = "transparent";
1301
+ _this.isTransparentProperty = true;
1302
+ _this.subPositionProperty = new Rect_1.Rect(0, 0, 1, 1);
1303
+ _this.coordinateModeProperty = AnnotationBase_1.ECoordinateMode.Relative;
1304
+ _this.parentXAxisIdProperty = AxisBase2D_1.AxisBase2D.DEFAULT_AXIS_ID;
1305
+ _this.parentYAxisIdProperty = AxisBase2D_1.AxisBase2D.DEFAULT_AXIS_ID;
1306
+ _this.isVisibleProperty = true;
1307
+ _this.sectionScaleProperty = 1;
1308
+ _this.parentSurfaceProperty = options.parentSurface;
1309
+ _this.subChartContainerId = (_a = options.subSurfaceOptions) === null || _a === void 0 ? void 0 : _a.subChartContainerId;
1310
+ _this.subPaddingProperty = (_b = options === null || options === void 0 ? void 0 : options.subSurfaceOptions) === null || _b === void 0 ? void 0 : _b.subChartPadding;
1311
+ _this.isTransparentProperty = (_d = (_c = options === null || options === void 0 ? void 0 : options.subSurfaceOptions) === null || _c === void 0 ? void 0 : _c.isTransparent) !== null && _d !== void 0 ? _d : _this.isTransparent;
1312
+ _this.coordinateModeProperty = (_f = (_e = options === null || options === void 0 ? void 0 : options.subSurfaceOptions) === null || _e === void 0 ? void 0 : _e.coordinateMode) !== null && _f !== void 0 ? _f : _this.coordinateMode;
1313
+ _this.parentXAxisIdProperty = (_h = (_g = options === null || options === void 0 ? void 0 : options.subSurfaceOptions) === null || _g === void 0 ? void 0 : _g.parentXAxisId) !== null && _h !== void 0 ? _h : _this.parentXAxisId;
1314
+ _this.parentYAxisIdProperty = (_k = (_j = options === null || options === void 0 ? void 0 : options.subSurfaceOptions) === null || _j === void 0 ? void 0 : _j.parentYAxisId) !== null && _k !== void 0 ? _k : _this.parentYAxisId;
1315
+ _this.sectionScaleProperty = (_m = (_l = options === null || options === void 0 ? void 0 : options.subSurfaceOptions) === null || _l === void 0 ? void 0 : _l.sectionScale) !== null && _m !== void 0 ? _m : _this.sectionScaleProperty;
1316
+ _this.isVisible = (_p = (_o = options === null || options === void 0 ? void 0 : options.subSurfaceOptions) === null || _o === void 0 ? void 0 : _o.isVisible) !== null && _p !== void 0 ? _p : _this.isVisible;
1317
+ if (_this.subChartContainerId) {
1318
+ _this.subChartContainer =
1319
+ typeof _this.subChartContainerId === "string"
1320
+ ? document.getElementById(_this.subChartContainerId)
1321
+ : _this.subChartContainerId;
1322
+ }
1323
+ _this.applyOptions(options.subSurfaceOptions);
1324
+ _this.subPosition = (_q = options.subSurfaceOptions.position) !== null && _q !== void 0 ? _q : _this.subPositionProperty;
1325
+ _this.backgroundFillBrushCache = new BrushCache_1.BrushCache(webAssemblyContext);
1326
+ _this.preRender.subscribe(function (context) {
1327
+ // Parent coordcalc may not be available when the chart is first created, so recalculate padding before drawing
1328
+ if (_this.coordinateMode === AnnotationBase_1.ECoordinateMode.DataValue) {
1329
+ _this.updateSubLayout(true);
1330
+ }
1331
+ });
1332
+ return _this;
1333
+ }
1334
+ Object.defineProperty(SciChartSubSurface.prototype, "isTransparent", {
1335
+ /**
1336
+ * Whether other surfaces, including the parent, will be visible underneath this surface
1337
+ */
1338
+ get: function () {
1339
+ return this.isTransparentProperty;
1340
+ },
1341
+ /**
1342
+ * Whether other surfaces, including the parent, will be visible underneath this surface
1343
+ */
1344
+ set: function (value) {
1345
+ if (this.isTransparentProperty !== value) {
1346
+ this.isTransparentProperty = value;
1347
+ this.updateBackground();
1348
+ }
1349
+ },
1350
+ enumerable: false,
1351
+ configurable: true
1352
+ });
1353
+ Object.defineProperty(SciChartSubSurface.prototype, "subChartPadding", {
1354
+ /**
1355
+ * Gets or sets additional absolute padding between the SciChartSubSurface and its parent, in order top, right, bottom, left
1356
+ * {@link subPosition} is applied first, then this padding is added.
1357
+ */
1358
+ get: function () {
1359
+ return this.subPaddingProperty;
1360
+ },
1361
+ /**
1362
+ * Gets or sets additional absolute padding between the SciChartSubSurface and its parent, in order top, right, bottom, left
1363
+ * {@link subPosition} is applied first, then this padding is added.
1364
+ */
1365
+ set: function (padding) {
1366
+ this.subPaddingProperty = padding;
1367
+ this.updateSubLayout();
1368
+ },
1369
+ enumerable: false,
1370
+ configurable: true
1371
+ });
1372
+ Object.defineProperty(SciChartSubSurface.prototype, "coordinateMode", {
1373
+ /**
1374
+ * Gets or sets the {@link ECoordinateMode} used when calculating the actual position based on the {@link subPosition}
1375
+ */
1376
+ get: function () {
1377
+ return this.coordinateModeProperty;
1378
+ },
1379
+ /**
1380
+ * Gets or sets the {@link ECoordinateMode} used when calculating the actual position based on the {@link subPosition}
1381
+ */
1382
+ set: function (coordinateMode) {
1383
+ this.coordinateModeProperty = coordinateMode;
1384
+ this.updateSubLayout();
1385
+ },
1386
+ enumerable: false,
1387
+ configurable: true
1388
+ });
1389
+ Object.defineProperty(SciChartSubSurface.prototype, "parentXAxisId", {
1390
+ /**
1391
+ * Gets or sets the AxisId used to determing which X Axis should be used when calculating the actual position based on the {@link subPosition}
1392
+ * if {@link coordinateMode} is DataValue
1393
+ */
1394
+ get: function () {
1395
+ return this.parentXAxisIdProperty;
1396
+ },
1397
+ /**
1398
+ * Gets or sets the AxisId used to determing which X Axis should be used when calculating the actual position based on the {@link subPosition}
1399
+ * if {@link coordinateMode} is DataValue
1400
+ */
1401
+ set: function (id) {
1402
+ this.parentXAxisIdProperty = id;
1403
+ this.updateSubLayout();
1404
+ },
1405
+ enumerable: false,
1406
+ configurable: true
1407
+ });
1408
+ Object.defineProperty(SciChartSubSurface.prototype, "parentYAxisId", {
1409
+ /**
1410
+ * Gets or sets the AxisId used to determing which Y Axis should be used when calculating the actual position based on the {@link subPosition}
1411
+ * if {@link coordinateMode} is DataValue
1412
+ */
1413
+ get: function () {
1414
+ return this.parentYAxisIdProperty;
1415
+ },
1416
+ /**
1417
+ * Gets or sets the AxisId used to determing which Y Axis should be used when calculating the actual position based on the {@link subPosition}
1418
+ * if {@link coordinateMode} is DataValue
1419
+ */
1420
+ set: function (id) {
1421
+ this.parentYAxisIdProperty = id;
1422
+ this.updateSubLayout();
1423
+ },
1424
+ enumerable: false,
1425
+ configurable: true
1426
+ });
1427
+ Object.defineProperty(SciChartSubSurface.prototype, "subPosition", {
1428
+ /**
1429
+ * A rectangle defining the position and size of a subchart.
1430
+ * If {@link coordinateMode} is Relative (the default) then the values give the size as a proportion of the parent div, and all properties must be between 0 and 1 inclusive.
1431
+ * If {@link coordinateMode} is DataValue, values will be converted to coordinates using {@link parentXAxisId} and {@link parentYAxisId}. Subchart will be clpped to the parent SeriesViewRect
1432
+ * Can only be set if this is a subChart. See {@link addSubChart}
1433
+ */
1434
+ get: function () {
1435
+ return this.subPositionProperty;
1436
+ },
1437
+ /**
1438
+ * A rectangle defining the position and size of a subchart.
1439
+ * If {@link coordinateMode} is Relative (the default) then the values give the size as a proportion of the parent div, and all properties must be between 0 and 1 inclusive.
1440
+ * If {@link coordinateMode} is DataValue, values will be converted to coordinates using {@link parentXAxisId} and {@link parentYAxisId}. Subchart will be clpped to the parent SeriesViewRect
1441
+ * Can only be set if this is a subChart. See {@link addSubChart}
1442
+ */
1443
+ set: function (value) {
1444
+ if (!this.parentSurface) {
1445
+ throw new Error("subPosition can only be changed for subCharts.");
1446
+ }
1447
+ if (!Rect_1.Rect.isEqual(this.subPositionProperty, value)) {
1448
+ this.subPositionProperty = value;
1449
+ this.updateSubLayout();
1450
+ }
1451
+ },
1452
+ enumerable: false,
1453
+ configurable: true
1454
+ });
1455
+ Object.defineProperty(SciChartSubSurface.prototype, "isVisible", {
1456
+ /**
1457
+ * Gets or sets if the subchart is visible, allowing you to hide a subchart without removing it from the parent surface
1458
+ */
1459
+ get: function () {
1460
+ return this.isVisibleProperty;
1461
+ },
1462
+ /**
1463
+ * Gets or sets if the subchart is visible, allowing you to hide a subchart without removing it from the parent surface
1464
+ */
1465
+ set: function (isVisible) {
1466
+ this.isVisibleProperty = isVisible;
1467
+ this.invalidateElement();
1468
+ },
1469
+ enumerable: false,
1470
+ configurable: true
1471
+ });
1472
+ Object.defineProperty(SciChartSubSurface.prototype, "sectionScale", {
1473
+ /**
1474
+ * Gets or sets scale property for all sections
1475
+ * It is necessary if the scale transformation is being used for html areas around the subchart
1476
+ * For example, style = { width: "50%", transform: scale(2), transformOrigin: 'left top' }
1477
+ */
1478
+ get: function () {
1479
+ return this.sectionScaleProperty;
1480
+ },
1481
+ set: function (value) {
1482
+ this.sectionScaleProperty = value;
1483
+ this.updateSubLayout();
1484
+ },
1485
+ enumerable: false,
1486
+ configurable: true
1487
+ });
1488
+ /** Recalculate the position of the subChart. Call if you update the size of html elements in the wrapper */
1489
+ SciChartSubSurface.prototype.updateSubLayout = function (isDrawing) {
1490
+ if (isDrawing === void 0) { isDrawing = false; }
1491
+ this.updateWrapper(this.subPosition);
1492
+ var offsets = this.getOffsets(this.subChartContainer);
1493
+ this.padding = this.calcPadding(this.parentSurface.renderSurface.viewportSize, this.subPositionProperty, offsets, isDrawing);
1494
+ };
1495
+ Object.defineProperty(SciChartSubSurface.prototype, "parentSurface", {
1496
+ /**
1497
+ * The parent SciChartSurface, if this is a subChart. See {@link addSubChart}
1498
+ */
1499
+ get: function () {
1500
+ return this.parentSurfaceProperty;
1501
+ },
1502
+ enumerable: false,
1503
+ configurable: true
1504
+ });
1505
+ Object.defineProperty(SciChartSubSurface.prototype, "surfaceType", {
1506
+ /**
1507
+ * @inheritDoc
1508
+ */
1509
+ get: function () {
1510
+ return SciChartSurfaceBase_1.ESurfaceType.SciChartSurfaceType;
1511
+ },
1512
+ enumerable: false,
1513
+ configurable: true
1514
+ });
1515
+ /**
1516
+ * @inheritDoc
1517
+ */
1518
+ SciChartSubSurface.prototype.changeViewportSize = function (pixelWidth, pixelHeight) { };
1519
+ /**
1520
+ * Gets the sub-chart container
1521
+ */
1522
+ SciChartSubSurface.prototype.getSubChartContainer = function () {
1523
+ return this.subChartContainer;
1524
+ };
1525
+ SciChartSubSurface.prototype.getSubChartRect = function () {
1526
+ var _a = this.renderSurface.viewportSize, width = _a.width, height = _a.height;
1527
+ var _b = this.padding, top = _b.top, left = _b.left, bottom = _b.bottom, right = _b.right;
1528
+ return new Rect_1.Rect(left, top, width - left - right, height - top - bottom);
1529
+ };
1530
+ /**
1531
+ * @inheritDoc
1532
+ */
1533
+ SciChartSubSurface.prototype.delete = function (clearHtml) {
1534
+ if (clearHtml === void 0) { clearHtml = true; }
1535
+ // Don't ever clear html on the parent here as it kills the drawing for all subcharts.
1536
+ _super.prototype.delete.call(this, false);
1537
+ if (clearHtml && this.domChartRoot.contains(this.domSvgContainer)) {
1538
+ this.domChartRoot.removeChild(this.domSvgContainer);
1539
+ }
1540
+ this.backgroundFillBrushCache = (0, Deleter_1.deleteSafe)(this.backgroundFillBrushCache);
1541
+ };
1542
+ SciChartSubSurface.prototype.toJSON = function (excludeData) {
1543
+ var _a;
1544
+ if (excludeData === void 0) { excludeData = false; }
1545
+ var theme;
1546
+ if ("toJSON" in this.themeProvider) {
1547
+ // @ts-ignore
1548
+ theme = this.themeProvider.toJSON();
1549
+ }
1550
+ else {
1551
+ theme = this.themeProvider;
1552
+ }
1553
+ var options = {
1554
+ canvasBorder: this.canvasBorder,
1555
+ heightAspect: this.heightAspect,
1556
+ widthAspect: this.widthAspect,
1557
+ layoutManager: (_a = this.layoutManager) === null || _a === void 0 ? void 0 : _a.toJSON(),
1558
+ padding: this.subPaddingProperty,
1559
+ theme: theme,
1560
+ viewportBorder: this.viewportBorder,
1561
+ loader: this.loaderJson,
1562
+ position: this.subPosition,
1563
+ subChartContainerId: typeof this.subChartContainerId === "string" ? this.subChartContainerId : this.subChartContainerId.id,
1564
+ subChartPadding: this.subChartPadding,
1565
+ coordinateMode: this.coordinateMode,
1566
+ parentXAxisId: this.parentXAxisId,
1567
+ parentYAxisId: this.parentYAxisId
1568
+ };
1569
+ var definition = {
1570
+ surface: options,
1571
+ xAxes: this.xAxes.asArray().map(function (axis) { return axis.toJSON(); }),
1572
+ yAxes: this.yAxes.asArray().map(function (axis) { return axis.toJSON(); }),
1573
+ series: this.renderableSeries.asArray().map(function (series) { return series.toJSON(excludeData); }),
1574
+ modifiers: this.chartModifiers.asArray().map(function (modifier) { return modifier.toJSON(); }),
1575
+ annotations: this.annotations.asArray().map(function (annotation) { return annotation.toJSON(); })
1576
+ };
1577
+ return definition;
1578
+ };
1579
+ SciChartSubSurface.prototype.calcPadding = function (viewportSize, position, offsets, isDrawing) {
1580
+ var _a, _b, _c, _d, _e, _f, _g, _h;
1581
+ if (isDrawing === void 0) { isDrawing = false; }
1582
+ var scaledViewWidth = viewportSize.width, scaledViewHeight = viewportSize.height;
1583
+ var viewWidth = (0, translate_1.translateToNotScaled)(scaledViewWidth);
1584
+ var viewHeight = (0, translate_1.translateToNotScaled)(scaledViewHeight);
1585
+ var x = position.x, y = position.y, width = position.width, height = position.height;
1586
+ // Pixel mode
1587
+ // TODO DPI scale absolute coords?
1588
+ var left = x;
1589
+ var top = y;
1590
+ var bottom = viewHeight - y - height;
1591
+ var right = viewWidth - x - width;
1592
+ if (this.coordinateMode === AnnotationBase_1.ECoordinateMode.Relative) {
1593
+ left = viewWidth * x + offsets.left;
1594
+ top = viewHeight * y + offsets.top;
1595
+ right = viewWidth - viewWidth * x - viewWidth * width + offsets.right;
1596
+ bottom = viewHeight - viewHeight * y - viewHeight * height + offsets.bottom;
1597
+ }
1598
+ else if (this.coordinateMode === AnnotationBase_1.ECoordinateMode.DataValue && isDrawing) {
1599
+ var xAxis = this.parentSurface.getXAxisById(this.parentXAxisId);
1600
+ if (!xAxis) {
1601
+ throw new Error("No x axis with id ".concat(this.parentXAxisId, " found on parent surface"));
1602
+ }
1603
+ var xCoordCalc = xAxis.getCurrentCoordinateCalculator();
1604
+ var yAxis = this.parentSurface.getYAxisById(this.parentYAxisId);
1605
+ if (!yAxis) {
1606
+ throw new Error("No y axis with id ".concat(this.parentYAxisId, " found on parent surface"));
1607
+ }
1608
+ var seriesViewRect = this.parentSurface.seriesViewRect;
1609
+ var scaledParentLeft = (0, translate_1.translateToNotScaled)(seriesViewRect.left);
1610
+ var scaledParentTop = (0, translate_1.translateToNotScaled)(seriesViewRect.top);
1611
+ var scaledParentBottom = (0, translate_1.translateToNotScaled)(seriesViewRect.bottom);
1612
+ var scaledParentRight = (0, translate_1.translateToNotScaled)(seriesViewRect.right);
1613
+ var yCoordCalc = yAxis.getCurrentCoordinateCalculator();
1614
+ left = xAxis.isVerticalChart ? yCoordCalc.getCoordinate(x) : xCoordCalc.getCoordinate(x);
1615
+ top = xAxis.isVerticalChart ? xCoordCalc.getCoordinate(y) : yCoordCalc.getCoordinate(y);
1616
+ left = Math.max((0, translate_1.translateToNotScaled)(left), 0);
1617
+ top = Math.max((0, translate_1.translateToNotScaled)(top), 0);
1618
+ left += scaledParentLeft;
1619
+ top += scaledParentTop;
1620
+ var x2 = xAxis.flippedCoordinates ? x - width : x + width;
1621
+ var y2 = yAxis.flippedCoordinates ? y + height : y - height;
1622
+ bottom = Math.max(viewHeight -
1623
+ scaledParentTop -
1624
+ (0, translate_1.translateToNotScaled)(xAxis.isVerticalChart ? xCoordCalc.getCoordinate(y2) : yCoordCalc.getCoordinate(y2)), viewHeight - scaledParentBottom);
1625
+ right = Math.max(viewWidth -
1626
+ scaledParentLeft -
1627
+ (0, translate_1.translateToNotScaled)(xAxis.isVerticalChart ? yCoordCalc.getCoordinate(x2) : xCoordCalc.getCoordinate(x2)), viewWidth - scaledParentRight);
1628
+ }
1629
+ left += (_b = (_a = this.subPaddingProperty) === null || _a === void 0 ? void 0 : _a.left) !== null && _b !== void 0 ? _b : 0;
1630
+ top += (_d = (_c = this.subPaddingProperty) === null || _c === void 0 ? void 0 : _c.top) !== null && _d !== void 0 ? _d : 0;
1631
+ right += (_f = (_e = this.subPaddingProperty) === null || _e === void 0 ? void 0 : _e.right) !== null && _f !== void 0 ? _f : 0;
1632
+ bottom += (_h = (_g = this.subPaddingProperty) === null || _g === void 0 ? void 0 : _g.bottom) !== null && _h !== void 0 ? _h : 0;
1633
+ return new Thickness_1.Thickness(top, right, bottom, left);
1634
+ };
1635
+ /**
1636
+ * @inheritDoc
1637
+ */
1638
+ SciChartSubSurface.prototype.applySciChartBackground = function (background, alphaEnabled) {
1639
+ if (alphaEnabled === void 0) { alphaEnabled = true; }
1640
+ this.backgroundProperty = background;
1641
+ if (!this.isTransparent) {
1642
+ var renderContext = this.renderSurface.getRenderContext();
1643
+ var nativeContext = renderContext.getNativeContext();
1644
+ var _a = this.parentSurface.renderSurface.viewportSize, width = _a.width, height = _a.height;
1645
+ nativeContext.SetClipRect(this.adjustedPadding.left, this.adjustedPadding.top, width - this.adjustedPadding.right - this.adjustedPadding.left, height - this.adjustedPadding.bottom - this.adjustedPadding.top);
1646
+ nativeContext.SetClearColor(0, 0, 0, 0);
1647
+ nativeContext.Clear();
1648
+ nativeContext.SetClipRect(0, 0, width, height);
1649
+ try {
1650
+ // try parse background value. throws if cannot parse html color
1651
+ var brushColor = (0, parseColor_1.parseColorToUIntArgb)(background);
1652
+ var vecRects = (0, NativeObject_1.getVectorRectVertex)(this.webAssemblyContext2D);
1653
+ vecRects.push_back((0, createNativeRect_1.createNativeRect)(this.webAssemblyContext2D, this.adjustedPadding.left, this.adjustedPadding.top, this.renderSurface.viewportSize.width - this.adjustedPadding.right, this.renderSurface.viewportSize.height - this.adjustedPadding.bottom));
1654
+ var brush = (0, BrushCache_1.createBrushInCache)(this.backgroundFillBrushCache, background, 1);
1655
+ renderContext.drawRects(vecRects, brush, 0, 0);
1656
+ }
1657
+ catch (error) {
1658
+ performanceWarnings_1.performanceWarnings.subchartBackgroundNotSimpleColor.warn();
1659
+ }
1660
+ }
1661
+ };
1662
+ SciChartSubSurface.prototype.updateWrapper = function (subChartPosition) {
1663
+ var _this = this;
1664
+ if (!this.parentSurface || !this.subChartContainer) {
1665
+ return;
1666
+ }
1667
+ var seriesViewRect = this.parentSurface.seriesViewRect;
1668
+ if (!seriesViewRect && this.coordinateMode !== AnnotationBase_1.ECoordinateMode.Relative) {
1669
+ return;
1670
+ }
1671
+ this.subChartContainer.style.pointerEvents = "none";
1672
+ this.subChartContainer.style.position = "absolute";
1673
+ var getSubChartContainerPosition = function (subChartPosition) {
1674
+ if (_this.coordinateMode === AnnotationBase_1.ECoordinateMode.DataValue) {
1675
+ var xAxis = _this.parentSurface.getXAxisById(_this.parentXAxisId);
1676
+ if (!xAxis) {
1677
+ throw new Error("No x axis with id ".concat(_this.parentXAxisId, " found on parent surface"));
1678
+ }
1679
+ var yAxis = _this.parentSurface.getYAxisById(_this.parentYAxisId);
1680
+ if (!yAxis) {
1681
+ throw new Error("No y axis with id ".concat(_this.parentYAxisId, " found on parent surface"));
1682
+ }
1683
+ var absolutePositionRect = (0, translate_1.translateDataValueRectToAbsolute)(subChartPosition, xAxis, yAxis, seriesViewRect);
1684
+ var left = (0, translate_1.convertToHtmlPx)(absolutePositionRect.x);
1685
+ var top_1 = (0, translate_1.convertToHtmlPx)(absolutePositionRect.y);
1686
+ var width = (0, translate_1.convertToHtmlPx)(absolutePositionRect.width);
1687
+ var height = (0, translate_1.convertToHtmlPx)(absolutePositionRect.height);
1688
+ return { left: left, top: top_1, width: width, height: height };
1689
+ }
1690
+ else if (_this.coordinateMode === AnnotationBase_1.ECoordinateMode.Relative) {
1691
+ var left = (0, translate_1.convertToRelativeHtmlSize)(subChartPosition.x);
1692
+ var top_2 = (0, translate_1.convertToRelativeHtmlSize)(subChartPosition.y);
1693
+ var width = (0, translate_1.convertToRelativeHtmlSize)(subChartPosition.width);
1694
+ var height = (0, translate_1.convertToRelativeHtmlSize)(subChartPosition.height);
1695
+ return { left: left, top: top_2, width: width, height: height };
1696
+ }
1697
+ else {
1698
+ var left = (0, translate_1.convertToHtmlPx)(subChartPosition.x);
1699
+ var top_3 = (0, translate_1.convertToHtmlPx)(subChartPosition.y);
1700
+ var width = (0, translate_1.convertToHtmlPx)(subChartPosition.width);
1701
+ var height = (0, translate_1.convertToHtmlPx)(subChartPosition.height);
1702
+ return { left: left, top: top_3, width: width, height: height };
1703
+ }
1704
+ };
1705
+ var subChartContainerPosition = getSubChartContainerPosition(subChartPosition);
1706
+ this.subChartContainer.style.left = subChartContainerPosition.left;
1707
+ this.subChartContainer.style.top = subChartContainerPosition.top;
1708
+ this.subChartContainer.style.width = subChartContainerPosition.width;
1709
+ this.subChartContainer.style.height = subChartContainerPosition.height;
1710
+ };
1711
+ SciChartSubSurface.prototype.getOffsets = function (subChartContainer) {
1712
+ var _a, _b, _c, _d;
1713
+ if (!subChartContainer) {
1714
+ return {
1715
+ left: 0,
1716
+ top: 0,
1717
+ right: 0,
1718
+ bottom: 0
1719
+ };
1720
+ }
1721
+ // TODO probably we can use better selector
1722
+ var leftSection = subChartContainer.getElementsByClassName(this.leftSectionClass)[0];
1723
+ var topSection = subChartContainer.getElementsByClassName(this.topSectionClass)[0];
1724
+ var rightSection = subChartContainer.getElementsByClassName(this.rightSectionClass)[0];
1725
+ var bottomSection = subChartContainer.getElementsByClassName(this.bottomSectionClass)[0];
1726
+ var leftSectionWidth = (_a = leftSection === null || leftSection === void 0 ? void 0 : leftSection.clientWidth) !== null && _a !== void 0 ? _a : 0;
1727
+ var topSectionHeight = (_b = topSection === null || topSection === void 0 ? void 0 : topSection.clientHeight) !== null && _b !== void 0 ? _b : 0;
1728
+ var rightSectionWidth = (_c = rightSection === null || rightSection === void 0 ? void 0 : rightSection.clientWidth) !== null && _c !== void 0 ? _c : 0;
1729
+ var bottomSectionHeight = (_d = bottomSection === null || bottomSection === void 0 ? void 0 : bottomSection.clientHeight) !== null && _d !== void 0 ? _d : 0;
1730
+ return {
1731
+ left: leftSectionWidth * this.sectionScaleProperty,
1732
+ top: topSectionHeight * this.sectionScaleProperty,
1733
+ right: rightSectionWidth * this.sectionScaleProperty,
1734
+ bottom: bottomSectionHeight * this.sectionScaleProperty
1735
+ };
1736
+ };
1737
+ return SciChartSubSurface;
1738
+ }(SciChartSurface));
1739
+ exports.SciChartSubSurface = SciChartSubSurface;