scichart 2.0.2126 → 2.0.2144

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 (89) hide show
  1. package/Builder/buildSeries.d.ts +1 -1
  2. package/Charting/ChartModifiers/LegendModifier.js +1 -0
  3. package/Charting/ChartModifiers/OverviewRangeSelectionModifier.d.ts +7 -2
  4. package/Charting/ChartModifiers/OverviewRangeSelectionModifier.js +18 -2
  5. package/Charting/ChartModifiers/RolloverModifier.d.ts +6 -0
  6. package/Charting/ChartModifiers/RolloverModifier.js +49 -15
  7. package/Charting/Model/BaseDataSeries.d.ts +2 -2
  8. package/Charting/Model/OhlcDataSeries.d.ts +2 -2
  9. package/Charting/Model/XyyDataSeries.d.ts +2 -2
  10. package/Charting/Model/XyzDataSeries.d.ts +2 -2
  11. package/Charting/Services/SciChartRenderer.js +14 -4
  12. package/Charting/Visuals/Axis/AxisBase2D.d.ts +75 -52
  13. package/Charting/Visuals/Axis/AxisBase2D.js +53 -34
  14. package/Charting/Visuals/Axis/AxisCore.d.ts +7 -4
  15. package/Charting/Visuals/Axis/AxisCore.js +21 -5
  16. package/Charting/Visuals/Axis/AxisRenderer.d.ts +5 -0
  17. package/Charting/Visuals/Axis/AxisRenderer.js +58 -71
  18. package/Charting/Visuals/Axis/LogarithmicAxis.d.ts +1 -3
  19. package/Charting/Visuals/Axis/LogarithmicAxis.js +4 -11
  20. package/Charting/Visuals/RenderableSeries/Animations/BandAnimation.d.ts +2 -2
  21. package/Charting/Visuals/RenderableSeries/Animations/BandAnimation.js +2 -2
  22. package/Charting/Visuals/RenderableSeries/Animations/BubbleAnimation.d.ts +2 -2
  23. package/Charting/Visuals/RenderableSeries/Animations/BubbleAnimation.js +2 -2
  24. package/Charting/Visuals/RenderableSeries/Animations/CandlestickAnimation.d.ts +1 -1
  25. package/Charting/Visuals/RenderableSeries/Animations/ColumnAnimation.d.ts +2 -2
  26. package/Charting/Visuals/RenderableSeries/Animations/ColumnAnimation.js +2 -2
  27. package/Charting/Visuals/RenderableSeries/Animations/FadeAnimation.d.ts +2 -2
  28. package/Charting/Visuals/RenderableSeries/Animations/FadeAnimation.js +2 -2
  29. package/Charting/Visuals/RenderableSeries/Animations/LineAnimation.d.ts +2 -2
  30. package/Charting/Visuals/RenderableSeries/Animations/LineAnimation.js +2 -2
  31. package/Charting/Visuals/RenderableSeries/Animations/MountainAnimation.d.ts +2 -2
  32. package/Charting/Visuals/RenderableSeries/Animations/MountainAnimation.js +2 -2
  33. package/Charting/Visuals/RenderableSeries/Animations/OhlcAnimation.d.ts +2 -2
  34. package/Charting/Visuals/RenderableSeries/Animations/OhlcAnimation.js +2 -2
  35. package/Charting/Visuals/RenderableSeries/Animations/ScaleAnimation.d.ts +2 -2
  36. package/Charting/Visuals/RenderableSeries/Animations/ScaleAnimation.js +2 -2
  37. package/Charting/Visuals/RenderableSeries/Animations/ScatterAnimation.d.ts +2 -2
  38. package/Charting/Visuals/RenderableSeries/Animations/ScatterAnimation.js +2 -2
  39. package/Charting/Visuals/RenderableSeries/Animations/{BaseAnimation.d.ts → SeriesAnimation.d.ts} +3 -2
  40. package/Charting/Visuals/RenderableSeries/Animations/{BaseAnimation.js → SeriesAnimation.js} +13 -13
  41. package/Charting/Visuals/RenderableSeries/Animations/SweepAnimation.d.ts +2 -2
  42. package/Charting/Visuals/RenderableSeries/Animations/SweepAnimation.js +2 -2
  43. package/Charting/Visuals/RenderableSeries/Animations/WaveAnimation.d.ts +2 -2
  44. package/Charting/Visuals/RenderableSeries/Animations/WaveAnimation.js +2 -2
  45. package/Charting/Visuals/RenderableSeries/Animations/animationHelpers.d.ts +8 -8
  46. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.d.ts +9 -9
  47. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.js +3 -3
  48. package/Charting/Visuals/RenderableSeries/BaseStackedCollection.d.ts +7 -7
  49. package/Charting/Visuals/RenderableSeries/BaseStackedCollection.js +1 -1
  50. package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.d.ts +7 -7
  51. package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.js +1 -1
  52. package/Charting/Visuals/RenderableSeries/IBaseRenderableSeriesOptions.d.ts +2 -2
  53. package/Charting/Visuals/RenderableSeries/IRenderableSeries.d.ts +3 -3
  54. package/Charting/Visuals/RenderableSeries/RolloverModifier/RolloverModifierRenderableSeriesProps.d.ts +5 -0
  55. package/Charting/Visuals/RenderableSeries/RolloverModifier/RolloverModifierRenderableSeriesProps.js +29 -5
  56. package/Charting/Visuals/RenderableSeries/SplineBandRenderableSeries.d.ts +4 -4
  57. package/Charting/Visuals/RenderableSeries/SplineLineRenderableSeries.d.ts +4 -4
  58. package/Charting/Visuals/RenderableSeries/SplineMountainRenderableSeries.d.ts +4 -4
  59. package/Charting/Visuals/RenderableSeries/StackedColumnCollection.d.ts +1 -0
  60. package/Charting/Visuals/RenderableSeries/StackedColumnCollection.js +1 -0
  61. package/Charting/Visuals/RenderableSeries/StackedColumnRenderableSeries.d.ts +1 -0
  62. package/Charting/Visuals/RenderableSeries/StackedColumnRenderableSeries.js +1 -0
  63. package/Charting/Visuals/RenderableSeries/StackedMountainCollection.d.ts +1 -0
  64. package/Charting/Visuals/RenderableSeries/StackedMountainCollection.js +1 -0
  65. package/Charting/Visuals/RenderableSeries/StackedMountainRenderableSeries.d.ts +1 -0
  66. package/Charting/Visuals/RenderableSeries/StackedMountainRenderableSeries.js +1 -0
  67. package/Charting/Visuals/SciChartOverview.d.ts +5 -2
  68. package/Charting/Visuals/SciChartOverview.js +24 -15
  69. package/Charting/Visuals/SciChartSurface.d.ts +13 -0
  70. package/Charting/Visuals/SciChartSurface.js +38 -3
  71. package/Charting3D/Visuals/SciChart3DRenderer.js +1 -0
  72. package/Core/Animations/AnimationFiniteStateMachine.d.ts +27 -14
  73. package/Core/Animations/AnimationFiniteStateMachine.js +48 -15
  74. package/Core/Animations/Animator.d.ts +1 -9
  75. package/Core/Animations/Animator.js +1 -9
  76. package/Core/Animations/DoubleAnimator.d.ts +2 -8
  77. package/Core/Animations/DoubleAnimator.js +1 -7
  78. package/Core/Animations/GenericAnimation.d.ts +74 -0
  79. package/Core/Animations/GenericAnimation.js +74 -0
  80. package/Core/Animations/NumberRangeAnimator.d.ts +4 -3
  81. package/Core/Animations/NumberRangeAnimator.js +23 -3
  82. package/Core/NumberRange.js +6 -7
  83. package/README.md +197 -10
  84. package/_wasm/scichart.browser.js +1 -1
  85. package/_wasm/scichart2d.js +95 -95
  86. package/_wasm/scichart2d.wasm +0 -0
  87. package/_wasm/scichart3d.js +1 -1
  88. package/_wasm/scichart3d.wasm +0 -0
  89. package/package.json +4 -3
@@ -2,7 +2,7 @@ import { ISelectedPointOptions } from "../Charting/Model/DataPointSelectionPalet
2
2
  import { IUniformHeatmapSeriesOptions } from "../Charting/Model/UniformHeatmapDataSeries";
3
3
  import { IPointMarkerOptions } from "../Charting/Visuals/PointMarkers/BasePointMarker";
4
4
  import { ISpritePointMarkerOptions } from "../Charting/Visuals/PointMarkers/SpritePointMarker";
5
- import { IBaseAnimationOptions } from "../Charting/Visuals/RenderableSeries/Animations/BaseAnimation";
5
+ import { IBaseAnimationOptions } from "../Charting/Visuals/RenderableSeries/Animations/SeriesAnimation";
6
6
  import { IFadeAnimationOptions } from "../Charting/Visuals/RenderableSeries/Animations/FadeAnimation";
7
7
  import { IScaleAnimationOptions } from "../Charting/Visuals/RenderableSeries/Animations/ScaleAnimation";
8
8
  import { ISweepAnimationOptions } from "../Charting/Visuals/RenderableSeries/Animations/SweepAnimation";
@@ -84,6 +84,7 @@ var LegendModifier = /** @class */ (function (_super) {
84
84
  /** @inheritDoc */
85
85
  LegendModifier.prototype.onDetach = function () {
86
86
  _super.prototype.onDetach.call(this);
87
+ this.sciChartLegend.delete();
87
88
  this.sciChartLegend.setRootDiv(undefined);
88
89
  this.sciChartLegend.setRenderableSeriesArray([]);
89
90
  this.sciChartLegend.setInvalidateParentSurface(undefined);
@@ -1,4 +1,4 @@
1
- import { AnimationToken } from "../../Core/AnimationToken";
1
+ import { IGenericAnimation } from "../../Core/Animations/GenericAnimation";
2
2
  import { NumberRange } from "../../Core/NumberRange";
3
3
  import { Point } from "../../Core/Point";
4
4
  import { EChart2DModifierType } from "../../types/ChartModifierType";
@@ -29,7 +29,7 @@ export interface IRangeSelectionModifierOptions extends IChartModifierBaseOption
29
29
  export declare class OverviewRangeSelectionModifier extends ChartModifierBase2D {
30
30
  readonly type = EChart2DModifierType.OverviewRangeSelection;
31
31
  onSelectedAreaChanged: (area?: NumberRange) => void;
32
- overviewPositionAnimation: AnimationToken;
32
+ overviewPositionAnimation: IGenericAnimation;
33
33
  animationDuration: number;
34
34
  animate: boolean;
35
35
  protected pointTo: Point;
@@ -47,6 +47,10 @@ export declare class OverviewRangeSelectionModifier extends ChartModifierBase2D
47
47
  * @inheritDoc
48
48
  */
49
49
  onAttach(): void;
50
+ /**
51
+ * @inheritDoc
52
+ */
53
+ onDetach(): void;
50
54
  /**
51
55
  * @inheritDoc
52
56
  */
@@ -76,4 +80,5 @@ export declare class OverviewRangeSelectionModifier extends ChartModifierBase2D
76
80
  */
77
81
  set selectedArea(value: NumberRange);
78
82
  protected updateSelectionAnnotation(): void;
83
+ private xVisibleRangeChangeHandler;
79
84
  }
@@ -64,6 +64,7 @@ var OverviewRangeSelectionModifier = /** @class */ (function (_super) {
64
64
  _this.onSelectedAreaChanged = options === null || options === void 0 ? void 0 : options.onSelectedAreaChanged;
65
65
  _this.xAxisId = (_a = options === null || options === void 0 ? void 0 : options.xAxisId) !== null && _a !== void 0 ? _a : _this.xAxisId;
66
66
  _this.yAxisId = (_b = options === null || options === void 0 ? void 0 : options.yAxisId) !== null && _b !== void 0 ? _b : _this.yAxisId;
67
+ _this.xVisibleRangeChangeHandler = _this.xVisibleRangeChangeHandler.bind(_this);
67
68
  return _this;
68
69
  }
69
70
  /**
@@ -73,6 +74,13 @@ var OverviewRangeSelectionModifier = /** @class */ (function (_super) {
73
74
  _super.prototype.onAttach.call(this);
74
75
  this.updateSelectionAnnotation();
75
76
  };
77
+ /**
78
+ * @inheritDoc
79
+ */
80
+ OverviewRangeSelectionModifier.prototype.onDetach = function () {
81
+ var xAxis = this.parentSurface.getXAxisById(this.xAxisId);
82
+ xAxis.visibleRangeChanged.unsubscribe(this.xVisibleRangeChangeHandler);
83
+ };
76
84
  /**
77
85
  * @inheritDoc
78
86
  */
@@ -104,7 +112,7 @@ var OverviewRangeSelectionModifier = /** @class */ (function (_super) {
104
112
  }
105
113
  if (this.isClicked) {
106
114
  args.handled = true;
107
- (_a = this.overviewPositionAnimation) === null || _a === void 0 ? void 0 : _a.cancelAnimation();
115
+ (_a = this.overviewPositionAnimation) === null || _a === void 0 ? void 0 : _a.cancel();
108
116
  var seriesViewRect = this.parentSurface.seriesViewRect;
109
117
  this.pointTo = translate_1.translateFromCanvasToSeriesViewRect(Rect_1.Rect.clipPointToRect(args.mousePoint, seriesViewRect), seriesViewRect);
110
118
  this.isClicked = false;
@@ -123,6 +131,7 @@ var OverviewRangeSelectionModifier = /** @class */ (function (_super) {
123
131
  };
124
132
  if (this.animate) {
125
133
  this.overviewPositionAnimation = NumberRangeAnimator_1.NumberRangeAnimator.animate(initialCoordinatesRange, finalCoordinatesRange, this.animationDuration, updateAnnotationCoordinates, null);
134
+ this.parentSurface.addAnimation(this.overviewPositionAnimation);
126
135
  }
127
136
  else {
128
137
  updateAnnotationCoordinates(finalCoordinatesRange);
@@ -193,7 +202,7 @@ var OverviewRangeSelectionModifier = /** @class */ (function (_super) {
193
202
  if (this.parentSurface) {
194
203
  var onDrag = function () {
195
204
  var _a;
196
- (_a = _this.overviewPositionAnimation) === null || _a === void 0 ? void 0 : _a.cancelAnimation();
205
+ (_a = _this.overviewPositionAnimation) === null || _a === void 0 ? void 0 : _a.cancel();
197
206
  var selectedArea = new NumberRange_1.NumberRange(_this.rangeSelectionAnnotation.x1, _this.rangeSelectionAnnotation.x2);
198
207
  _this.selectedAreaProperty = selectedArea;
199
208
  _this.annotationBeforeSelectedAreaProperty.x2 = _this.rangeSelectionAnnotation.x1;
@@ -202,6 +211,8 @@ var OverviewRangeSelectionModifier = /** @class */ (function (_super) {
202
211
  };
203
212
  var xAxis = (_a = this.parentSurface) === null || _a === void 0 ? void 0 : _a.getXAxisById(this.xAxisId);
204
213
  var commonAnnotationProperties = {
214
+ xAxisId: this.xAxisId,
215
+ yAxisId: this.yAxisId,
205
216
  opacity: 0.5,
206
217
  y1: 0,
207
218
  y2: 1,
@@ -234,8 +245,13 @@ var OverviewRangeSelectionModifier = /** @class */ (function (_super) {
234
245
  this.rangeSelectionAnnotationProperty = dragBox;
235
246
  this.annotationBeforeSelectedAreaProperty = annotationBeforeSelectedArea;
236
247
  this.annotationAfterSelectedAreaProperty = annotationAfterSelectedArea;
248
+ xAxis.visibleRangeChanged.subscribe(this.xVisibleRangeChangeHandler);
237
249
  }
238
250
  };
251
+ OverviewRangeSelectionModifier.prototype.xVisibleRangeChangeHandler = function (args) {
252
+ this.annotationBeforeSelectedAreaProperty.x1 = args.visibleRange.min;
253
+ this.annotationAfterSelectedAreaProperty.x2 = args.visibleRange.max;
254
+ };
239
255
  return OverviewRangeSelectionModifier;
240
256
  }(ChartModifierBase2D_1.ChartModifierBase2D));
241
257
  exports.OverviewRangeSelectionModifier = OverviewRangeSelectionModifier;
@@ -64,6 +64,7 @@ export interface IRolloverModifierOptions extends IChartModifierBaseOptions {
64
64
  tooltipDataTemplate?: TRolloverTooltipDataTemplate | string;
65
65
  showTooltip?: boolean;
66
66
  allowTooltipOverlapping?: boolean;
67
+ snapToDataPoint?: boolean;
67
68
  }
68
69
  /**
69
70
  * The RolloverModifier provides tooltip and cursor behavior on a 2D {@link SciChartSurface}
@@ -92,6 +93,11 @@ export declare class RolloverModifier extends ChartModifierBase2D implements IIn
92
93
  * Gets or sets the legend Y offset
93
94
  */
94
95
  tooltipLegendOffsetY: number;
96
+ /**
97
+ * Gets or sets the snapToDataPoint flag. If True the {@link RolloverModifier} line snaps to
98
+ * the nearest data-point of the first visible renderable series
99
+ */
100
+ snapToDataPoint: boolean;
95
101
  private readonly rolloverLineAnnotation;
96
102
  private readonly legendAnnotation;
97
103
  private mousePosition;
@@ -69,7 +69,7 @@ var RolloverModifier = /** @class */ (function (_super) {
69
69
  * @param options Optional parameters {@link IRolloverModifierOptions} used to configure the modifier
70
70
  */
71
71
  function RolloverModifier(options) {
72
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
72
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
73
73
  var _this = _super.call(this, options) || this;
74
74
  _this.type = ChartModifierType_1.EChart2DModifierType.Rollover;
75
75
  /**
@@ -80,6 +80,11 @@ var RolloverModifier = /** @class */ (function (_super) {
80
80
  * Gets or sets the legend Y offset
81
81
  */
82
82
  _this.tooltipLegendOffsetY = 0;
83
+ /**
84
+ * Gets or sets the snapToDataPoint flag. If True the {@link RolloverModifier} line snaps to
85
+ * the nearest data-point of the first visible renderable series
86
+ */
87
+ _this.snapToDataPoint = false;
83
88
  _this.mousePosition = EMousePosition.OutOfCanvas;
84
89
  _this.showRolloverLineProperty = true;
85
90
  _this.showTooltipProperty = true;
@@ -123,6 +128,7 @@ var RolloverModifier = /** @class */ (function (_super) {
123
128
  yAxisId: _this.yAxisId
124
129
  });
125
130
  _this.allowTooltipOverlappingProperty = (_j = options === null || options === void 0 ? void 0 : options.allowTooltipOverlapping) !== null && _j !== void 0 ? _j : _this.allowTooltipOverlappingProperty;
131
+ _this.snapToDataPoint = (_k = options === null || options === void 0 ? void 0 : options.snapToDataPoint) !== null && _k !== void 0 ? _k : _this.snapToDataPoint;
126
132
  return _this;
127
133
  }
128
134
  /**
@@ -421,22 +427,50 @@ var RolloverModifier = /** @class */ (function (_super) {
421
427
  this.rolloverLineAnnotation.isHidden = true;
422
428
  return;
423
429
  }
424
- this.rolloverLineAnnotation.isHidden = !this.showRolloverLineProperty;
425
- var translatedMousePoint = translate_1.translateFromCanvasToSeriesViewRect(this.mousePoint, this.parentSurface.seriesViewRect);
426
- if (translatedMousePoint) {
427
- var x = translate_1.translateToNotScaled(translatedMousePoint.x);
428
- var y = translate_1.translateToNotScaled(translatedMousePoint.y);
429
- if (this.isVerticalChart()) {
430
- this.rolloverLineAnnotation.x1 = y;
431
- this.rolloverLineAnnotation.x2 = y;
432
- this.rolloverLineAnnotation.y1 = 0;
433
- this.rolloverLineAnnotation.y2 = translate_1.translateToNotScaled(this.parentSurface.seriesViewRect.right);
430
+ if (!this.showRolloverLineProperty) {
431
+ this.rolloverLineAnnotation.isHidden = true;
432
+ return;
433
+ }
434
+ if (this.snapToDataPoint) {
435
+ var firstSeries = this.getIncludedRenderableSeries()[0];
436
+ if (firstSeries) {
437
+ var hitTestInfo = this.hitTestRenderableSeries(firstSeries, this.mousePoint);
438
+ if (hitTestInfo && hitTestInfo.isWithinDataBounds) {
439
+ this.rolloverLineAnnotation.isHidden = false;
440
+ var x = translate_1.translateToNotScaled(hitTestInfo.xCoord);
441
+ this.rolloverLineAnnotation.x1 = x;
442
+ this.rolloverLineAnnotation.x2 = x;
443
+ this.rolloverLineAnnotation.y1 = 0;
444
+ this.rolloverLineAnnotation.y2 = this.isVerticalChart()
445
+ ? translate_1.translateToNotScaled(this.parentSurface.seriesViewRect.right)
446
+ : translate_1.translateToNotScaled(this.parentSurface.seriesViewRect.bottom);
447
+ }
448
+ else {
449
+ this.rolloverLineAnnotation.isHidden = true;
450
+ }
434
451
  }
435
452
  else {
436
- this.rolloverLineAnnotation.x1 = x;
437
- this.rolloverLineAnnotation.x2 = x;
438
- this.rolloverLineAnnotation.y1 = 0;
439
- this.rolloverLineAnnotation.y2 = translate_1.translateToNotScaled(this.parentSurface.seriesViewRect.bottom);
453
+ this.rolloverLineAnnotation.isHidden = true;
454
+ }
455
+ }
456
+ else {
457
+ this.rolloverLineAnnotation.isHidden = false;
458
+ var translatedMousePoint = translate_1.translateFromCanvasToSeriesViewRect(this.mousePoint, this.parentSurface.seriesViewRect);
459
+ if (translatedMousePoint) {
460
+ var x = translate_1.translateToNotScaled(translatedMousePoint.x);
461
+ var y = translate_1.translateToNotScaled(translatedMousePoint.y);
462
+ if (this.isVerticalChart()) {
463
+ this.rolloverLineAnnotation.x1 = y;
464
+ this.rolloverLineAnnotation.x2 = y;
465
+ this.rolloverLineAnnotation.y1 = 0;
466
+ this.rolloverLineAnnotation.y2 = translate_1.translateToNotScaled(this.parentSurface.seriesViewRect.right);
467
+ }
468
+ else {
469
+ this.rolloverLineAnnotation.x1 = x;
470
+ this.rolloverLineAnnotation.x2 = x;
471
+ this.rolloverLineAnnotation.y1 = 0;
472
+ this.rolloverLineAnnotation.y2 = translate_1.translateToNotScaled(this.parentSurface.seriesViewRect.bottom);
473
+ }
440
474
  }
441
475
  }
442
476
  };
@@ -1,7 +1,7 @@
1
1
  import { EventHandler } from "../../Core/EventHandler";
2
2
  import { NumberRange } from "../../Core/NumberRange";
3
3
  import { DoubleVector, TSciChart } from "../../types/TSciChart";
4
- import { BaseAnimation } from "../Visuals/RenderableSeries/Animations/BaseAnimation";
4
+ import { SeriesAnimation } from "../Visuals/RenderableSeries/Animations/SeriesAnimation";
5
5
  import { EDataChangeType, EDataSeriesType, EDataSeriesValueType, IDataChangeArgs, IDataSeries } from "./IDataSeries";
6
6
  import { IMetadataGenerator, IPointMetadata } from "./IPointMetadata";
7
7
  /**
@@ -166,7 +166,7 @@ export declare abstract class BaseDataSeries implements IDataSeries {
166
166
  * @param progress The animation progress from 0 to 1
167
167
  * @param animation The animation
168
168
  */
169
- updateAnimationProperties(progress: number, animation: BaseAnimation): void;
169
+ updateAnimationProperties(progress: number, animation: SeriesAnimation): void;
170
170
  /** @inheritDoc */
171
171
  toJSON(excludeData?: boolean): any;
172
172
  protected validateIndex(index: number, message?: string): void;
@@ -1,7 +1,7 @@
1
1
  import { NumberRange } from "../../Core/NumberRange";
2
2
  import { NumberArray } from "../../types/NumberArray";
3
3
  import { DoubleVector, TSciChart } from "../../types/TSciChart";
4
- import { BaseAnimation } from "../Visuals/RenderableSeries/Animations/BaseAnimation";
4
+ import { SeriesAnimation } from "../Visuals/RenderableSeries/Animations/SeriesAnimation";
5
5
  import { BaseDataSeries, IBaseDataSeriesOptions } from "./BaseDataSeries";
6
6
  import { EDataSeriesType, EDataSeriesValueType } from "./IDataSeries";
7
7
  import { IPointMetadata } from "./IPointMetadata";
@@ -206,7 +206,7 @@ export declare class OhlcDataSeries extends BaseDataSeries {
206
206
  /** @inheritDoc */
207
207
  validateAnimationVectors(): void;
208
208
  /** @inheritDoc */
209
- updateAnimationProperties(progress: number, animation: BaseAnimation): void;
209
+ updateAnimationProperties(progress: number, animation: SeriesAnimation): void;
210
210
  /** @inheritDoc */
211
211
  toJSON(excludeData?: boolean): any;
212
212
  private getOHLCValues;
@@ -1,7 +1,7 @@
1
1
  import { NumberRange } from "../../Core/NumberRange";
2
2
  import { NumberArray } from "../../types/NumberArray";
3
3
  import { DoubleVector, TSciChart } from "../../types/TSciChart";
4
- import { BaseAnimation } from "../Visuals/RenderableSeries/Animations/BaseAnimation";
4
+ import { SeriesAnimation } from "../Visuals/RenderableSeries/Animations/SeriesAnimation";
5
5
  import { BaseDataSeries, IBaseDataSeriesOptions } from "./BaseDataSeries";
6
6
  import { EDataSeriesType, EDataSeriesValueType } from "./IDataSeries";
7
7
  import { IPointMetadata } from "./IPointMetadata";
@@ -158,7 +158,7 @@ export declare class XyyDataSeries extends BaseDataSeries {
158
158
  /** @inheritDoc */
159
159
  validateAnimationVectors(): void;
160
160
  /** @inheritDoc */
161
- updateAnimationProperties(progress: number, animation: BaseAnimation): void;
161
+ updateAnimationProperties(progress: number, animation: SeriesAnimation): void;
162
162
  /** @inheritDoc */
163
163
  toJSON(excludeData?: boolean): any;
164
164
  private getYY1Values;
@@ -1,6 +1,6 @@
1
1
  import { NumberArray } from "../../types/NumberArray";
2
2
  import { DoubleVector, TSciChart } from "../../types/TSciChart";
3
- import { BaseAnimation } from "../Visuals/RenderableSeries/Animations/BaseAnimation";
3
+ import { SeriesAnimation } from "../Visuals/RenderableSeries/Animations/SeriesAnimation";
4
4
  import { BaseDataSeries, IBaseDataSeriesOptions } from "./BaseDataSeries";
5
5
  import { EDataSeriesType } from "./IDataSeries";
6
6
  import { IPointMetadata } from "./IPointMetadata";
@@ -155,7 +155,7 @@ export declare class XyzDataSeries extends BaseDataSeries {
155
155
  /** @inheritDoc */
156
156
  validateAnimationVectors(): void;
157
157
  /** @inheritDoc */
158
- updateAnimationProperties(progress: number, animation: BaseAnimation): void;
158
+ updateAnimationProperties(progress: number, animation: SeriesAnimation): void;
159
159
  /** @inheritDoc */
160
160
  toJSON(excludeData?: boolean): any;
161
161
  private getYZValues;
@@ -15,6 +15,7 @@ var AutoRange_1 = require("../../types/AutoRange");
15
15
  var AxisAlignment_1 = require("../../types/AxisAlignment");
16
16
  var RenderLayer_1 = require("../../types/RenderLayer");
17
17
  var IAnnotation_1 = require("../Visuals/Annotations/IAnnotation");
18
+ var SciChartSurfaceBase_1 = require("../Visuals/SciChartSurfaceBase");
18
19
  var DpiHelper_1 = require("../Visuals/TextureManager/DpiHelper");
19
20
  var RenderPassData_1 = require("./RenderPassData");
20
21
  /**
@@ -93,7 +94,7 @@ var SciChartRenderer = /** @class */ (function () {
93
94
  this.drawSvgAnnotations(svgAnnotations, xyAxesById[0], xyAxesById[1]);
94
95
  // Update watermark
95
96
  var left = seriesViewRect.x;
96
- var bottom = renderContext.viewportSize.height - (seriesViewRect.top + seriesViewRect.height);
97
+ var bottom = SciChartSurfaceBase_1.SciChartSurfaceBase.domMasterCanvas.height - (seriesViewRect.top + seriesViewRect.height);
97
98
  this.sciChartSurface.updateWatermark(left, bottom);
98
99
  // Step 10 Call OnParentSurfaceRendered
99
100
  this.onParentSurfaceRendered();
@@ -145,6 +146,8 @@ var SciChartRenderer = /** @class */ (function () {
145
146
  });
146
147
  };
147
148
  SciChartRenderer.prototype.validate = function () {
149
+ this.sciChartSurface.xAxes.asArray().forEach(function (axis) { return (axis.isMeasured = false); });
150
+ this.sciChartSurface.yAxes.asArray().forEach(function (axis) { return (axis.isMeasured = false); });
148
151
  // TODO: Check the surface is valid and output error codes to console
149
152
  // Checks would include
150
153
  // Is XAxes and YAxes collection null or empty
@@ -238,13 +241,20 @@ var SciChartRenderer = /** @class */ (function () {
238
241
  });
239
242
  };
240
243
  SciChartRenderer.prototype.tryPerformAutoRangeOn = function (axis, sciChartSurface) {
241
- var shouldAutoRange = axis.autoRange === AutoRange_1.EAutoRange.Always ||
242
- (axis.autoRange === AutoRange_1.EAutoRange.Once && (!axis.hasValidVisibleRange() || axis.hasDefaultVisibleRange()));
244
+ var firstRange = !axis.hasValidVisibleRange() || axis.hasDefaultVisibleRange();
245
+ var shouldAutoRange = axis.autoRange === AutoRange_1.EAutoRange.Always || (axis.autoRange === AutoRange_1.EAutoRange.Once && firstRange);
243
246
  if (shouldAutoRange) {
244
247
  // Different implementation for YAxis and XAxis because of windowing
245
248
  var newRange = axis.getMaximumRange();
246
249
  if (!newRange.equals(axis.visibleRange)) {
247
- axis.visibleRange = newRange;
250
+ if (!axis.autoRangeAnimation ||
251
+ (firstRange && !axis.autoRangeAnimation.animateInitialRanging) ||
252
+ (!firstRange && !axis.autoRangeAnimation.animateSubsequentRanging)) {
253
+ axis.visibleRange = newRange;
254
+ }
255
+ else if (!newRange.equals(axis.animatedVisibleRange)) {
256
+ sciChartSurface.addAnimation(axis.animateVisibleRange(newRange, axis.autoRangeAnimation.duration, axis.autoRangeAnimation.easing));
257
+ }
248
258
  }
249
259
  }
250
260
  };
@@ -70,6 +70,16 @@ export declare type TTickObject = {
70
70
  */
71
71
  minorTickCoords: number[];
72
72
  };
73
+ export interface IAutoRangeAnimationOptions {
74
+ /** Whether to animate the first autorange Default false */
75
+ animateInitialRanging: boolean;
76
+ /** Whether to animate all other autoRanges */
77
+ animateSubsequentRanging: boolean;
78
+ /** The length of the animation */
79
+ duration: number;
80
+ /** The easing function to use */
81
+ easing?: TEasingFn;
82
+ }
73
83
  export interface IAxisBase2dOptions extends IAxisCoreOptions {
74
84
  /**
75
85
  * Limits {@link AxisCore.visibleRange}, meaning the chart cannot autorange outside that range
@@ -116,6 +126,10 @@ export interface IAxisBase2dOptions extends IAxisCoreOptions {
116
126
  * as the bounding box of ratoated text may overlap even if the text itself does not.
117
127
  */
118
128
  hideOverlappingLabels?: boolean;
129
+ /**
130
+ * Options to configure if and how the axis should animate when autoRanging
131
+ */
132
+ autoRangeAnimation?: IAutoRangeAnimationOptions;
119
133
  }
120
134
  /**
121
135
  * The base class for 2D Chart Axis within SciChart - High Performance {@link https://www.scichart.com/javascript-chart-features | JavaScript Charts}.
@@ -128,28 +142,6 @@ export interface IAxisBase2dOptions extends IAxisCoreOptions {
128
142
  * Set axis on the {@link SciChartSurface.xAxes} or {@link SciChartSurface.yAxes} collections in 2D Charts.
129
143
  */
130
144
  export declare abstract class AxisBase2D extends AxisCore implements IThemeable {
131
- abstract type: EAxisType.CategoryAxis | EAxisType.LogarithmicAxis | EAxisType.NumericAxis;
132
- /**
133
- * Gets the parent {@link SciChartSurface} that this axis is attached to
134
- */
135
- parentSurface: SciChartSurface;
136
- /**
137
- * Gets the {@link AxisTitleRenderer} instance responsible for drawing the axis title
138
- */
139
- readonly axisTitleRenderer: AxisTitleRenderer;
140
- /**
141
- * Gets the {@link AxisLayoutState} class which manages layout
142
- */
143
- readonly axisLayoutState: AxisLayoutState;
144
- /**
145
- * Gets the {@link Rect | ViewRect} - a rectangle defining the location of the axis within the parent {@link SciChartSurface}
146
- */
147
- viewRect: Rect;
148
- /**
149
- * The {@link TSciChart | SciChart 2D WebAssembly Context} containing native methods and
150
- * access to our WebGL2 Engine and WebAssembly numerical methods
151
- */
152
- protected axisRendererProperty: AxisRenderer;
153
145
  /**
154
146
  * Gets or sets a {@link LabelProvider} - a class which is responsible for formatting axis labels and cursor labels from numeric values
155
147
  */
@@ -158,36 +150,6 @@ export declare abstract class AxisBase2D extends AxisCore implements IThemeable
158
150
  * Gets or sets a {@link LabelProvider} - a class which is responsible for formatting axis labels and cursor labels from numeric values
159
151
  */
160
152
  set labelProvider(labelProvider: LabelProviderBase2D);
161
- protected readonly webAssemblyContext2D: TSciChart;
162
- private labelStyleProperty;
163
- private axisAlignmentProperty;
164
- private isInnerAxisProperty;
165
- private visibleRangeLimitProperty;
166
- private zoomExtentsRangeProperty;
167
- private isPrimaryAxisProperty;
168
- private isStackedAxisProperty;
169
- private penCacheForMajorGridLines;
170
- private penCacheForMinorGridLines;
171
- private penCacheForMajorTickLines;
172
- private penCacheForMinorTickLines;
173
- private solidBrushCacheAxisBands;
174
- private axisBorderProperty;
175
- private solidBrushCacheBorder;
176
- private axisLengthProperty;
177
- private offsetProperty;
178
- private tickCache;
179
- /**
180
- * Creates an instance of the {@link AxisBase2D}
181
- * @param webAssemblyContext The {@link TSciChart | SciChart 2D WebAssembly Context} containing native methods and
182
- * access to our WebGL2 Engine and WebAssembly numerical methods
183
- * @param options Optional parameters of type {@link IAxisBase2dOptions} used to configure the axis at instantiation time
184
- */
185
- protected constructor(webAssemblyContext: TSciChart, options?: IAxisBase2dOptions);
186
- /**
187
- * @inheritDoc
188
- */
189
- applyTheme(themeProvider: IThemeProvider): void;
190
- onAttach(parentSurface: SciChartSurface, isXAxis: boolean, isPrimaryAxis: boolean): void;
191
153
  /**
192
154
  * Gets the {@link AxisRenderer} instance responsible for drawing the axis
193
155
  */
@@ -304,6 +266,67 @@ export declare abstract class AxisBase2D extends AxisCore implements IThemeable
304
266
  * Gets or sets the Axis Border properties
305
267
  */
306
268
  set axisBorder(border: TBorder);
269
+ /**
270
+ * Gets or sets a {@link IAutoRangeAnimationOptions} object that controls if and how the visible range is animated during autoRanging
271
+ */
272
+ get autoRangeAnimation(): IAutoRangeAnimationOptions;
273
+ /**
274
+ * Gets or sets a {@link IAutoRangeAnimationOptions} object that controls if and how the visible range is animated during autoRanging
275
+ */
276
+ set autoRangeAnimation(autoRangeAnimation: IAutoRangeAnimationOptions);
277
+ abstract type: EAxisType.CategoryAxis | EAxisType.LogarithmicAxis | EAxisType.NumericAxis;
278
+ /**
279
+ * Gets the parent {@link SciChartSurface} that this axis is attached to
280
+ */
281
+ parentSurface: SciChartSurface;
282
+ /**
283
+ * Gets the {@link AxisTitleRenderer} instance responsible for drawing the axis title
284
+ */
285
+ readonly axisTitleRenderer: AxisTitleRenderer;
286
+ /**
287
+ * Gets the {@link AxisLayoutState} class which manages layout
288
+ */
289
+ readonly axisLayoutState: AxisLayoutState;
290
+ /**
291
+ * Gets the {@link Rect | ViewRect} - a rectangle defining the location of the axis within the parent {@link SciChartSurface}
292
+ */
293
+ viewRect: Rect;
294
+ protected axisRendererProperty: AxisRenderer;
295
+ protected autoRangeAnimationProperty: IAutoRangeAnimationOptions;
296
+ /**
297
+ * The {@link TSciChart | SciChart 2D WebAssembly Context} containing native methods and
298
+ * access to our WebGL2 Engine and WebAssembly numerical methods
299
+ */
300
+ protected readonly webAssemblyContext2D: TSciChart;
301
+ private labelStyleProperty;
302
+ private axisAlignmentProperty;
303
+ private isInnerAxisProperty;
304
+ private visibleRangeLimitProperty;
305
+ private zoomExtentsRangeProperty;
306
+ private isPrimaryAxisProperty;
307
+ private isStackedAxisProperty;
308
+ private penCacheForMajorGridLines;
309
+ private penCacheForMinorGridLines;
310
+ private penCacheForMajorTickLines;
311
+ private penCacheForMinorTickLines;
312
+ private solidBrushCacheAxisBands;
313
+ private axisBorderProperty;
314
+ private solidBrushCacheBorder;
315
+ private axisLengthProperty;
316
+ private offsetProperty;
317
+ private tickCache;
318
+ /**
319
+ * Creates an instance of the {@link AxisBase2D}
320
+ * @param webAssemblyContext The {@link TSciChart | SciChart 2D WebAssembly Context} containing native methods and
321
+ * access to our WebGL2 Engine and WebAssembly numerical methods
322
+ * @param options Optional parameters of type {@link IAxisBase2dOptions} used to configure the axis at instantiation time
323
+ */
324
+ protected constructor(webAssemblyContext: TSciChart, options?: IAxisBase2dOptions);
325
+ /**
326
+ * @inheritDoc
327
+ */
328
+ applyTheme(themeProvider: IThemeProvider): void;
329
+ onAttach(parentSurface: SciChartSurface, isXAxis: boolean, isPrimaryAxis: boolean): void;
307
330
  /**
308
331
  * Called internally - measures the axis as part of the layout phase
309
332
  */
@@ -32,6 +32,7 @@ var NumberRange_1 = require("../../../Core/NumberRange");
32
32
  var Thickness_1 = require("../../../Core/Thickness");
33
33
  var AxisAlignment_1 = require("../../../types/AxisAlignment");
34
34
  var BaseType_1 = require("../../../types/BaseType");
35
+ var LabelAlignment_1 = require("../../../types/LabelAlignment");
35
36
  var RenderLayer_1 = require("../../../types/RenderLayer");
36
37
  var XyDirection_1 = require("../../../types/XyDirection");
37
38
  var parseColor_1 = require("../../../utils/parseColor");
@@ -48,7 +49,6 @@ var AxisLayoutState_1 = require("./AxisLayoutState");
48
49
  var AxisRenderer_1 = require("./AxisRenderer");
49
50
  var AxisTitleRenderer_1 = require("./AxisTitleRenderer");
50
51
  var constants_1 = require("./constants");
51
- var LabelAlignment_1 = require("../../../types/LabelAlignment");
52
52
  /**
53
53
  * Defines the clipping mode for scrolling operations found on {@link AxisBase2D.scroll}
54
54
  */
@@ -149,6 +149,7 @@ var AxisBase2D = /** @class */ (function (_super) {
149
149
  options.labelProvider = classFactory_1.createType(BaseType_1.EBaseType.LabelProvider, options.labelProvider.type, webAssemblyContext, options.labelProvider.options);
150
150
  }
151
151
  }
152
+ _this.autoRangeAnimationProperty = options === null || options === void 0 ? void 0 : options.autoRangeAnimation;
152
153
  return _this;
153
154
  }
154
155
  Object.defineProperty(AxisBase2D.prototype, "labelProvider", {
@@ -168,38 +169,6 @@ var AxisBase2D = /** @class */ (function (_super) {
168
169
  enumerable: false,
169
170
  configurable: true
170
171
  });
171
- /**
172
- * @inheritDoc
173
- */
174
- AxisBase2D.prototype.applyTheme = function (themeProvider) {
175
- var previousThemeProvider = this.parentSurface.previousThemeProvider;
176
- if (this.axisBandsFill === previousThemeProvider.axisBandsFill) {
177
- this.axisBandsFill = themeProvider.axisBandsFill;
178
- }
179
- if (this.labelStyle.color === previousThemeProvider.tickTextBrush) {
180
- this.labelStyle = { color: themeProvider.tickTextBrush };
181
- }
182
- if (this.minorGridLineStyle.color === previousThemeProvider.minorGridLineBrush) {
183
- this.minorGridLineStyle = { color: themeProvider.minorGridLineBrush };
184
- }
185
- if (this.majorGridLineStyle.color === previousThemeProvider.majorGridLineBrush) {
186
- this.majorGridLineStyle = { color: themeProvider.majorGridLineBrush };
187
- }
188
- if (this.minorTickLineStyle.color === previousThemeProvider.minorGridLineBrush) {
189
- this.minorTickLineStyle = { color: themeProvider.minorGridLineBrush };
190
- }
191
- if (this.majorTickLineStyle.color === previousThemeProvider.majorGridLineBrush) {
192
- this.majorTickLineStyle = { color: themeProvider.majorGridLineBrush };
193
- }
194
- if (this.axisTitleStyle.color === previousThemeProvider.axisTitleColor) {
195
- this.axisTitleStyle = { color: themeProvider.axisTitleColor };
196
- }
197
- };
198
- AxisBase2D.prototype.onAttach = function (parentSurface, isXAxis, isPrimaryAxis) {
199
- this.parentSurface = parentSurface;
200
- this.setIsXAxis(isXAxis);
201
- this.isPrimaryAxisProperty = isPrimaryAxis;
202
- };
203
172
  Object.defineProperty(AxisBase2D.prototype, "axisRenderer", {
204
173
  /**
205
174
  * Gets the {@link AxisRenderer} instance responsible for drawing the axis
@@ -469,6 +438,55 @@ var AxisBase2D = /** @class */ (function (_super) {
469
438
  enumerable: false,
470
439
  configurable: true
471
440
  });
441
+ Object.defineProperty(AxisBase2D.prototype, "autoRangeAnimation", {
442
+ /**
443
+ * Gets or sets a {@link IAutoRangeAnimationOptions} object that controls if and how the visible range is animated during autoRanging
444
+ */
445
+ get: function () {
446
+ return this.autoRangeAnimationProperty;
447
+ },
448
+ /**
449
+ * Gets or sets a {@link IAutoRangeAnimationOptions} object that controls if and how the visible range is animated during autoRanging
450
+ */
451
+ set: function (autoRangeAnimation) {
452
+ this.autoRangeAnimationProperty = __assign(__assign({}, this.autoRangeAnimation), autoRangeAnimation);
453
+ // No need to trigger a redraw. This will take effect anyway if the chart redraws.
454
+ },
455
+ enumerable: false,
456
+ configurable: true
457
+ });
458
+ /**
459
+ * @inheritDoc
460
+ */
461
+ AxisBase2D.prototype.applyTheme = function (themeProvider) {
462
+ var previousThemeProvider = this.parentSurface.previousThemeProvider;
463
+ if (this.axisBandsFill === previousThemeProvider.axisBandsFill) {
464
+ this.axisBandsFill = themeProvider.axisBandsFill;
465
+ }
466
+ if (this.labelStyle.color === previousThemeProvider.tickTextBrush) {
467
+ this.labelStyle = { color: themeProvider.tickTextBrush };
468
+ }
469
+ if (this.minorGridLineStyle.color === previousThemeProvider.minorGridLineBrush) {
470
+ this.minorGridLineStyle = { color: themeProvider.minorGridLineBrush };
471
+ }
472
+ if (this.majorGridLineStyle.color === previousThemeProvider.majorGridLineBrush) {
473
+ this.majorGridLineStyle = { color: themeProvider.majorGridLineBrush };
474
+ }
475
+ if (this.minorTickLineStyle.color === previousThemeProvider.minorGridLineBrush) {
476
+ this.minorTickLineStyle = { color: themeProvider.minorGridLineBrush };
477
+ }
478
+ if (this.majorTickLineStyle.color === previousThemeProvider.majorGridLineBrush) {
479
+ this.majorTickLineStyle = { color: themeProvider.majorGridLineBrush };
480
+ }
481
+ if (this.axisTitleStyle.color === previousThemeProvider.axisTitleColor) {
482
+ this.axisTitleStyle = { color: themeProvider.axisTitleColor };
483
+ }
484
+ };
485
+ AxisBase2D.prototype.onAttach = function (parentSurface, isXAxis, isPrimaryAxis) {
486
+ this.parentSurface = parentSurface;
487
+ this.setIsXAxis(isXAxis);
488
+ this.isPrimaryAxisProperty = isPrimaryAxis;
489
+ };
472
490
  /**
473
491
  * Called internally - measures the axis as part of the layout phase
474
492
  */
@@ -491,6 +509,7 @@ var AxisBase2D = /** @class */ (function (_super) {
491
509
  this.axisTitleRenderer.desiredHeight = 0;
492
510
  this.axisTitleRenderer.desiredWidth = 0;
493
511
  }
512
+ this.isMeasured = true;
494
513
  };
495
514
  /**
496
515
  * Called internally - prepares render data before a draw operation
@@ -694,7 +713,7 @@ var AxisBase2D = /** @class */ (function (_super) {
694
713
  var toValue = coordCalc.getDataValue(toCoord);
695
714
  var min = fromValue < toValue ? fromValue : toValue;
696
715
  var max = fromValue < toValue ? toValue : fromValue;
697
- this.animateVisibleRange(new NumberRange_1.NumberRange(min, max), duration, easingFunction);
716
+ this.parentSurface.addAnimation(this.animateVisibleRange(new NumberRange_1.NumberRange(min, max), duration, easingFunction));
698
717
  };
699
718
  AxisBase2D.prototype.scale = function (initialRange, delta, isMoreThanHalf) {
700
719
  var deltaRange = initialRange.max - initialRange.min;