scichart 2.1.2301 → 2.2.2351

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 (95) hide show
  1. package/Builder/buildModifiers.d.ts +2 -1
  2. package/Charting/ChartModifiers/CursorModifier.d.ts +5 -0
  3. package/Charting/ChartModifiers/CursorModifier.js +15 -10
  4. package/Charting/ChartModifiers/LegendModifier.d.ts +31 -0
  5. package/Charting/ChartModifiers/LegendModifier.js +22 -0
  6. package/Charting/ChartModifiers/RolloverModifier.d.ts +10 -0
  7. package/Charting/ChartModifiers/RolloverModifier.js +76 -19
  8. package/Charting/LayoutManager/LayoutManager.js +6 -1
  9. package/Charting/Model/BaseHeatmapDataSeries.d.ts +1 -0
  10. package/Charting/Model/BaseHeatmapDataSeries.js +4 -1
  11. package/Charting/Model/PointSeries/BasePointSeriesWrapped.d.ts +1 -1
  12. package/Charting/Model/PointSeries/BasePointSeriesWrapped.js +2 -2
  13. package/Charting/Model/PointSeries/XyyPointSeriesWrapped.d.ts +1 -1
  14. package/Charting/Model/PointSeries/XyyPointSeriesWrapped.js +3 -3
  15. package/Charting/Visuals/Annotations/AnnotationBase.d.ts +6 -1
  16. package/Charting/Visuals/Annotations/AnnotationBase.js +23 -2
  17. package/Charting/Visuals/Annotations/CursorTooltipSvgAnnotation.d.ts +6 -0
  18. package/Charting/Visuals/Annotations/CursorTooltipSvgAnnotation.js +46 -5
  19. package/Charting/Visuals/Annotations/CustomAnnotation.d.ts +3 -1
  20. package/Charting/Visuals/Annotations/CustomAnnotation.js +14 -3
  21. package/Charting/Visuals/Annotations/HorizontalLineAnnotation.d.ts +4 -0
  22. package/Charting/Visuals/Annotations/HorizontalLineAnnotation.js +3 -2
  23. package/Charting/Visuals/Annotations/RolloverLegendSvgAnnotation.d.ts +1 -1
  24. package/Charting/Visuals/Annotations/RolloverLegendSvgAnnotation.js +13 -3
  25. package/Charting/Visuals/Annotations/RolloverTooltipSvgAnnotation.d.ts +13 -0
  26. package/Charting/Visuals/Annotations/RolloverTooltipSvgAnnotation.js +63 -14
  27. package/Charting/Visuals/Annotations/VerticalLineAnnotation.d.ts +2 -0
  28. package/Charting/Visuals/Annotations/VerticalLineAnnotation.js +3 -2
  29. package/Charting/Visuals/Annotations/constants.d.ts +2 -1
  30. package/Charting/Visuals/Annotations/constants.js +1 -0
  31. package/Charting/Visuals/Axis/AxisBase2D.d.ts +10 -0
  32. package/Charting/Visuals/Axis/AxisBase2D.js +72 -1
  33. package/Charting/Visuals/Axis/LabelProvider/PieLabelProvider.d.ts +29 -0
  34. package/Charting/Visuals/Axis/LabelProvider/PieLabelProvider.js +77 -0
  35. package/Charting/Visuals/Axis/LabelProvider/SmartDateLabelProvider.d.ts +2 -2
  36. package/Charting/Visuals/Axis/LabelProvider/SmartDateLabelProvider.js +21 -4
  37. package/Charting/Visuals/Helpers/drawLabel.d.ts +3 -3
  38. package/Charting/Visuals/Helpers/drawLabel.js +38 -18
  39. package/Charting/Visuals/I2DSurfaceOptions.d.ts +6 -0
  40. package/Charting/Visuals/Legend/SciChartLegend.d.ts +4 -0
  41. package/Charting/Visuals/Legend/SciChartLegend.js +7 -1
  42. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.d.ts +16 -7
  43. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.js +56 -9
  44. package/Charting/Visuals/RenderableSeries/BaseStackedCollection.d.ts +3 -0
  45. package/Charting/Visuals/RenderableSeries/BaseStackedCollection.js +8 -0
  46. package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.d.ts +17 -166
  47. package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.js +35 -328
  48. package/Charting/Visuals/RenderableSeries/DrawingProviders/BandSeriesDrawingProvider.d.ts +5 -2
  49. package/Charting/Visuals/RenderableSeries/DrawingProviders/BandSeriesDrawingProvider.js +5 -3
  50. package/Charting/Visuals/RenderableSeries/IBaseRenderableSeriesOptions.d.ts +8 -0
  51. package/Charting/Visuals/RenderableSeries/IRenderableSeries.d.ts +6 -0
  52. package/Charting/Visuals/RenderableSeries/SeriesVisibleChangedArgs.d.ts +6 -0
  53. package/Charting/Visuals/RenderableSeries/SeriesVisibleChangedArgs.js +11 -0
  54. package/Charting/Visuals/RenderableSeries/StackedColumnRenderableSeries.d.ts +22 -0
  55. package/Charting/Visuals/RenderableSeries/StackedColumnRenderableSeries.js +38 -1
  56. package/Charting/Visuals/RenderableSeries/StackedMountainCollection.d.ts +2 -2
  57. package/Charting/Visuals/RenderableSeries/StackedMountainCollection.js +26 -45
  58. package/Charting/Visuals/RenderableSeries/StackedMountainRenderableSeries.d.ts +77 -18
  59. package/Charting/Visuals/RenderableSeries/StackedMountainRenderableSeries.js +139 -42
  60. package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.d.ts +5 -0
  61. package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.js +21 -1
  62. package/Charting/Visuals/RenderableSeries/constants.d.ts +2 -0
  63. package/Charting/Visuals/RenderableSeries/constants.js +2 -0
  64. package/Charting/Visuals/SciChartPieSurface/IPieSurfaceOptions.d.ts +24 -2
  65. package/Charting/Visuals/SciChartPieSurface/PieSegment/IPieSegment.d.ts +4 -1
  66. package/Charting/Visuals/SciChartPieSurface/PieSegment/PieSegment.d.ts +13 -2
  67. package/Charting/Visuals/SciChartPieSurface/PieSegment/PieSegment.js +66 -20
  68. package/Charting/Visuals/SciChartPieSurface/PieSegment/constants.d.ts +3 -1
  69. package/Charting/Visuals/SciChartPieSurface/PieSegment/constants.js +2 -0
  70. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.d.ts +66 -2
  71. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.js +304 -52
  72. package/Charting/Visuals/SciChartPieSurface/constants.d.ts +6 -1
  73. package/Charting/Visuals/SciChartPieSurface/constants.js +5 -0
  74. package/Charting/Visuals/SciChartSurface.d.ts +13 -2
  75. package/Charting/Visuals/SciChartSurface.js +39 -3
  76. package/Charting/Visuals/createMaster.js +2 -2
  77. package/Charting/Visuals/createSingle.js +2 -2
  78. package/Charting/Visuals/sciChartInitCommon.d.ts +2 -2
  79. package/Charting/Visuals/sciChartInitCommon.js +13 -9
  80. package/Charting3D/Visuals/Primitives/ScatterPointsSceneEntity.js +6 -2
  81. package/Core/BuildStamp.d.ts +1 -1
  82. package/Core/BuildStamp.js +2 -2
  83. package/_wasm/scichart.browser.js +1 -1
  84. package/_wasm/scichart2d.js +1 -1
  85. package/_wasm/scichart2d.wasm +0 -0
  86. package/_wasm/scichart3d.js +95 -95
  87. package/_wasm/scichart3d.wasm +0 -0
  88. package/package.json +1 -1
  89. package/types/Color.d.ts +1 -0
  90. package/types/Color.js +1 -0
  91. package/types/LabelPlacement.d.ts +8 -0
  92. package/types/LabelPlacement.js +11 -1
  93. package/types/LabelProviderType.d.ts +5 -1
  94. package/types/LabelProviderType.js +4 -0
  95. package/types/TSciChartSurfaceCanvases.d.ts +1 -0
@@ -9,22 +9,24 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
9
9
  return to.concat(ar || Array.prototype.slice.call(from));
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.addEventListenerToPieSegment = exports.SciChartPieSurface = exports.EPieType = exports.ESizingMode = void 0;
12
+ exports.addEventListenerToPieSegment = exports.SciChartPieSurface = exports.EPieValueMode = exports.EPieType = exports.ESizingMode = void 0;
13
13
  var chartBuilder_1 = require("../../../Builder/chartBuilder");
14
14
  var createMaster3d_1 = require("../../../Charting3D/Visuals/createMaster3d");
15
15
  var app_1 = require("../../../constants/app");
16
+ var EasingFunctions_1 = require("../../../Core/Animations/EasingFunctions");
16
17
  var Deleter_1 = require("../../../Core/Deleter");
17
18
  var ObservableArray_1 = require("../../../Core/ObservableArray");
18
19
  var Rect_1 = require("../../../Core/Rect");
19
20
  var SciChartSurfaceType_1 = require("../../../types/SciChartSurfaceType");
20
21
  var SciChartJSDarkTheme_1 = require("../../Themes/SciChartJSDarkTheme");
22
+ var PieLabelProvider_1 = require("../Axis/LabelProvider/PieLabelProvider");
21
23
  var createMaster_1 = require("../createMaster");
22
24
  var createSingle_1 = require("../createSingle");
23
25
  var SciChartPieLegend_1 = require("../Legend/SciChartPieLegend");
24
26
  var sciChartInitCommon_1 = require("../sciChartInitCommon");
25
27
  var SciChartSurfaceBase_1 = require("../SciChartSurfaceBase");
26
28
  var constants_1 = require("./constants");
27
- var PieSegment_1 = require("./PieSegment/PieSegment");
29
+ var constants_2 = require("./PieSegment/constants");
28
30
  /** @ignore */
29
31
  var DEG_TO_RAD = Math.PI / 180;
30
32
  /** @ignore */
@@ -45,6 +47,11 @@ var EPieType;
45
47
  EPieType["Pie"] = "Pie";
46
48
  EPieType["Donut"] = "Donut";
47
49
  })(EPieType = exports.EPieType || (exports.EPieType = {}));
50
+ var EPieValueMode;
51
+ (function (EPieValueMode) {
52
+ EPieValueMode[EPieValueMode["Percentage"] = 0] = "Percentage";
53
+ EPieValueMode[EPieValueMode["Raw"] = 1] = "Raw";
54
+ })(EPieValueMode = exports.EPieValueMode || (exports.EPieValueMode = {}));
48
55
  /**
49
56
  * @summary The {@link SciChartPieSurface} is the root Pie and Donut Chart control in SciChart's High Performance Real-time
50
57
  * {@link https://www.scichart.com/javascript-chart-features | JavaScript Chart Library}
@@ -64,24 +71,30 @@ var SciChartPieSurface = /** @class */ (function () {
64
71
  function SciChartPieSurface(canvases, options) {
65
72
  var _this = this;
66
73
  if (canvases === void 0) { canvases = {}; }
67
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
74
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
68
75
  this.animate = true;
76
+ /* The number of frames for the animation. Default 30. A frame will be trigged every 20ms. */
77
+ this.animationFrames = 30;
69
78
  this.pieTypeProperty = EPieType.Pie;
70
79
  this.holeRadiusProperty = 0.5;
71
80
  this.holeRadiusSizingModeProperty = ESizingMode.Relative;
72
81
  this.seriesSpacingProperty = 0;
82
+ this.labelRadiusProperty = 1;
73
83
  this.titleDivs = [];
74
84
  this.sweepAnimationDone = false;
75
85
  this.suspendUpdate = false;
76
86
  this.themeProviderProperty = new SciChartJSDarkTheme_1.SciChartJSDarkTheme();
77
87
  this.previousThemeProviderProperty = new SciChartJSDarkTheme_1.SciChartJSDarkTheme();
78
88
  this.deletables = [];
89
+ this.valueModeProperty = EPieValueMode.Percentage;
79
90
  this.domChartRoot = canvases.domChartRoot;
80
91
  this.domCanvas2D = canvases.domCanvas2D;
81
92
  this.domSvgContainer = canvases.domSvgContainer;
82
93
  this.domSvgAdornerLayer = canvases.domSvgAdornerLayer;
83
94
  this.domDivContainer = canvases.domDivContainer;
84
- this.viewRect = new Rect_1.Rect(0, 0, this.domCanvas2D.width, this.domCanvas2D.height);
95
+ var width = this.domCanvas2D.width;
96
+ var height = this.domCanvas2D.height;
97
+ this.viewRect = new Rect_1.Rect(0, 0, width, height);
85
98
  this.drawChart = this.drawChart.bind(this);
86
99
  this.delete = this.delete.bind(this);
87
100
  this.invalidateElement = this.invalidateElement.bind(this);
@@ -105,11 +118,14 @@ var SciChartPieSurface = /** @class */ (function () {
105
118
  this.holeRadiusProperty = (_d = options === null || options === void 0 ? void 0 : options.holeRadius) !== null && _d !== void 0 ? _d : this.holeRadius;
106
119
  this.animate = (_e = options === null || options === void 0 ? void 0 : options.animate) !== null && _e !== void 0 ? _e : this.animate;
107
120
  this.holeRadiusSizingModeProperty = (_f = options === null || options === void 0 ? void 0 : options.holeRadiusSizingMode) !== null && _f !== void 0 ? _f : this.holeRadiusSizingModeProperty;
108
- // this.seriesSpacingProperty = options?.seriesSpacing ?? this.seriesSpacingProperty;
109
- this.legend.showLegend = (_g = options === null || options === void 0 ? void 0 : options.showLegend) !== null && _g !== void 0 ? _g : this.legend.showLegend;
110
- this.legend.animate = (_h = options === null || options === void 0 ? void 0 : options.animateLegend) !== null && _h !== void 0 ? _h : this.legend.animate;
111
- this.legend.showCheckboxes = (_j = options === null || options === void 0 ? void 0 : options.showLegendCheckBoxes) !== null && _j !== void 0 ? _j : this.legend.showCheckboxes;
112
- this.legend.showSeriesMarkers = (_k = options === null || options === void 0 ? void 0 : options.showLegendSeriesMarkers) !== null && _k !== void 0 ? _k : this.legend.showSeriesMarkers;
121
+ this.seriesSpacingProperty = (_g = options === null || options === void 0 ? void 0 : options.seriesSpacing) !== null && _g !== void 0 ? _g : this.seriesSpacingProperty;
122
+ this.legend.showLegend = (_h = options === null || options === void 0 ? void 0 : options.showLegend) !== null && _h !== void 0 ? _h : this.legend.showLegend;
123
+ this.legend.animate = (_j = options === null || options === void 0 ? void 0 : options.animateLegend) !== null && _j !== void 0 ? _j : this.legend.animate;
124
+ this.legend.showCheckboxes = (_k = options === null || options === void 0 ? void 0 : options.showLegendCheckBoxes) !== null && _k !== void 0 ? _k : this.legend.showCheckboxes;
125
+ this.legend.showSeriesMarkers = (_l = options === null || options === void 0 ? void 0 : options.showLegendSeriesMarkers) !== null && _l !== void 0 ? _l : this.legend.showSeriesMarkers;
126
+ this.paddingProperty = (_m = options === null || options === void 0 ? void 0 : options.padding) !== null && _m !== void 0 ? _m : this.paddingProperty;
127
+ this.labelProvider = (_o = options === null || options === void 0 ? void 0 : options.labelProvider) !== null && _o !== void 0 ? _o : new PieLabelProvider_1.PieLabelProvider();
128
+ this.valueModeProperty = (_p = options === null || options === void 0 ? void 0 : options.valueMode) !== null && _p !== void 0 ? _p : this.valueModeProperty;
113
129
  }
114
130
  /**
115
131
  * Creates a {@link SciChartPieSurface} to occupy the div by element ID in your DOM.
@@ -134,6 +150,25 @@ var SciChartPieSurface = /** @class */ (function () {
134
150
  setTimeout(function () { return resolve(scps); }, 0);
135
151
  });
136
152
  };
153
+ Object.defineProperty(SciChartPieSurface.prototype, "labelProvider", {
154
+ /**
155
+ * Gets or sets a {@link LabelProvider} - a class which is responsible for formatting axis labels and cursor labels from numeric values
156
+ */
157
+ get: function () {
158
+ return this.labelProviderProperty;
159
+ },
160
+ /**
161
+ * Gets or sets a {@link LabelProvider} - a class which is responsible for formatting axis labels and cursor labels from numeric values
162
+ */
163
+ set: function (labelProvider) {
164
+ if (this.labelProviderProperty !== labelProvider) {
165
+ this.labelProviderProperty = labelProvider;
166
+ this.notifyPropertyChanged(constants_1.PROPERTY.LABEL_PROVIDER);
167
+ }
168
+ },
169
+ enumerable: false,
170
+ configurable: true
171
+ });
137
172
  /**
138
173
  * @inheritDoc
139
174
  */
@@ -167,8 +202,11 @@ var SciChartPieSurface = /** @class */ (function () {
167
202
  * Call invalidateElement() to trigger a redraw of the {@link SciChartPieSurface}. SciChart's rendering
168
203
  * engine will schedule a redraw a the next time the renderer is free.
169
204
  */
170
- SciChartPieSurface.prototype.invalidateElement = function () {
205
+ SciChartPieSurface.prototype.invalidateElement = function (propertyName) {
171
206
  if (this.isValidToDraw()) {
207
+ if (propertyName === constants_2.PROPERTY.VALUE) {
208
+ this.sweepAnimationDone = false;
209
+ }
172
210
  this.update();
173
211
  }
174
212
  };
@@ -178,6 +216,8 @@ var SciChartPieSurface = /** @class */ (function () {
178
216
  SciChartPieSurface.prototype.update = function () {
179
217
  if (!this.suspendUpdate) {
180
218
  this.draw();
219
+ var width = this.calculateViewRectWidth(this.viewRect.width);
220
+ var height = this.calculateViewRectHeight(this.viewRect.height);
181
221
  this.legend.setSeriesViewRect(this.viewRect);
182
222
  this.legend.update();
183
223
  }
@@ -185,16 +225,18 @@ var SciChartPieSurface = /** @class */ (function () {
185
225
  /**
186
226
  * @inheritDoc
187
227
  */
188
- SciChartPieSurface.prototype.delete = function () {
228
+ SciChartPieSurface.prototype.delete = function (isAnimationProgress) {
189
229
  var _this = this;
190
230
  if (this.svg) {
191
231
  this.domSvgContainer.removeChild(this.svg);
192
232
  this.svg = undefined;
193
233
  }
194
- this.titleDivs.forEach(function (divEl) {
195
- _this.domDivContainer.removeChild(divEl);
196
- });
197
- this.titleDivs = [];
234
+ if (!isAnimationProgress) {
235
+ this.titleDivs.forEach(function (divEl) {
236
+ _this.domDivContainer.removeChild(divEl);
237
+ });
238
+ this.titleDivs = [];
239
+ }
198
240
  for (var _i = 0, _a = this.deletables; _i < _a.length; _i++) {
199
241
  var deletable = _a[_i];
200
242
  (0, Deleter_1.deleteSafe)(deletable);
@@ -211,8 +253,10 @@ var SciChartPieSurface = /** @class */ (function () {
211
253
  * @inheritDoc
212
254
  */
213
255
  SciChartPieSurface.prototype.changeViewportSize = function (width, height) {
256
+ var domWidth = width;
257
+ var domHeight = height;
214
258
  this.viewRect = new Rect_1.Rect(0, 0, width, height);
215
- this.changeDomViewportSize(width, height);
259
+ this.changeDomViewportSize(domWidth, domHeight);
216
260
  this.invalidateElement();
217
261
  };
218
262
  Object.defineProperty(SciChartPieSurface.prototype, "pieType", {
@@ -279,6 +323,92 @@ var SciChartPieSurface = /** @class */ (function () {
279
323
  enumerable: false,
280
324
  configurable: true
281
325
  });
326
+ Object.defineProperty(SciChartPieSurface.prototype, "padding", {
327
+ /**
328
+ * Gets or sets padding
329
+ */
330
+ get: function () {
331
+ return this.paddingProperty;
332
+ },
333
+ /**
334
+ * Gets or sets padding
335
+ */
336
+ set: function (value) {
337
+ if (this.paddingProperty !== value) {
338
+ this.paddingProperty = value;
339
+ this.updateLegendMargin();
340
+ this.notifyPropertyChanged(constants_1.PROPERTY.PADDING);
341
+ }
342
+ },
343
+ enumerable: false,
344
+ configurable: true
345
+ });
346
+ Object.defineProperty(SciChartPieSurface.prototype, "canvasBorder", {
347
+ /**
348
+ * Gets or sets canvas border
349
+ */
350
+ get: function () {
351
+ return this.canvasBorderProperty;
352
+ },
353
+ /**
354
+ * Gets or sets canvas border
355
+ */
356
+ set: function (value) {
357
+ if (this.canvasBorderProperty !== value) {
358
+ this.canvasBorderProperty = value;
359
+ this.updateLegendMargin();
360
+ this.notifyPropertyChanged(constants_1.PROPERTY.PADDING);
361
+ }
362
+ },
363
+ enumerable: false,
364
+ configurable: true
365
+ });
366
+ Object.defineProperty(SciChartPieSurface.prototype, "seriesSpacing", {
367
+ get: function () {
368
+ return this.seriesSpacingProperty;
369
+ },
370
+ set: function (value) {
371
+ if (this.seriesSpacingProperty !== value) {
372
+ this.seriesSpacingProperty = value;
373
+ this.notifyPropertyChanged(constants_1.PROPERTY.SERIES_SPACING);
374
+ }
375
+ },
376
+ enumerable: false,
377
+ configurable: true
378
+ });
379
+ Object.defineProperty(SciChartPieSurface.prototype, "valueMode", {
380
+ /** Whether to show labels as percentages, or raw values. Default to percentages */
381
+ get: function () {
382
+ return this.valueModeProperty;
383
+ },
384
+ /** Whether to show labels as percentages, or raw values. Default to percentages */
385
+ set: function (value) {
386
+ this.valueModeProperty = value;
387
+ this.notifyPropertyChanged(constants_1.PROPERTY.VALUE_MODE);
388
+ },
389
+ enumerable: false,
390
+ configurable: true
391
+ });
392
+ Object.defineProperty(SciChartPieSurface.prototype, "labelRadiusAdjustment", {
393
+ /**
394
+ * Use this to adjust the position of the labels. 1 is the default. Larger values will shift the labels outwards.
395
+ * For Pie charts, 1.7 will place the labels outside the pie
396
+ * If you want more detailed control you can override calcTitlePosition.
397
+ */
398
+ get: function () {
399
+ return this.labelRadiusProperty;
400
+ },
401
+ /**
402
+ * Use this to adjust the position of the labels. 1 is the default. Larger values will shift the labels outwards.
403
+ * If you want more detailed control you can override calcTitlePosition.
404
+ */
405
+ set: function (value) {
406
+ this.labelRadiusProperty = value;
407
+ this.notifyPropertyChanged(constants_1.PROPERTY.VALUE_MODE);
408
+ },
409
+ enumerable: false,
410
+ configurable: true
411
+ });
282
412
  /**
283
413
  * Convert the surface to a {@link TSurfaceDefinition}
284
414
  * @param excludedata If false, segments will be included in the json
@@ -304,6 +434,13 @@ var SciChartPieSurface = /** @class */ (function () {
304
434
  showLegend: this.legend.showLegend,
305
435
  showLegendCheckBoxes: this.legend.showCheckboxes,
306
436
  showLegendSeriesMarkers: this.legend.showSeriesMarkers,
437
+ padding: this.padding,
438
+ canvasBorder: this.canvasBorder,
439
+ seriesSpacing: this.seriesSpacing,
440
+ labelProvider: this.labelProvider,
441
+ valueMode: this.valueMode,
442
+ labelRadiusAdjustment: this.labelRadiusAdjustment,
443
+ animationFrames: this.animationFrames,
307
444
  theme: theme
308
445
  };
309
446
  var options = { surface: surface, onCreated: this.onCreatedName };
@@ -312,14 +449,14 @@ var SciChartPieSurface = /** @class */ (function () {
312
449
  }
313
450
  return { type: SciChartSurfaceType_1.ESciChartSurfaceType.Pie2D, options: options };
314
451
  };
315
- // TODO do something with this
316
- // public get seriesSpacing() {
317
- // return this.seriesSpacingProperty;
318
- // }
319
- // public set seriesSpacing(value) {
320
- // this.seriesSpacingProperty = value;
321
- // this.notifyPropertyChanged(PROPERTY.SERIES_SPACING);
322
- // }
452
+ /** The method used to calculate the label position for each segment */
453
+ SciChartPieSurface.prototype.calcTitlePosition = function (x, y, outerRadius, innerRadius, a1, a2, delta, divWidth, divHeight) {
454
+ var centerRadius = innerRadius < outerRadius / 2 ? (outerRadius * 2) / 3 + innerRadius / 6 : (outerRadius + innerRadius) / 2;
455
+ var centerAngle = (a1 + a2) / 2;
456
+ var left = x + Math.cos(DEG_TO_RAD * centerAngle) * (centerRadius * this.labelRadiusProperty + delta) - divWidth / 2;
457
+ var top = y + Math.sin(DEG_TO_RAD * centerAngle) * (centerRadius * this.labelRadiusProperty + delta) - divHeight / 2;
458
+ return { left: left, top: top };
459
+ };
323
460
  /**
324
461
  * Changes the size of the DOM element where the {@link SciChartSurfaceBase} resides.
325
462
  * @param width
@@ -348,6 +485,9 @@ var SciChartPieSurface = /** @class */ (function () {
348
485
  // PRIVATE
349
486
  SciChartPieSurface.prototype.notifyPropertyChanged = function (propertyName) {
350
487
  this.invalidateElement();
488
+ if (propertyName === constants_1.PROPERTY.LABEL_PROVIDER) {
489
+ this.labelProvider.attachedToSurface(this);
490
+ }
351
491
  };
352
492
  SciChartPieSurface.prototype.isValidToDraw = function () {
353
493
  // TODO
@@ -361,6 +501,56 @@ var SciChartPieSurface = /** @class */ (function () {
361
501
  pieSegment.onAttach(this);
362
502
  this.invalidateElement();
363
503
  };
504
+ SciChartPieSurface.prototype.updateLegendMargin = function () {
505
+ var _a, _b, _c;
506
+ var paddingTop = ((_a = this.padding) === null || _a === void 0 ? void 0 : _a.top) || 0;
507
+ var canvasBorderTop = ((_b = this.canvasBorder) === null || _b === void 0 ? void 0 : _b.border) || ((_c = this.canvasBorder) === null || _c === void 0 ? void 0 : _c.borderTop) || 0;
508
+ // 10 - because of default spacing
509
+ // only top included because of margin implementation for the legend
510
+ this.legend.margin = paddingTop + canvasBorderTop + 10;
511
+ };
512
+ SciChartPieSurface.prototype.calculateViewRectWidth = function (width) {
513
+ var _a, _b, _c, _d, _e;
514
+ if ((_a = this.padding) === null || _a === void 0 ? void 0 : _a.left) {
515
+ width -= this.padding.left;
516
+ }
517
+ if ((_b = this.padding) === null || _b === void 0 ? void 0 : _b.right) {
518
+ width -= this.padding.right;
519
+ }
520
+ if ((_c = this.canvasBorder) === null || _c === void 0 ? void 0 : _c.border) {
521
+ width -= this.canvasBorder.border * 2;
522
+ }
523
+ else {
524
+ if ((_d = this.canvasBorder) === null || _d === void 0 ? void 0 : _d.borderLeft) {
525
+ width -= this.canvasBorder.borderLeft;
526
+ }
527
+ if ((_e = this.canvasBorder) === null || _e === void 0 ? void 0 : _e.borderRight) {
528
+ width -= this.canvasBorder.borderRight;
529
+ }
530
+ }
531
+ return width;
532
+ };
533
+ SciChartPieSurface.prototype.calculateViewRectHeight = function (height) {
534
+ var _a, _b, _c, _d, _e;
535
+ if ((_a = this.padding) === null || _a === void 0 ? void 0 : _a.top) {
536
+ height -= this.padding.top;
537
+ }
538
+ if ((_b = this.padding) === null || _b === void 0 ? void 0 : _b.bottom) {
539
+ height -= this.padding.bottom;
540
+ }
541
+ if ((_c = this.canvasBorder) === null || _c === void 0 ? void 0 : _c.border) {
542
+ height -= this.canvasBorder.border * 2;
543
+ }
544
+ else {
545
+ if ((_d = this.canvasBorder) === null || _d === void 0 ? void 0 : _d.borderTop) {
546
+ height -= this.canvasBorder.borderTop;
547
+ }
548
+ if ((_e = this.canvasBorder) === null || _e === void 0 ? void 0 : _e.borderBottom) {
549
+ height -= this.canvasBorder.borderBottom;
550
+ }
551
+ }
552
+ return height;
553
+ };
364
554
  SciChartPieSurface.prototype.draw = function () {
365
555
  var _this = this;
366
556
  if (this.sweepAnimationDone || !this.animate) {
@@ -368,7 +558,7 @@ var SciChartPieSurface = /** @class */ (function () {
368
558
  this.drawChart();
369
559
  }
370
560
  else {
371
- var frames_1 = 30;
561
+ var frames_1 = this.animationFrames;
372
562
  this.suspendUpdate = true;
373
563
  var setSuspendUpdateFalse_1 = function () { return (_this.suspendUpdate = false); };
374
564
  var setSweepAnimationDone_1 = function () { return (_this.sweepAnimationDone = true); };
@@ -378,7 +568,7 @@ var SciChartPieSurface = /** @class */ (function () {
378
568
  (function myLoop(k) {
379
569
  setTimeout(function () {
380
570
  var animationProgress = k / frames_1;
381
- callDelete_1();
571
+ callDelete_1(true);
382
572
  callDrawChart_1(animationProgress);
383
573
  if (k === frames_1) {
384
574
  setSuspendUpdateFalse_1();
@@ -400,7 +590,9 @@ var SciChartPieSurface = /** @class */ (function () {
400
590
  }
401
591
  });
402
592
  }
403
- this.drawSegmentTitles();
593
+ if (this.sweepAnimationDone) {
594
+ this.drawSegmentTitles();
595
+ }
404
596
  };
405
597
  /**
406
598
  * @description Draws pie chart itself
@@ -413,20 +605,28 @@ var SciChartPieSurface = /** @class */ (function () {
413
605
  var strokeColor = this.themeProviderProperty.sciChartBackground;
414
606
  var segments = this.pieSegments.asArray();
415
607
  var totalValue = this.pieSegmentsTotalValue();
416
- var outerRadius = (Math.min(this.viewRect.width, this.viewRect.height) * 0.8) / 2;
608
+ var outerRadius = (Math.min(this.calculateViewRectWidth(this.viewRect.width), this.calculateViewRectHeight(this.viewRect.height)) *
609
+ 0.8) /
610
+ 2;
417
611
  var innerRadius = 0;
418
612
  if (this.pieType === EPieType.Donut) {
419
613
  innerRadius =
420
614
  this.holeRadiusSizingMode === ESizingMode.Absolute ? this.holeRadius : outerRadius * this.holeRadius;
421
615
  }
422
- var xCoord = this.viewRect.width / 2;
423
- var yCoord = this.viewRect.height / 2;
616
+ var xCoord = this.calculateViewRectWidth(this.viewRect.width) / 2;
617
+ var yCoord = this.calculateViewRectHeight(this.viewRect.height) / 2;
424
618
  // CREATING SVG STRING
425
619
  var gradientsBlock = "<defs>";
426
620
  var pathsBlock = "";
427
621
  var currentValue = 0;
428
622
  segments.forEach(function (el) {
429
- var newValue = el.value * animationProgress;
623
+ var newValue;
624
+ if (el.oldValue) {
625
+ newValue = el.oldValue + (el.value - el.oldValue) * EasingFunctions_1.easing.inOutCubic(animationProgress);
626
+ }
627
+ else {
628
+ newValue = el.value * EasingFunctions_1.easing.inOutCubic(animationProgress);
629
+ }
430
630
  var hasGradient = !!el.colorLinearGradient;
431
631
  var gradientId = "grad".concat(el.id);
432
632
  if (hasGradient) {
@@ -445,8 +645,8 @@ var SciChartPieSurface = /** @class */ (function () {
445
645
  var angleFrom = (360 * currentValue) / totalValue - START_ANGLE;
446
646
  var angleTo = (360 * (currentValue + newValue)) / totalValue - START_ANGLE;
447
647
  var dAttribute = _this.pieType === EPieType.Donut
448
- ? getDonutSectorPath(xCoord, yCoord, outerRadius, innerRadius, angleFrom, angleTo, el.delta)
449
- : getSectorPath(xCoord, yCoord, outerRadius, angleFrom, angleTo, el.delta);
648
+ ? getDonutSectorPath(xCoord, yCoord, outerRadius, innerRadius, angleFrom, angleTo, el.shift + _this.seriesSpacing)
649
+ : getSectorPath(xCoord, yCoord, outerRadius, angleFrom, angleTo, el.shift + _this.seriesSpacing);
450
650
  var pathBlock = hasGradient
451
651
  ? "<g fill=\"url(#".concat(gradientId, ")\"><path id=\"").concat(el.id, "\" stroke=\"").concat(strokeColor, "\" stroke-width=\"").concat(strokeWidth, "\" d=\"").concat(dAttribute, "\" /></g>")
452
652
  : "<path id=\"".concat(el.id, "\" stroke=\"").concat(strokeColor, "\" stroke-width=\"").concat(strokeWidth, "\" d=\"").concat(dAttribute, "\" fill=\"").concat(el.color, "\" />");
@@ -454,26 +654,67 @@ var SciChartPieSurface = /** @class */ (function () {
454
654
  currentValue += newValue;
455
655
  });
456
656
  gradientsBlock += "</defs>";
457
- var svgString = "<svg width=\"".concat(this.viewRect.width, "\" height=\"").concat(this.viewRect.height, "\">").concat(gradientsBlock).concat(pathsBlock, "</svg>");
657
+ this.adjustDomContainer();
658
+ var svgString = "<svg width=\"".concat(this.calculateViewRectWidth(this.viewRect.width), "\" height=\"").concat(this.calculateViewRectHeight(this.viewRect.height), "\">").concat(gradientsBlock).concat(pathsBlock, "</svg>");
458
659
  // CREATING AND ATTACHING SVG TO DOM
459
660
  var svgNode = document.createRange().createContextualFragment(svgString);
460
661
  this.domSvgContainer.appendChild(svgNode);
461
662
  this.svg = this.domSvgContainer.lastChild;
462
663
  };
664
+ SciChartPieSurface.prototype.adjustDomContainer = function () {
665
+ var _a, _b, _c, _d, _e, _f;
666
+ if (this.padding && this.padding.left) {
667
+ this.domSvgContainer.style.paddingLeft = this.padding.left + "px";
668
+ }
669
+ if (this.padding && this.padding.right) {
670
+ this.domSvgContainer.style.paddingRight = this.padding.right + "px";
671
+ }
672
+ if (this.padding && this.padding.top) {
673
+ this.domSvgContainer.style.paddingTop = this.padding.top + "px";
674
+ }
675
+ if (this.padding && this.padding.bottom) {
676
+ this.domSvgContainer.style.paddingBottom = this.padding.bottom + "px";
677
+ }
678
+ if (this.canvasBorder) {
679
+ this.domSvgContainer.style.borderStyle = "solid";
680
+ }
681
+ if ((_a = this.canvasBorder) === null || _a === void 0 ? void 0 : _a.border) {
682
+ this.domSvgContainer.style.borderWidth = this.canvasBorder.border + "px";
683
+ }
684
+ if ((_b = this.canvasBorder) === null || _b === void 0 ? void 0 : _b.color) {
685
+ this.domSvgContainer.style.borderColor = this.canvasBorder.color;
686
+ }
687
+ if ((_c = this.canvasBorder) === null || _c === void 0 ? void 0 : _c.borderBottom) {
688
+ this.domSvgContainer.style.borderBottomWidth = this.canvasBorder.borderBottom + "px";
689
+ }
690
+ if ((_d = this.canvasBorder) === null || _d === void 0 ? void 0 : _d.borderTop) {
691
+ this.domSvgContainer.style.borderTopWidth = this.canvasBorder.borderTop + "px";
692
+ }
693
+ if ((_e = this.canvasBorder) === null || _e === void 0 ? void 0 : _e.borderLeft) {
694
+ this.domSvgContainer.style.borderLeftWidth = this.canvasBorder.borderLeft + "px";
695
+ }
696
+ if ((_f = this.canvasBorder) === null || _f === void 0 ? void 0 : _f.borderRight) {
697
+ this.domSvgContainer.style.borderRightWidth = this.canvasBorder.borderRight + "px";
698
+ }
699
+ };
463
700
  SciChartPieSurface.prototype.drawSegmentTitles = function () {
464
701
  var _this = this;
465
702
  var totalValue = this.pieSegmentsTotalValue();
466
703
  var currentValue = 0;
467
- var xCoord = this.viewRect.width / 2;
468
- var yCoord = this.viewRect.height / 2;
469
- var outerRadius = (Math.min(this.viewRect.width, this.viewRect.height) * 0.8) / 2;
704
+ var xCoord = this.calculateViewRectWidth(this.viewRect.width) / 2;
705
+ var yCoord = this.calculateViewRectHeight(this.viewRect.height) / 2;
706
+ var outerRadius = (Math.min(this.calculateViewRectWidth(this.viewRect.width), this.calculateViewRectHeight(this.viewRect.height)) *
707
+ 0.8) /
708
+ 2;
470
709
  var innerRadius = 0;
471
710
  if (this.pieType === EPieType.Donut) {
472
711
  innerRadius =
473
712
  this.holeRadiusSizingMode === ESizingMode.Absolute ? this.holeRadius : outerRadius * this.holeRadius;
474
713
  }
475
714
  this.pieSegments.asArray().forEach(function (el, index) {
715
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
476
716
  var div = document.createElement("div");
717
+ div.className = "scichart-pie-text-container";
477
718
  div.style.position = "absolute";
478
719
  div.style.pointerEvents = "none";
479
720
  div.style.padding = "5px";
@@ -482,13 +723,33 @@ var SciChartPieSurface = /** @class */ (function () {
482
723
  div.style.fontWeight = "bold";
483
724
  div.style.display = "block";
484
725
  div.style.fontFamily = "Arial";
485
- div.innerHTML = "<div>".concat(el.getPercentage(totalValue), "</div>");
726
+ div.innerHTML = el.getLabelText(totalValue);
486
727
  _this.domDivContainer.appendChild(div);
487
728
  var divWidth = div.offsetWidth;
488
729
  var divHeight = div.offsetHeight;
489
730
  var angleFrom = (360 * currentValue) / totalValue - START_ANGLE;
490
731
  var angleTo = (360 * (currentValue + el.value)) / totalValue - START_ANGLE;
491
- var position = calcTitlePosition(xCoord, yCoord, outerRadius, innerRadius, angleFrom, angleTo, el.delta, divWidth, divHeight);
732
+ var leftShift = 0;
733
+ var topShift = 0;
734
+ if ((_a = _this.padding) === null || _a === void 0 ? void 0 : _a.left) {
735
+ leftShift += (_b = _this.padding) === null || _b === void 0 ? void 0 : _b.left;
736
+ }
737
+ if ((_c = _this.padding) === null || _c === void 0 ? void 0 : _c.top) {
738
+ topShift += (_d = _this.padding) === null || _d === void 0 ? void 0 : _d.top;
739
+ }
740
+ if ((_e = _this.canvasBorder) === null || _e === void 0 ? void 0 : _e.border) {
741
+ leftShift += (_f = _this.canvasBorder) === null || _f === void 0 ? void 0 : _f.border;
742
+ topShift += (_g = _this.canvasBorder) === null || _g === void 0 ? void 0 : _g.border;
743
+ }
744
+ else {
745
+ if ((_h = _this.canvasBorder) === null || _h === void 0 ? void 0 : _h.borderLeft) {
746
+ leftShift += (_j = _this.canvasBorder) === null || _j === void 0 ? void 0 : _j.borderLeft;
747
+ }
748
+ if ((_k = _this.canvasBorder) === null || _k === void 0 ? void 0 : _k.borderTop) {
749
+ leftShift += (_l = _this.canvasBorder) === null || _l === void 0 ? void 0 : _l.borderTop;
750
+ }
751
+ }
752
+ var position = _this.calcTitlePosition(xCoord + leftShift, yCoord + topShift, outerRadius, innerRadius, angleFrom, angleTo, el.shift + _this.seriesSpacing, divWidth, divHeight);
492
753
  div.style.left = "".concat(position.left, "px");
493
754
  div.style.top = "".concat(position.top, "px");
494
755
  _this.titleDivs.push(div);
@@ -552,16 +813,6 @@ var getDonutSectorPath = function (x, y, outerR, innerR, a1, a2, delta) {
552
813
  return "M".concat(outerX1, " ").concat(outerY1, " A").concat(outerR, " ").concat(outerR, " 0 ").concat(bigArc, " 0 ").concat(outerX2, " ").concat(outerY2, " L").concat(innerX2, " ").concat(innerY2, " A").concat(innerR, " ").concat(innerR, " 0 ").concat(bigArc, " 1 ").concat(innerX1, " ").concat(innerY1, "Z");
553
814
  };
554
815
  /** @ignore */
555
- var calcTitlePosition = function (x, y, outerRadius, innerRadius, a1, a2, delta, divWidth, divHeight) {
556
- var centerRadius = innerRadius < outerRadius / 2
557
- ? (outerRadius * 2) / 3 + innerRadius / 6 + delta
558
- : (outerRadius + innerRadius) / 2 + delta;
559
- var centerAngle = (a1 + a2) / 2;
560
- var left = x + Math.cos(DEG_TO_RAD * centerAngle) * centerRadius - divWidth / 2;
561
- var top = y + Math.sin(DEG_TO_RAD * centerAngle) * centerRadius - divHeight / 2;
562
- return { left: left, top: top };
563
- };
564
- /** @ignore */
565
816
  var isListenerBlocked = false;
566
817
  /** @ignore */
567
818
  var addEventListenerToPieSegment = function (ps, el, animate) {
@@ -574,12 +825,13 @@ var addEventListenerToPieSegment = function (ps, el, animate) {
574
825
  if (!isListenerBlocked) {
575
826
  var ROUNDS_1 = 10;
576
827
  var directionDown = ps.isSelected;
577
- var start_1 = directionDown ? PieSegment_1.PieSegment.DEFAULT_DELTA : 0;
578
- var d_1 = directionDown ? -PieSegment_1.PieSegment.DEFAULT_DELTA / ROUNDS_1 : PieSegment_1.PieSegment.DEFAULT_DELTA / ROUNDS_1;
828
+ var start_1 = directionDown ? ps.delta : 0;
829
+ var d_1 = directionDown ? -ps.delta / ROUNDS_1 : ps.delta / ROUNDS_1;
579
830
  isListenerBlocked = true;
831
+ ps.isSelected = !ps.isSelected;
580
832
  (function myLoop(k) {
581
833
  setTimeout(function () {
582
- ps.delta = start_1 + d_1 * k;
834
+ ps.shift = start_1 + d_1 * k;
583
835
  if (k === ROUNDS_1) {
584
836
  isListenerBlocked = false;
585
837
  }
@@ -2,5 +2,10 @@ export declare enum PROPERTY {
2
2
  HOLE_RADIUS = "HOLE_RADIUS",
3
3
  HOLE_RADIUS_SIZING_MODE = "HOLE_RADIUS_SIZING_MODE",
4
4
  PIE_TYPE = "PIE_TYPE",
5
- SERIES_SPACING = "SERIES_SPACING"
5
+ SERIES_SPACING = "SERIES_SPACING",
6
+ PADDING = "PADDING",
7
+ CANVAS_BORDER = "CANVAS_BORDER",
8
+ LABEL_PROVIDER = "LABEL_PROVIDER",
9
+ VALUE_MODE = "VALUE_MODE",
10
+ LABEL_RADIUS = "LABEL_RADIUS"
6
11
  }
@@ -7,4 +7,9 @@ var PROPERTY;
7
7
  PROPERTY["HOLE_RADIUS_SIZING_MODE"] = "HOLE_RADIUS_SIZING_MODE";
8
8
  PROPERTY["PIE_TYPE"] = "PIE_TYPE";
9
9
  PROPERTY["SERIES_SPACING"] = "SERIES_SPACING";
10
+ PROPERTY["PADDING"] = "PADDING";
11
+ PROPERTY["CANVAS_BORDER"] = "CANVAS_BORDER";
12
+ PROPERTY["LABEL_PROVIDER"] = "LABEL_PROVIDER";
13
+ PROPERTY["VALUE_MODE"] = "VALUE_MODE";
14
+ PROPERTY["LABEL_RADIUS"] = "LABEL_RADIUS";
10
15
  })(PROPERTY = exports.PROPERTY || (exports.PROPERTY = {}));
@@ -69,9 +69,11 @@ export declare class SciChartSurface extends SciChartSurfaceBase {
69
69
  * To use the default CDN, just call SciChart.SciChartSurface.useWasmFromCDN();
70
70
  * @example
71
71
  * ```ts
72
+ * import { libraryVersion } from "scichart/Core/BuildStamp";
73
+ *
72
74
  * SciChart.SciChartSurface.configure({
73
- * dataUrl: "https://cdn.jsdelivr.net/npm/scichart@1.3.1500/_wasm/scichart2d.data",
74
- * wasmUrl: "https://cdn.jsdelivr.net/npm/scichart@1.3.1500/_wasm/scichart2d.wasm"
75
+ * dataUrl: `https://cdn.jsdelivr.net/npm/scichart@${libraryVersion}/_wasm/scichart2d.data`,
76
+ * wasmUrl: `https://cdn.jsdelivr.net/npm/scichart@${libraryVersion}/_wasm/scichart2d.wasm`
75
77
  * });
76
78
  * ```
77
79
  * @param config
@@ -192,6 +194,7 @@ export declare class SciChartSurface extends SciChartSurfaceBase {
192
194
  private solidBrushCacheCanvasBorder;
193
195
  private viewportBorderProperty;
194
196
  private canvasBorderProperty;
197
+ private drawSeriesBehindAxisProperty;
195
198
  /**
196
199
  * Creates an instance of the {@link SciChartSurface}
197
200
  * @param webAssemblyContext The {@link TSciChart | SciChart 2D WebAssembly Context} containing native methods and
@@ -419,4 +422,12 @@ export declare class SciChartSurface extends SciChartSurfaceBase {
419
422
  private attachAxis;
420
423
  private detachAnnotation;
421
424
  private attachAnnotation;
425
+ /**
426
+ * Gets or sets the boolean flag for switching behaviour of Axises rendering
427
+ */
428
+ get drawSeriesBehindAxis(): boolean;
429
+ /**
430
+ * Gets or sets the boolean flag for switching behaviour of Axises rendering
431
+ */
432
+ set drawSeriesBehindAxis(value: boolean);
422
433
  }