scichart 2.0.2186 → 2.0.2228

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 (68) hide show
  1. package/Charting/ChartModifiers/CursorModifier.d.ts +13 -1
  2. package/Charting/ChartModifiers/CursorModifier.js +14 -1
  3. package/Charting/ChartModifiers/RolloverModifier.d.ts +25 -0
  4. package/Charting/ChartModifiers/RolloverModifier.js +8 -0
  5. package/Charting/Drawing/BrushCache.d.ts +8 -2
  6. package/Charting/Drawing/BrushCache.js +16 -8
  7. package/Charting/LayoutManager/BaseAxisLayoutStrategy.d.ts +2 -0
  8. package/Charting/LayoutManager/BaseAxisLayoutStrategy.js +33 -0
  9. package/Charting/LayoutManager/BottomAlignedOuterHorizontallyStackedAxisLayoutStrategy.js +18 -2
  10. package/Charting/LayoutManager/LeftAlignedOuterVerticallyStackedAxisLayoutStrategy.js +19 -2
  11. package/Charting/LayoutManager/RightAlignedOuterVerticallyStackedAxisLayoutStrategy.js +18 -2
  12. package/Charting/LayoutManager/TopAlignedOuterHorizontallyStackedAxisLayoutStrategy.js +18 -2
  13. package/Charting/Model/OhlcDataSeries.js +10 -10
  14. package/Charting/Model/XyDataSeries.js +4 -4
  15. package/Charting/Model/XyyDataSeries.js +6 -6
  16. package/Charting/Model/XyzDataSeries.js +6 -6
  17. package/Charting/Services/SciChartRenderer.js +3 -1
  18. package/Charting/Services/Workers/TextureWorker.js +5 -1
  19. package/Charting/Visuals/Annotations/AnnotationBase.d.ts +1 -1
  20. package/Charting/Visuals/Annotations/CursorTooltipSvgAnnotation.d.ts +1 -0
  21. package/Charting/Visuals/Annotations/CursorTooltipSvgAnnotation.js +6 -0
  22. package/Charting/Visuals/Annotations/RolloverMarkerSvgAnnotation.d.ts +5 -0
  23. package/Charting/Visuals/Annotations/RolloverMarkerSvgAnnotation.js +12 -1
  24. package/Charting/Visuals/Annotations/RolloverTooltipSvgAnnotation.d.ts +6 -8
  25. package/Charting/Visuals/Annotations/RolloverTooltipSvgAnnotation.js +12 -9
  26. package/Charting/Visuals/Annotations/SvgAnnotationBase.js +7 -2
  27. package/Charting/Visuals/Axis/AxisBase2D.d.ts +23 -0
  28. package/Charting/Visuals/Axis/AxisBase2D.js +71 -24
  29. package/Charting/Visuals/Axis/AxisRenderer.js +31 -4
  30. package/Charting/Visuals/Axis/LabelProvider/LabelCache.js +2 -2
  31. package/Charting/Visuals/Axis/LabelProvider/LabelProviderBase2D.js +9 -4
  32. package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.js +2 -1
  33. package/Charting/Visuals/RenderableSeries/DrawingProviders/MountainSeriesDrawingProvider.js +10 -3
  34. package/Charting/Visuals/SciChartSurface.d.ts +4 -4
  35. package/Charting/Visuals/SciChartSurface.js +18 -13
  36. package/Charting/Visuals/SciChartSurfaceBase.d.ts +3 -2
  37. package/Charting/Visuals/SciChartSurfaceBase.js +4 -4
  38. package/Charting/Visuals/createMaster.d.ts +1 -1
  39. package/Charting/Visuals/createMaster.js +36 -15
  40. package/Charting/Visuals/createSingle.d.ts +1 -1
  41. package/Charting/Visuals/createSingle.js +11 -4
  42. package/Charting/Visuals/licenseManager2D.js +5 -1
  43. package/Charting/Visuals/sciChartInitCommon.d.ts +2 -2
  44. package/Charting/Visuals/sciChartInitCommon.js +18 -12
  45. package/Charting3D/Visuals/SciChart3DSurface.d.ts +2 -2
  46. package/Charting3D/Visuals/SciChart3DSurface.js +3 -3
  47. package/Charting3D/Visuals/createMaster3d.d.ts +1 -1
  48. package/Charting3D/Visuals/createMaster3d.js +42 -19
  49. package/Charting3D/Visuals/createSingle3d.d.ts +1 -1
  50. package/Charting3D/Visuals/createSingle3d.js +12 -5
  51. package/Core/BuildStamp.d.ts +4 -0
  52. package/Core/BuildStamp.js +23 -0
  53. package/Core/NumberRange.d.ts +1 -0
  54. package/Core/NumberRange.js +8 -0
  55. package/_wasm/scichart.browser.js +1 -1
  56. package/_wasm/scichart2d.js +10 -10
  57. package/_wasm/scichart2d.wasm +0 -0
  58. package/_wasm/scichart3d.js +12 -12
  59. package/_wasm/scichart3d.wasm +0 -0
  60. package/package.json +1 -1
  61. package/types/NumberArray.d.ts +1 -0
  62. package/types/NumberArray.js +5 -1
  63. package/types/TSciChart.d.ts +1 -0
  64. package/types/TSciChart3D.d.ts +1 -0
  65. package/types/TStackedAxisLength.d.ts +4 -0
  66. package/types/TStackedAxisLength.js +4 -0
  67. package/utils/performance.d.ts +5 -0
  68. package/utils/performance.js +11 -0
@@ -1,3 +1,4 @@
1
+ import { CoordinateCalculatorBase } from "../../Numerics/CoordinateCalculators/CoordinateCalculatorBase";
1
2
  import { RolloverModifierRenderableSeriesProps } from "../RenderableSeries/RolloverModifier/RolloverModifierRenderableSeriesProps";
2
3
  import { EAnnotationType } from "./IAnnotation";
3
4
  import { SvgAnnotationBase } from "./SvgAnnotationBase";
@@ -5,6 +6,10 @@ export declare class RolloverMarkerSvgAnnotation extends SvgAnnotationBase {
5
6
  /** @inheritDoc */
6
7
  readonly type = EAnnotationType.SVG;
7
8
  private tooltipProps;
9
+ private previousMousePosition;
8
10
  constructor(renderableSeriesProps: RolloverModifierRenderableSeriesProps);
11
+ /** @inheritDoc */
12
+ update(xCalc: CoordinateCalculatorBase, yCalc: CoordinateCalculatorBase): void;
13
+ /** @inheritDoc */
9
14
  protected create(): void;
10
15
  }
@@ -16,6 +16,7 @@ var __extends = (this && this.__extends) || (function () {
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.RolloverMarkerSvgAnnotation = void 0;
19
+ var MousePosition_1 = require("../../../types/MousePosition");
19
20
  var IAnnotation_1 = require("./IAnnotation");
20
21
  var SvgAnnotationBase_1 = require("./SvgAnnotationBase");
21
22
  var RolloverMarkerSvgAnnotation = /** @class */ (function (_super) {
@@ -25,13 +26,23 @@ var RolloverMarkerSvgAnnotation = /** @class */ (function (_super) {
25
26
  /** @inheritDoc */
26
27
  _this.type = IAnnotation_1.EAnnotationType.SVG;
27
28
  _this.tooltipProps = renderableSeriesProps;
28
- _this.isHidden = true;
29
+ _this.isHiddenProperty = true;
29
30
  _this.x1 = 0;
30
31
  _this.y1 = 0;
31
32
  _this.xCoordShift = -4;
32
33
  _this.yCoordShift = -4;
33
34
  return _this;
34
35
  }
36
+ /** @inheritDoc */
37
+ RolloverMarkerSvgAnnotation.prototype.update = function (xCalc, yCalc) {
38
+ var currentMousePosition = this.tooltipProps.rolloverModifier.getMousePosition();
39
+ if (this.previousMousePosition === currentMousePosition && currentMousePosition !== MousePosition_1.EMousePosition.SeriesArea) {
40
+ return;
41
+ }
42
+ this.previousMousePosition = this.tooltipProps.rolloverModifier.getMousePosition();
43
+ _super.prototype.update.call(this, xCalc, yCalc);
44
+ };
45
+ /** @inheritDoc */
35
46
  RolloverMarkerSvgAnnotation.prototype.create = function () {
36
47
  if (this.svg) {
37
48
  this.delete();
@@ -19,6 +19,7 @@ export declare class RolloverTooltipSvgAnnotation extends SvgAnnotationBase {
19
19
  height: number;
20
20
  private svgLegend;
21
21
  private seriesInfoProperty;
22
+ private previousMousePosition;
22
23
  /**
23
24
  * Creates an instance of the {@link RolloverTooltipSvgAnnotation}
24
25
  * @param renderableSeriesProps The {@link RolloverModifierRenderableSeriesProps | props} pass
@@ -33,18 +34,15 @@ export declare class RolloverTooltipSvgAnnotation extends SvgAnnotationBase {
33
34
  * Gets or sets seriesInfo {@link SeriesInfo} value on the tooltip
34
35
  */
35
36
  set seriesInfo(value: SeriesInfo);
36
- /**
37
- * @inheritDoc
38
- */
37
+ /** @inheritDoc */
39
38
  delete(): void;
40
- /**
41
- * @inheritDoc
42
- */
39
+ /** @inheritDoc */
43
40
  update(xCalc: CoordinateCalculatorBase, yCalc: CoordinateCalculatorBase): void;
44
- updateSize(width: number, height: number): void;
45
41
  /**
46
- * @inheritDoc
42
+ * Updates size of the tooltip
47
43
  */
44
+ updateSize(width: number, height: number): void;
45
+ /** @inheritDoc */
48
46
  protected create(xCalc: CoordinateCalculatorBase, yCalc: CoordinateCalculatorBase): void;
49
47
  private updateLegendTooltip;
50
48
  }
@@ -16,6 +16,7 @@ var __extends = (this && this.__extends) || (function () {
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.RolloverTooltipSvgAnnotation = void 0;
19
+ var MousePosition_1 = require("../../../types/MousePosition");
19
20
  var IDataSeries_1 = require("../../Model/IDataSeries");
20
21
  var AnnotationBase_1 = require("./AnnotationBase");
21
22
  var constants_1 = require("./constants");
@@ -64,9 +65,7 @@ var RolloverTooltipSvgAnnotation = /** @class */ (function (_super) {
64
65
  enumerable: false,
65
66
  configurable: true
66
67
  });
67
- /**
68
- * @inheritDoc
69
- */
68
+ /** @inheritDoc */
70
69
  RolloverTooltipSvgAnnotation.prototype.delete = function () {
71
70
  var _a;
72
71
  if (!this.parentSurface || this.parentSurface.isDeleted)
@@ -76,23 +75,27 @@ var RolloverTooltipSvgAnnotation = /** @class */ (function (_super) {
76
75
  this.svgRoot.removeChild(this.svgLegend);
77
76
  }
78
77
  };
79
- /**
80
- * @inheritDoc
81
- */
78
+ /** @inheritDoc */
82
79
  RolloverTooltipSvgAnnotation.prototype.update = function (xCalc, yCalc) {
80
+ var currentMousePosition = this.tooltipProps.rolloverModifier.getMousePosition();
81
+ if (this.previousMousePosition === currentMousePosition && currentMousePosition !== MousePosition_1.EMousePosition.SeriesArea) {
82
+ return;
83
+ }
84
+ this.previousMousePosition = this.tooltipProps.rolloverModifier.getMousePosition();
83
85
  if (this.svg) {
84
86
  this.delete();
85
87
  }
86
88
  _super.prototype.update.call(this, xCalc, yCalc);
87
89
  this.updateLegendTooltip();
88
90
  };
91
+ /**
92
+ * Updates size of the tooltip
93
+ */
89
94
  RolloverTooltipSvgAnnotation.prototype.updateSize = function (width, height) {
90
95
  this.width = width;
91
96
  this.height = height;
92
97
  };
93
- /**
94
- * @inheritDoc
95
- */
98
+ /** @inheritDoc */
96
99
  RolloverTooltipSvgAnnotation.prototype.create = function (xCalc, yCalc) {
97
100
  var _a;
98
101
  var svgString;
@@ -38,6 +38,11 @@ var SvgAnnotationBase = /** @class */ (function (_super) {
38
38
  var _this = _super.call(this, options) || this;
39
39
  /** @inheritDoc */
40
40
  _this.isSvgAnnotation = true;
41
+ /**
42
+ * The {@link SVGElement} which will be added to the chart
43
+ */
44
+ _this.xCoordShiftProperty = 0;
45
+ _this.yCoordShiftProperty = 0;
41
46
  _this.verticalAnchorPointProperty = AnchorPoint_1.EVerticalAnchorPoint.Top;
42
47
  _this.horizontalAnchorPointProperty = AnchorPoint_1.EHorizontalAnchorPoint.Left;
43
48
  _this.prevX1Coordinate = 0;
@@ -292,8 +297,8 @@ var SvgAnnotationBase = /** @class */ (function (_super) {
292
297
  SvgAnnotationBase.prototype.calcAndSetAnnotationBorders = function (xCalc, yCalc) {
293
298
  if (!this.svg)
294
299
  return;
295
- var borderX1 = this.getX1Coordinate(xCalc, yCalc);
296
- var borderY1 = this.getY1Coordinate(xCalc, yCalc);
300
+ var borderX1 = this.getX1Coordinate(xCalc, yCalc) + this.xCoordShift;
301
+ var borderY1 = this.getY1Coordinate(xCalc, yCalc) + this.yCoordShift;
297
302
  this.svgDOMRect = this.svg.getBoundingClientRect();
298
303
  var borderX2 = borderX1 + this.svgDOMRect.width;
299
304
  var borderY2 = borderY1 + this.svgDOMRect.height;
@@ -7,6 +7,7 @@ import { EAxisAlignment } from "../../../types/AxisAlignment";
7
7
  import { EAxisType } from "../../../types/AxisType";
8
8
  import { TBorder } from "../../../types/TBorder";
9
9
  import { SCRTPen, SCRTSolidBrush, TSciChart } from "../../../types/TSciChart";
10
+ import { TStackedAxisLength } from "../../../types/TStackedAxisLength";
10
11
  import { WebGlRenderContext2D } from "../../Drawing/WebGlRenderContext2D";
11
12
  import { IThemeable } from "../../Themes/IThemeable";
12
13
  import { IThemeProvider } from "../../Themes/IThemeProvider";
@@ -112,6 +113,13 @@ export interface IAxisBase2dOptions extends IAxisCoreOptions {
112
113
  * @remarks Center axis uses inner layout strategy
113
114
  */
114
115
  isInnerAxis?: boolean;
116
+ /** Gets or sets the length of a stacked axis as an absolute number or percentage, e.g. 100, or "30%".
117
+ * A plain number will be interpreted as a number of pixels.
118
+ * A number with % will take that percentage of the total length.
119
+ * Stacked axes without a defined length will have the remaining unreserved spaced split between them.
120
+ * @remarks The axis length doesn't include border sizes
121
+ */
122
+ stackedAxisLength?: TStackedAxisLength;
115
123
  /**
116
124
  * Sets a {@link LabelProvider} - a class which is responsible for formatting axis labels and cursor labels from numeric values
117
125
  */
@@ -230,6 +238,20 @@ export declare abstract class AxisBase2D extends AxisCore implements IThemeable
230
238
  * This is only used to allow multiple primary axes, so that all stacked axes can draw gridlines
231
239
  */
232
240
  set isStackedAxis(value: boolean);
241
+ /** Gets or sets the length of a stacked axis as an absolute number or percentage, e.g. 100, or "30%".
242
+ * A plain number will be interpreted as a number of pixels.
243
+ * A number with % will take that percentage of the total length.
244
+ * Stacked axes without a defined length will have the remaining unreserved spaced split between them.
245
+ * @remarks The axis length doesn't include border sizes
246
+ */
247
+ get stackedAxisLength(): TStackedAxisLength;
248
+ /** Gets or sets the length of a stacked axis as an absolute number or percentage, e.g. 100, or "30%".
249
+ * A plain number will be interpreted as a number of pixels.
250
+ * A number with % will take that percentage of the total length.
251
+ * Stacked axes without a defined length will have the remaining unreserved spaced split between them.
252
+ * @remarks The axis length doesn't include border sizes
253
+ */
254
+ set stackedAxisLength(value: TStackedAxisLength);
233
255
  /**
234
256
  * Called internally - Gets or sets the length the current Axis. E.g. width of horizontal axis or height of vertical axis.
235
257
  */
@@ -308,6 +330,7 @@ export declare abstract class AxisBase2D extends AxisCore implements IThemeable
308
330
  private zoomExtentsRangeProperty;
309
331
  private isPrimaryAxisProperty;
310
332
  private isStackedAxisProperty;
333
+ private stackedAxisLengthProperty;
311
334
  private penCacheForMajorGridLines;
312
335
  private penCacheForMinorGridLines;
313
336
  private penCacheForMajorTickLines;
@@ -100,7 +100,7 @@ var AxisBase2D = /** @class */ (function (_super) {
100
100
  * @param options Optional parameters of type {@link IAxisBase2dOptions} used to configure the axis at instantiation time
101
101
  */
102
102
  function AxisBase2D(webAssemblyContext, options) {
103
- var _a, _b, _c, _d, _e, _f, _g;
103
+ var _a, _b, _c, _d, _e, _f, _g, _h;
104
104
  var _this = _super.call(this, options) || this;
105
105
  /**
106
106
  * Gets the {@link AxisLayoutState} class which manages layout
@@ -149,6 +149,7 @@ var AxisBase2D = /** @class */ (function (_super) {
149
149
  _this.labelStyle = __assign(__assign({}, _this.labelStyle), options === null || options === void 0 ? void 0 : options.labelStyle);
150
150
  _this.axisBorder = __assign(__assign({}, _this.axisBorder), options === null || options === void 0 ? void 0 : options.axisBorder);
151
151
  _this.isInnerAxis = (_g = options === null || options === void 0 ? void 0 : options.isInnerAxis) !== null && _g !== void 0 ? _g : _this.isInnerAxis;
152
+ _this.stackedAxisLength = (_h = options === null || options === void 0 ? void 0 : options.stackedAxisLength) !== null && _h !== void 0 ? _h : _this.stackedAxisLength;
152
153
  _this.solidBrushCacheBorder = new SolidBrushCache_1.SolidBrushCache(webAssemblyContext);
153
154
  if (options === null || options === void 0 ? void 0 : options.labelProvider) {
154
155
  if (!("getLabels" in (options === null || options === void 0 ? void 0 : options.labelProvider))) {
@@ -232,8 +233,10 @@ var AxisBase2D = /** @class */ (function (_super) {
232
233
  * SciChart also supports XAxis on the left and YAxis on the top to rotate / create vertical charts.
233
234
  */
234
235
  set: function (axisAlignment) {
235
- this.axisAlignmentProperty = axisAlignment;
236
- this.notifyPropertyChanged(constants_1.PROPERTY.AXIS_ALIGNMENT);
236
+ if (this.axisAlignmentProperty !== axisAlignment) {
237
+ this.axisAlignmentProperty = axisAlignment;
238
+ this.notifyPropertyChanged(constants_1.PROPERTY.AXIS_ALIGNMENT);
239
+ }
237
240
  },
238
241
  enumerable: false,
239
242
  configurable: true
@@ -249,8 +252,10 @@ var AxisBase2D = /** @class */ (function (_super) {
249
252
  * Gets or sets a property which limits {@link AxisCore.visibleRange}, meaning the chart cannot autorange outside that range
250
253
  */
251
254
  set: function (visibleRangeLimit) {
252
- this.visibleRangeLimitProperty = visibleRangeLimit;
253
- this.notifyPropertyChanged(constants_1.PROPERTY.VISIBLE_RANGE_LIMIT);
255
+ if (!NumberRange_1.NumberRange.areEqual(this.visibleRangeLimitProperty, visibleRangeLimit)) {
256
+ this.visibleRangeLimitProperty = visibleRangeLimit;
257
+ this.notifyPropertyChanged(constants_1.PROPERTY.VISIBLE_RANGE_LIMIT);
258
+ }
254
259
  },
255
260
  enumerable: false,
256
261
  configurable: true
@@ -266,8 +271,10 @@ var AxisBase2D = /** @class */ (function (_super) {
266
271
  * Gets or sets a property which, if it is set, will be used as the range when zooming extents, rather than the data max range
267
272
  */
268
273
  set: function (zoomExtentsRange) {
269
- this.zoomExtentsRangeProperty = zoomExtentsRange;
270
- this.notifyPropertyChanged(constants_1.PROPERTY.ZOOMEXTENTS_RANGE);
274
+ if (!NumberRange_1.NumberRange.areEqual(this.zoomExtentsRangeProperty, zoomExtentsRange)) {
275
+ this.zoomExtentsRangeProperty = zoomExtentsRange;
276
+ this.notifyPropertyChanged(constants_1.PROPERTY.ZOOMEXTENTS_RANGE);
277
+ }
271
278
  },
272
279
  enumerable: false,
273
280
  configurable: true
@@ -285,8 +292,10 @@ var AxisBase2D = /** @class */ (function (_super) {
285
292
  * @remarks Center axis uses inner layout strategy
286
293
  */
287
294
  set: function (value) {
288
- this.isInnerAxisProperty = value;
289
- this.notifyPropertyChanged(constants_1.PROPERTY.IS_INNER_AXIS);
295
+ if (this.isInnerAxisProperty !== value) {
296
+ this.isInnerAxisProperty = value;
297
+ this.notifyPropertyChanged(constants_1.PROPERTY.IS_INNER_AXIS);
298
+ }
290
299
  },
291
300
  enumerable: false,
292
301
  configurable: true
@@ -307,15 +316,17 @@ var AxisBase2D = /** @class */ (function (_super) {
307
316
  */
308
317
  set: function (value) {
309
318
  var _this = this;
310
- this.isPrimaryAxisProperty = value;
311
- this.notifyPropertyChanged(constants_1.PROPERTY.IS_PRIMARY_AXIS);
312
- if (value && !this.isStackedAxis) {
313
- var axes = this.isXAxis ? this.parentSurface.xAxes : this.parentSurface.yAxes;
314
- axes.asArray().forEach(function (a) {
315
- if (a !== _this && !a.isStackedAxis) {
316
- a.isPrimaryAxis = false;
317
- }
318
- });
319
+ if (this.isPrimaryAxisProperty !== value) {
320
+ this.isPrimaryAxisProperty = value;
321
+ this.notifyPropertyChanged(constants_1.PROPERTY.IS_PRIMARY_AXIS);
322
+ if (value && !this.isStackedAxis) {
323
+ var axes = this.isXAxis ? this.parentSurface.xAxes : this.parentSurface.yAxes;
324
+ axes.asArray().forEach(function (a) {
325
+ if (a !== _this && !a.isStackedAxis) {
326
+ a.isPrimaryAxis = false;
327
+ }
328
+ });
329
+ }
319
330
  }
320
331
  },
321
332
  enumerable: false,
@@ -337,6 +348,31 @@ var AxisBase2D = /** @class */ (function (_super) {
337
348
  enumerable: false,
338
349
  configurable: true
339
350
  });
351
+ Object.defineProperty(AxisBase2D.prototype, "stackedAxisLength", {
352
+ /** Gets or sets the length of a stacked axis as an absolute number or percentage, e.g. 100, or "30%".
353
+ * A plain number will be interpreted as a number of pixels.
354
+ * A number with % will take that percentage of the total length.
355
+ * Stacked axes without a defined length will have the remaining unreserved spaced split between them.
356
+ * @remarks The axis length doesn't include border sizes
357
+ */
358
+ get: function () {
359
+ return this.stackedAxisLengthProperty;
360
+ },
361
+ /** Gets or sets the length of a stacked axis as an absolute number or percentage, e.g. 100, or "30%".
362
+ * A plain number will be interpreted as a number of pixels.
363
+ * A number with % will take that percentage of the total length.
364
+ * Stacked axes without a defined length will have the remaining unreserved spaced split between them.
365
+ * @remarks The axis length doesn't include border sizes
366
+ */
367
+ set: function (value) {
368
+ if (this.stackedAxisLengthProperty !== value) {
369
+ this.stackedAxisLengthProperty = value;
370
+ this.notifyPropertyChanged(constants_1.PROPERTY.AXIS_LENGTH);
371
+ }
372
+ },
373
+ enumerable: false,
374
+ configurable: true
375
+ });
340
376
  Object.defineProperty(AxisBase2D.prototype, "axisLength", {
341
377
  /**
342
378
  * Called internally - Gets or sets the length the current Axis. E.g. width of horizontal axis or height of vertical axis.
@@ -351,8 +387,10 @@ var AxisBase2D = /** @class */ (function (_super) {
351
387
  return (_b = this.axisLengthProperty) !== null && _b !== void 0 ? _b : defaultAxisLength;
352
388
  },
353
389
  set: function (value) {
354
- this.axisLengthProperty = value;
355
- this.notifyPropertyChanged(constants_1.PROPERTY.AXIS_LENGTH);
390
+ if (this.axisLengthProperty !== value) {
391
+ this.axisLengthProperty = value;
392
+ this.notifyPropertyChanged(constants_1.PROPERTY.AXIS_LENGTH);
393
+ }
356
394
  },
357
395
  enumerable: false,
358
396
  configurable: true
@@ -369,8 +407,10 @@ var AxisBase2D = /** @class */ (function (_super) {
369
407
  * Gets or sets the offset of the axis position
370
408
  */
371
409
  set: function (value) {
372
- this.offsetProperty = value;
373
- this.notifyPropertyChanged(constants_1.PROPERTY.OFFSET);
410
+ if (this.offsetProperty !== value) {
411
+ this.offsetProperty = value;
412
+ this.notifyPropertyChanged(constants_1.PROPERTY.OFFSET);
413
+ }
374
414
  },
375
415
  enumerable: false,
376
416
  configurable: true
@@ -676,8 +716,15 @@ var AxisBase2D = /** @class */ (function (_super) {
676
716
  }
677
717
  var translatedRange = this.getCurrentCoordinateCalculator().translateBy(pixelsToScroll, startVisibleRange);
678
718
  if (this.visibleRangeLimit) {
679
- if (translatedRange.min < this.visibleRangeLimit.min || translatedRange.max > this.visibleRangeLimit.max) {
680
- return false;
719
+ var limitDelta = 0;
720
+ if (translatedRange.min < this.visibleRangeLimit.min) {
721
+ limitDelta = this.visibleRangeLimit.min - translatedRange.min;
722
+ }
723
+ else if (this.visibleRangeLimit.max < translatedRange.max) {
724
+ limitDelta = this.visibleRangeLimit.max - translatedRange.max;
725
+ }
726
+ if (limitDelta) {
727
+ translatedRange = new NumberRange_1.NumberRange(translatedRange.min + limitDelta, translatedRange.max + limitDelta);
681
728
  }
682
729
  }
683
730
  this.visibleRange = translatedRange;
@@ -367,22 +367,49 @@ var AxisRenderer = /** @class */ (function () {
367
367
  return undefined;
368
368
  var nativeContext = renderContext.getNativeContext();
369
369
  var _a = this.textureManager.createSimpleTextTexture(displayValue, __assign(__assign({}, textStyle), { padding: new Thickness_1.Thickness(2, 2, 2, 2) }), fill), bitmapTexture = _a.bitmapTexture, textureHeight = _a.textureHeight, textureWidth = _a.textureWidth;
370
+ var canvas = {
371
+ height: this.parentAxis.parentSurface.domCanvas2D.height,
372
+ width: this.parentAxis.parentSurface.domCanvas2D.width
373
+ };
374
+ var getPosition = function (viewRectSize, coord, canvasSize, textureSize$) {
375
+ if (viewRectSize + coord < textureSize$ / 2) {
376
+ return 0;
377
+ }
378
+ else if (viewRectSize + coord > canvasSize - textureSize$ / 2) {
379
+ return canvasSize - textureSize$;
380
+ }
381
+ else {
382
+ return viewRectSize + coord - textureSize$ / 2;
383
+ }
384
+ };
370
385
  var xPosition, yPosition;
371
386
  if (axisAlignment === AxisAlignment_1.EAxisAlignment.Bottom) {
372
- xPosition = this.viewRect.x + coord - textureWidth / 2;
387
+ xPosition = getPosition(this.viewRect.x, coord, canvas.width, textureWidth);
373
388
  yPosition = this.viewRect.y;
389
+ if (canvas.height - yPosition < textureHeight) {
390
+ yPosition = canvas.height - textureHeight;
391
+ }
374
392
  }
375
393
  else if (axisAlignment === AxisAlignment_1.EAxisAlignment.Top) {
376
- xPosition = this.viewRect.x + coord - textureWidth / 2;
394
+ xPosition = getPosition(this.viewRect.x, coord, canvas.width, textureWidth);
377
395
  yPosition = this.viewRect.y + this.viewRect.height - textureHeight;
396
+ if (this.parentAxis.axisLayoutState.axisSize < textureHeight) {
397
+ yPosition = 0;
398
+ }
378
399
  }
379
400
  else if (axisAlignment === AxisAlignment_1.EAxisAlignment.Left) {
380
401
  xPosition = this.viewRect.x + this.viewRect.width - textureWidth;
381
- yPosition = this.viewRect.y + coord - textureHeight / 2;
402
+ yPosition = getPosition(this.viewRect.y, coord, canvas.height, textureHeight);
403
+ if (this.parentAxis.axisLayoutState.axisSize < textureWidth) {
404
+ xPosition = 0;
405
+ }
382
406
  }
383
407
  else if (axisAlignment === AxisAlignment_1.EAxisAlignment.Right) {
384
408
  xPosition = this.viewRect.x;
385
- yPosition = this.viewRect.y + coord - textureHeight / 2;
409
+ yPosition = getPosition(this.viewRect.y, coord, canvas.height, textureHeight);
410
+ if (canvas.width - xPosition < textureWidth) {
411
+ xPosition = canvas.width - textureWidth;
412
+ }
386
413
  }
387
414
  nativeContext.DrawTexture(bitmapTexture, Math.round(xPosition), Math.round(yPosition), textureWidth, textureHeight);
388
415
  bitmapTexture.delete();
@@ -72,7 +72,7 @@ var clearCacheByStyle = function (styleId) {
72
72
  }
73
73
  }
74
74
  };
75
- var maxSize = 100;
75
+ var maxSize = 200;
76
76
  var minAge = 1000 * 60;
77
77
  var lastUsed = 0;
78
78
  var getMaxSize = function () { return maxSize; };
@@ -88,7 +88,7 @@ var pruneCache = function () {
88
88
  if (labelCacheByTextAndStyle.size > maxSize && lastUsed < latest) {
89
89
  try {
90
90
  // remove more than we need so we do this less.
91
- var toRemove = (labelCacheByTextAndStyle.size - maxSize) * 2;
91
+ var toRemove = Math.min(Math.floor(labelCacheByTextAndStyle.size / 2), (labelCacheByTextAndStyle.size - maxSize) * 2);
92
92
  // Sort the items by LastUsed ascending
93
93
  var labels = Array.from(labelCacheByTextAndStyle.entries());
94
94
  labels.sort(function (a, b) { return a[1].lastUsed - b[1].lastUsed; });
@@ -148,11 +148,16 @@ var LabelProviderBase2D = /** @class */ (function (_super) {
148
148
  var cachedLabel = void 0;
149
149
  if (cachedLabelText) {
150
150
  cachedLabel = LabelCache_1.labelCache.getLabel(cachedLabelText, this.styleId);
151
- labels.push(cachedLabelText);
151
+ if (cachedLabel) {
152
+ labels.push(cachedLabelText);
153
+ }
152
154
  }
153
- else {
154
- var text = this.formatLabel(tick);
155
- this.tickToText.set(tick, text);
155
+ if (!cachedLabel) {
156
+ var text = cachedLabelText;
157
+ if (!cachedLabelText) {
158
+ text = this.formatLabel(tick);
159
+ this.tickToText.set(tick, text);
160
+ }
156
161
  var texture = this.getCachedLabelTexture(text, axis.axisRenderer.textureManager, axis.dpiAdjustedLabelStyle);
157
162
  if (texture.textureWidth !== null) {
158
163
  cachedLabel = new LabelInfo(tick, text, texture.bitmapTexture, texture.textureHeight, texture.textureWidth);
@@ -512,7 +512,8 @@ var BaseRenderableSeries = /** @class */ (function () {
512
512
  };
513
513
  /** @inheritDoc */
514
514
  BaseRenderableSeries.prototype.getDataSeriesName = function () {
515
- return this.dataSeries.dataSeriesName;
515
+ var _a;
516
+ return (_a = this.dataSeries) === null || _a === void 0 ? void 0 : _a.dataSeriesName;
516
517
  };
517
518
  /** @inheritDoc */
518
519
  BaseRenderableSeries.prototype.getNativeXValues = function () {
@@ -21,6 +21,7 @@ var SeriesType_1 = require("../../../../types/SeriesType");
21
21
  var BrushCache_1 = require("../../../Drawing/BrushCache");
22
22
  var Pen2DCache_1 = require("../../../Drawing/Pen2DCache");
23
23
  var WebGlRenderContext2D_1 = require("../../../Drawing/WebGlRenderContext2D");
24
+ var SciChartSurfaceBase_1 = require("../../SciChartSurfaceBase");
24
25
  var constants_1 = require("../constants");
25
26
  var BaseSeriesDrawingProvider_1 = require("./BaseSeriesDrawingProvider");
26
27
  /**
@@ -67,7 +68,7 @@ var MountainSeriesDrawingProvider = /** @class */ (function (_super) {
67
68
  args.verticalChart = renderPassData.isVerticalChart;
68
69
  args.zeroLineY = this.parentSeries.zeroLineY;
69
70
  args.isDigitalLine = this.parentSeries.isDigitalLine;
70
- var fillBrush = (0, BrushCache_1.getScrtBrushFromCache)(this.fillBrushCache);
71
+ var fillBrush = this.createBrush();
71
72
  if (fillBrush) {
72
73
  args.SetFillBrush(fillBrush);
73
74
  }
@@ -141,8 +142,14 @@ var MountainSeriesDrawingProvider = /** @class */ (function (_super) {
141
142
  this.createBrush();
142
143
  };
143
144
  MountainSeriesDrawingProvider.prototype.createBrush = function () {
144
- var _a = this.parentSeries, fill = _a.fill, opacity = _a.opacity, fillLinearGradient = _a.fillLinearGradient;
145
- return (0, BrushCache_1.createBrushInCache)(this.fillBrushCache, fill, opacity, fillLinearGradient);
145
+ var _a = this.parentSeries, fill = _a.fill, opacity = _a.opacity, fillLinearGradient = _a.fillLinearGradient, parentSurface = _a.parentSurface;
146
+ var textureHeightRatio = (parentSurface === null || parentSurface === void 0 ? void 0 : parentSurface.isCopyCanvasSurface)
147
+ ? parentSurface.domCanvas2D.height / SciChartSurfaceBase_1.SciChartSurfaceBase.domMasterCanvas.height
148
+ : 1;
149
+ var textureWidthRatio = (parentSurface === null || parentSurface === void 0 ? void 0 : parentSurface.isCopyCanvasSurface)
150
+ ? parentSurface.domCanvas2D.width / SciChartSurfaceBase_1.SciChartSurfaceBase.domMasterCanvas.width
151
+ : 1;
152
+ return (0, BrushCache_1.createBrushInCache)(this.fillBrushCache, fill, opacity, textureHeightRatio, textureWidthRatio, fillLinearGradient);
146
153
  };
147
154
  MountainSeriesDrawingProvider.prototype.createPen = function () {
148
155
  var _a = this.parentSeries, stroke = _a.stroke, strokeThickness = _a.strokeThickness, opacity = _a.opacity, strokeDashArray = _a.strokeDashArray;
@@ -53,16 +53,16 @@ export declare class SciChartSurface extends SciChartSurfaceBase {
53
53
  /**
54
54
  * Creates a {@link SciChartSurface} and {@link TSciChart | WebAssembly Context} to occupy the div by element ID in your DOM.
55
55
  * @remarks This method is async and must be awaited
56
- * @param divElementId The Div Element ID where the {@link SciChartSurface} will reside
56
+ * @param divElement The Div Element ID or reference where the {@link SciChartSurface} will reside
57
57
  * @param options Optional - Optional parameters for chart creation. See {@link I2DSurfaceOptions} for more details
58
58
  */
59
- static create(divElementId: string, options?: I2DSurfaceOptions): Promise<TWebAssemblyChart>;
59
+ static create(divElement: string | HTMLDivElement, options?: I2DSurfaceOptions): Promise<TWebAssemblyChart>;
60
60
  /**
61
61
  * USED INTERNALLY - performs a similar operation to {@link SciChartSurface.create} but used internally for testing
62
- * @param divElementId
62
+ * @param divElement The Div Element ID or reference where the {@link SciChartSurface} will reside
63
63
  * @param options - optional parameters for chart creation. See {@link I2DSurfaceOptions} for more details
64
64
  */
65
- static createSingle(divElementId: string, options?: I2DSurfaceOptions): Promise<TWebAssemblyChart>;
65
+ static createSingle(divElement: string | HTMLDivElement, options?: I2DSurfaceOptions): Promise<TWebAssemblyChart>;
66
66
  /**
67
67
  * Allows setting of web URL for Wasm and Data files, in the case you are loading SciChart outside of npm/webpack environment.
68
68
  * Note if loading from CDN the version number of data/wasm Urls must match the version number of SciChart.js you are using.
@@ -195,17 +195,17 @@ var SciChartSurface = /** @class */ (function (_super) {
195
195
  /**
196
196
  * Creates a {@link SciChartSurface} and {@link TSciChart | WebAssembly Context} to occupy the div by element ID in your DOM.
197
197
  * @remarks This method is async and must be awaited
198
- * @param divElementId The Div Element ID where the {@link SciChartSurface} will reside
198
+ * @param divElement The Div Element ID or reference where the {@link SciChartSurface} will reside
199
199
  * @param options Optional - Optional parameters for chart creation. See {@link I2DSurfaceOptions} for more details
200
200
  */
201
- SciChartSurface.create = function (divElementId, options) {
201
+ SciChartSurface.create = function (divElement, options) {
202
202
  (0, chartBuilder_1.ensureRegistrations)();
203
203
  options = SciChartSurface.resolveOptions(options);
204
204
  if (app_1.IS_TEST_ENV) {
205
- return this.createTest(divElementId, options);
205
+ return this.createTest(divElement, options);
206
206
  }
207
207
  else {
208
- return (0, createMaster_1.createMultichart)(divElementId, options).then(function (result) {
208
+ return (0, createMaster_1.createMultichart)(divElement, options).then(function (result) {
209
209
  result.sciChartSurface.applyOptions(options);
210
210
  return result;
211
211
  });
@@ -213,17 +213,17 @@ var SciChartSurface = /** @class */ (function (_super) {
213
213
  };
214
214
  /**
215
215
  * USED INTERNALLY - performs a similar operation to {@link SciChartSurface.create} but used internally for testing
216
- * @param divElementId
216
+ * @param divElement The Div Element ID or reference where the {@link SciChartSurface} will reside
217
217
  * @param options - optional parameters for chart creation. See {@link I2DSurfaceOptions} for more details
218
218
  */
219
- SciChartSurface.createSingle = function (divElementId, options) {
219
+ SciChartSurface.createSingle = function (divElement, options) {
220
220
  (0, chartBuilder_1.ensureRegistrations)();
221
221
  options = SciChartSurface.resolveOptions(options);
222
222
  if (app_1.IS_TEST_ENV) {
223
- return this.createTest(divElementId, options);
223
+ return this.createTest(divElement, options);
224
224
  }
225
225
  else {
226
- return (0, createSingle_1.createSingleInternal)(divElementId, options).then(function (result) {
226
+ return (0, createSingle_1.createSingleInternal)(divElement, options).then(function (result) {
227
227
  result.sciChartSurface.applyOptions(options);
228
228
  return result;
229
229
  });
@@ -246,9 +246,9 @@ var SciChartSurface = /** @class */ (function (_super) {
246
246
  exports.sciChartConfig.dataUrl = (_a = config === null || config === void 0 ? void 0 : config.dataUrl) !== null && _a !== void 0 ? _a : undefined;
247
247
  exports.sciChartConfig.wasmUrl = (_b = config === null || config === void 0 ? void 0 : config.wasmUrl) !== null && _b !== void 0 ? _b : undefined;
248
248
  };
249
- SciChartSurface.createTest = function (divElementId, options) {
249
+ SciChartSurface.createTest = function (divElement, options) {
250
250
  var _a, _b;
251
- var canvases = sciChartInitCommon_1.default.initCanvas(divElementId, (_a = options === null || options === void 0 ? void 0 : options.widthAspect) !== null && _a !== void 0 ? _a : 0, (_b = options === null || options === void 0 ? void 0 : options.heightAspect) !== null && _b !== void 0 ? _b : 0, sciChartInitCommon_1.default.ECanvasType.canvas2D);
251
+ var canvases = sciChartInitCommon_1.default.initCanvas(divElement, (_a = options === null || options === void 0 ? void 0 : options.widthAspect) !== null && _a !== void 0 ? _a : 0, (_b = options === null || options === void 0 ? void 0 : options.heightAspect) !== null && _b !== void 0 ? _b : 0, sciChartInitCommon_1.default.ECanvasType.canvas2D);
252
252
  var sciChartSurface = new SciChartSurface(exports.sciChartConfig.testWasm, { canvases: canvases });
253
253
  sciChartSurface.applyTheme(options === null || options === void 0 ? void 0 : options.theme);
254
254
  sciChartSurface.applyOptions(options);
@@ -385,13 +385,20 @@ var SciChartSurface = /** @class */ (function (_super) {
385
385
  // Logger.log("SciChartSurface.isSuspended = true. Ignoring invalidateElement() call");
386
386
  return;
387
387
  }
388
+ // console.log("Invalidating ", this.domChartRoot.id);
388
389
  var canvasId = this.domCanvas2D ? this.domCanvas2D.id : "undefinedCanvasId";
389
390
  this.renderSurface.invalidateElement(canvasId);
390
391
  };
391
392
  // Step_5: Get context and pass drawing to SciChartRenderer
392
393
  SciChartSurface.prototype.doDrawingLoop = function () {
393
394
  var context = this.renderSurface.getRenderContext();
394
- this.sciChartRenderer.render(context);
395
+ try {
396
+ // console.log("Drawing ", this.domChartRoot.id);
397
+ this.sciChartRenderer.render(context);
398
+ }
399
+ catch (err) {
400
+ console.error("Error from chart in div ".concat(this.domChartRoot.id), err);
401
+ }
395
402
  };
396
403
  /**
397
404
  * @inheritDoc
@@ -662,8 +669,6 @@ var SciChartSurface = /** @class */ (function (_super) {
662
669
  if (!animation.isComplete) {
663
670
  animation.update(timeElapsed);
664
671
  if (!animation.isComplete) {
665
- // Request another draw to advance animation
666
- this.invalidateElement();
667
672
  remainingAnimations.push(animation);
668
673
  }
669
674
  }