scichart 3.3.560 → 3.3.567

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 (47) hide show
  1. package/Builder/buildSurface.d.ts +1 -1
  2. package/Builder/buildSurface.js +27 -14
  3. package/Charting/ChartModifiers/CursorModifier.js +3 -0
  4. package/Charting/ChartModifiers/RolloverModifier.js +3 -0
  5. package/Charting/Model/XyDataSeries.js +7 -0
  6. package/Charting/Services/SciChartRenderer.d.ts +1 -0
  7. package/Charting/Services/SciChartRenderer.js +19 -3
  8. package/Charting/Visuals/I2DSurfaceOptions.d.ts +5 -0
  9. package/Charting/Visuals/RenderableSeries/DrawingProviders/BaseSeriesDrawingProvider.js +4 -2
  10. package/Charting/Visuals/SciChartDefaults.d.ts +5 -0
  11. package/Charting/Visuals/SciChartDefaults.js +5 -0
  12. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.d.ts +1 -1
  13. package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.js +6 -3
  14. package/Charting/Visuals/SciChartSurface.d.ts +14 -2
  15. package/Charting/Visuals/SciChartSurface.js +57 -5
  16. package/Charting/Visuals/SciChartSurfaceBase.d.ts +20 -5
  17. package/Charting/Visuals/SciChartSurfaceBase.js +100 -18
  18. package/Charting/Visuals/UpdateSuspender.d.ts +7 -3
  19. package/Charting/Visuals/UpdateSuspender.js +38 -8
  20. package/Charting/Visuals/copyCanvasUtils.d.ts +5 -0
  21. package/Charting/Visuals/copyCanvasUtils.js +24 -0
  22. package/Charting/Visuals/createMaster.js +25 -9
  23. package/Charting/Visuals/createSingle.js +10 -0
  24. package/Charting/Visuals/licenseManager2D.d.ts +1 -1
  25. package/Charting/Visuals/licenseManager2D.js +3 -3
  26. package/Charting/Visuals/sciChartInitCommon.js +5 -2
  27. package/Charting3D/Visuals/SciChart3DRenderer.d.ts +1 -0
  28. package/Charting3D/Visuals/SciChart3DRenderer.js +10 -1
  29. package/Charting3D/Visuals/SciChart3DSurface.d.ts +1 -0
  30. package/Charting3D/Visuals/SciChart3DSurface.js +28 -2
  31. package/Charting3D/Visuals/createMaster3d.js +2 -1
  32. package/Core/BuildStamp.d.ts +1 -1
  33. package/Core/BuildStamp.js +2 -2
  34. package/Core/Mouse/MouseManager.js +12 -7
  35. package/_wasm/scichart.browser.js +1 -1
  36. package/_wasm/scichart2d.js +1 -1
  37. package/_wasm/scichart2d.wasm +0 -0
  38. package/_wasm/scichart3d.js +1 -1
  39. package/_wasm/scichart3d.wasm +0 -0
  40. package/index.d.ts +2 -2
  41. package/index.dev.js +477 -63
  42. package/index.js +14 -12
  43. package/index.min.js +1 -1
  44. package/package.json +1 -1
  45. package/utils/logger.js +10 -1
  46. package/utils/perfomance.d.ts +139 -0
  47. package/utils/perfomance.js +150 -0
@@ -14,8 +14,44 @@ var __extends = (this && this.__extends) || (function () {
14
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
15
  };
16
16
  })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (_) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
17
53
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.getLocateFile = exports.copyToCanvas = exports.getMasterCanvas = exports.createChartDestination = exports.SciChartSurfaceBase = exports.ESurfaceType = exports.DebugForDpi = void 0;
54
+ exports.getLocateFile = exports.getMasterCanvas = exports.createChartDestination = exports.SciChartSurfaceBase = exports.ESurfaceType = exports.DebugForDpi = void 0;
19
55
  var classFactory_1 = require("../../Builder/classFactory");
20
56
  var licenseManager2D_1 = require("../../Charting/Visuals/licenseManager2D");
21
57
  var licenseManager3D_1 = require("../../Charting3D/Visuals/licenseManager3D");
@@ -32,6 +68,7 @@ var BaseType_1 = require("../../types/BaseType");
32
68
  var array_1 = require("../../utils/array");
33
69
  var guid_1 = require("../../utils/guid");
34
70
  var MemoryUsageHelper_1 = require("../../utils/MemoryUsageHelper");
71
+ var perfomance_1 = require("../../utils/perfomance");
35
72
  var ChartModifierBase_1 = require("../ChartModifiers/ChartModifierBase");
36
73
  var SciChartJSDarkv2Theme_1 = require("../Themes/SciChartJSDarkv2Theme");
37
74
  var DpiHelper_1 = require("./TextureManager/DpiHelper");
@@ -153,6 +190,9 @@ var SciChartSurfaceBase = /** @class */ (function (_super) {
153
190
  catch (err) {
154
191
  console.warn(err);
155
192
  }
193
+ if (perfomance_1.PerformanceDebugHelper.enableDebug) {
194
+ _this.enableRenderListener();
195
+ }
156
196
  return _this;
157
197
  }
158
198
  /**
@@ -360,13 +400,22 @@ var SciChartSurfaceBase = /** @class */ (function (_super) {
360
400
  SciChartSurfaceBase.prototype.resumeUpdates = function (suspender) {
361
401
  if (suspender.shouldResumeTarget) {
362
402
  this.invalidateElement();
403
+ if (suspender === this.suspender) {
404
+ this.suspender = undefined;
405
+ }
363
406
  }
364
407
  };
408
+ SciChartSurfaceBase.prototype.resume = function () {
409
+ var _a;
410
+ (_a = this.suspender) === null || _a === void 0 ? void 0 : _a.resume();
411
+ };
365
412
  /**
366
413
  * @inheritDoc
367
414
  */
368
415
  SciChartSurfaceBase.prototype.suspendUpdates = function () {
369
- return new UpdateSuspender_1.UpdateSuspender(this);
416
+ this.suspender = new UpdateSuspender_1.UpdateSuspender(this);
417
+ this.addDeletable(this.suspender);
418
+ return this.suspender;
370
419
  };
371
420
  /**
372
421
  * @inheritDoc
@@ -464,6 +513,47 @@ var SciChartSurfaceBase = /** @class */ (function (_super) {
464
513
  this.modifierAnnotations.asArray().forEach(function (a) { return a.onDpiChanged(args); });
465
514
  this.invalidateElement();
466
515
  };
516
+ /**
517
+ * Creates a promise which resolves when the chart is updated to the next fully rendered state
518
+ *
519
+ * @remarks
520
+ * If the surface is initialized with `createSingle` the promise resolves after the main `render` function is executed.
521
+ * Otherwise, if it is initialized with `create` - the promise resolves after image data is copied to the 2D canvas.
522
+ */
523
+ SciChartSurfaceBase.prototype.nextStateRender = function (options) {
524
+ return __awaiter(this, void 0, void 0, function () {
525
+ var _this = this;
526
+ return __generator(this, function (_a) {
527
+ return [2 /*return*/, new Promise(function (resolve, reject) {
528
+ var listener = function (isInvalidated) {
529
+ try {
530
+ if (!isInvalidated) {
531
+ if (options === null || options === void 0 ? void 0 : options.suspendAfter) {
532
+ var nextSuspender = _this.suspendUpdates();
533
+ resolve(nextSuspender);
534
+ }
535
+ else {
536
+ resolve(null);
537
+ }
538
+ _this.rendered.unsubscribe(listener);
539
+ }
540
+ }
541
+ catch (err) {
542
+ console.error(err);
543
+ reject(err);
544
+ }
545
+ };
546
+ _this.rendered.subscribe(listener);
547
+ if (options === null || options === void 0 ? void 0 : options.resumeBefore) {
548
+ _this.resume();
549
+ if (options === null || options === void 0 ? void 0 : options.invalidateOnResume) {
550
+ _this.invalidateElement();
551
+ }
552
+ }
553
+ })];
554
+ });
555
+ });
556
+ };
467
557
  Object.defineProperty(SciChartSurfaceBase.prototype, "chartModifierGroups", {
468
558
  get: function () {
469
559
  var arr = this.chartModifiers
@@ -475,6 +565,14 @@ var SciChartSurfaceBase = /** @class */ (function (_super) {
475
565
  enumerable: false,
476
566
  configurable: true
477
567
  });
568
+ SciChartSurfaceBase.prototype.enableRenderListener = function () {
569
+ var _this = this;
570
+ var listener = function (isInvalidated) {
571
+ perfomance_1.PerformanceDebugHelper.mark(isInvalidated ? perfomance_1.EPerformanceMarkType.Rendered : perfomance_1.EPerformanceMarkType.FullStateRendered, { contextId: _this.id });
572
+ };
573
+ this.rendered.subscribe(listener);
574
+ this.addDeletable({ delete: function () { return _this.rendered.unsubscribe(listener); } });
575
+ };
478
576
  SciChartSurfaceBase.prototype.clearRootElement = function (clearHtml) {
479
577
  if (clearHtml && this.domChartRoot) {
480
578
  var style = this.domChartRoot.style;
@@ -659,22 +757,6 @@ var getMasterCanvas = function () {
659
757
  return SciChartSurfaceBase.domMasterCanvas;
660
758
  };
661
759
  exports.getMasterCanvas = getMasterCanvas;
662
- var copyToCanvas = function (sourceCanvas, getDestinationById) { return function (destinationId) {
663
- var destination = getDestinationById(destinationId);
664
- var destinationCanvas = destination === null || destination === void 0 ? void 0 : destination.sciChartSurface.domCanvas2D;
665
- if (destinationCanvas) {
666
- var destinationCanvasContext = destinationCanvas.getContext("2d");
667
- destinationCanvasContext.clearRect(0, 0, destinationCanvasContext.canvas.width, destinationCanvasContext.canvas.height);
668
- destinationCanvasContext.drawImage(sourceCanvas, 0, 0);
669
- // destinationCanvasContext.drawImage(sourceCanvas,
670
- // 0, 0,
671
- // sourceCanvas.width,
672
- // sourceCanvas.height,
673
- // 0, 0,
674
- // destinationCanvas.clientWidth, destinationCanvas.clientHeight);
675
- }
676
- }; };
677
- exports.copyToCanvas = copyToCanvas;
678
760
  /** @ignore */
679
761
  var getLocateFile = function (sciChartConfig) { return function (path, prefix) {
680
762
  if (path.endsWith(".wasm") && sciChartConfig.wasmUrl) {
@@ -1,4 +1,6 @@
1
+ import { DeletableEntity } from "../../Core/DeletableEntity";
1
2
  import { Dictionary } from "../../Core/Dictionary";
3
+ import { IDeletable } from "../../Core/IDeletable";
2
4
  /**
3
5
  * Types which implement ISuspendable can have updates suspended/resumed. Useful for batch operations.
4
6
  */
@@ -30,7 +32,7 @@ export interface ISuspendable {
30
32
  /**
31
33
  * Defines the interface to an {@link UpdateSuspender}, a class which allows nested suspend/resume operations on an {@link ISuspendable} target
32
34
  */
33
- export interface IUpdateSuspender {
35
+ export interface IUpdateSuspender extends IDeletable {
34
36
  /**
35
37
  * Gets or sets a value indicating whether the target will resume when the
36
38
  * {@link IUpdateSuspender.resume} function is called is disposed. Default is True
@@ -52,7 +54,7 @@ declare type SuspendedInstance = {
52
54
  /**
53
55
  * A class which allows nested suspend/resume operations on an {@link ISuspendable} target
54
56
  */
55
- export declare class UpdateSuspender implements IUpdateSuspender {
57
+ export declare class UpdateSuspender extends DeletableEntity implements IUpdateSuspender {
56
58
  /**
57
59
  * USED INTERNALLY: A map of string Id to Suspended instances
58
60
  */
@@ -71,7 +73,7 @@ export declare class UpdateSuspender implements IUpdateSuspender {
71
73
  */
72
74
  static using(target: ISuspendable, batchOperation: () => void): void;
73
75
  private readonly resumeTargetProperty;
74
- private readonly targetProperty;
76
+ private targetProperty;
75
77
  /**
76
78
  * Creates an instance of an {@link UpdateSuspender}
77
79
  * @param target The target that we want to suspend. Multiple nested suspend/resumes are permitted
@@ -90,6 +92,8 @@ export declare class UpdateSuspender implements IUpdateSuspender {
90
92
  * Call this to resume drawing on the target {@link ISuspendable}
91
93
  */
92
94
  resume(): void;
95
+ delete(): void;
96
+ protected remove(): void;
93
97
  private increment;
94
98
  private decrement;
95
99
  }
@@ -1,12 +1,29 @@
1
1
  "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
2
17
  Object.defineProperty(exports, "__esModule", { value: true });
3
18
  exports.UpdateSuspender = void 0;
19
+ var DeletableEntity_1 = require("../../Core/DeletableEntity");
4
20
  var Dictionary_1 = require("../../Core/Dictionary");
5
21
  var Guard_1 = require("../../Core/Guard");
6
22
  /**
7
23
  * A class which allows nested suspend/resume operations on an {@link ISuspendable} target
8
24
  */
9
- var UpdateSuspender = /** @class */ (function () {
25
+ var UpdateSuspender = /** @class */ (function (_super) {
26
+ __extends(UpdateSuspender, _super);
10
27
  /**
11
28
  * Creates an instance of an {@link UpdateSuspender}
12
29
  * @param target The target that we want to suspend. Multiple nested suspend/resumes are permitted
@@ -14,14 +31,20 @@ var UpdateSuspender = /** @class */ (function () {
14
31
  */
15
32
  function UpdateSuspender(target, shouldResumeTarget) {
16
33
  if (shouldResumeTarget === void 0) { shouldResumeTarget = true; }
17
- this.resumeTargetProperty = shouldResumeTarget;
18
- this.targetProperty = target;
19
- if (!UpdateSuspender.suspendedInstances.containsKey(this.targetProperty.suspendableId)) {
20
- UpdateSuspender.suspendedInstances.add(target.suspendableId, { id: target.suspendableId, suspendable: target, suspendCount: 1 });
34
+ var _this = _super.call(this) || this;
35
+ _this.resumeTargetProperty = shouldResumeTarget;
36
+ _this.targetProperty = target;
37
+ if (!UpdateSuspender.suspendedInstances.containsKey(_this.targetProperty.suspendableId)) {
38
+ UpdateSuspender.suspendedInstances.add(target.suspendableId, {
39
+ id: target.suspendableId,
40
+ suspendable: target,
41
+ suspendCount: 1
42
+ });
21
43
  }
22
44
  else {
23
- this.increment(target);
45
+ _this.increment(target);
24
46
  }
47
+ return _this;
25
48
  }
26
49
  /**
27
50
  * Get whether the provided {@link ISuspendable} instance is suspended or not
@@ -73,10 +96,17 @@ var UpdateSuspender = /** @class */ (function () {
73
96
  UpdateSuspender.prototype.resume = function () {
74
97
  this.targetProperty.decrementSuspend();
75
98
  if (this.decrement(this.targetProperty) === 0) {
76
- UpdateSuspender.suspendedInstances.remove(this.targetProperty.suspendableId);
99
+ this.remove();
77
100
  this.targetProperty.resumeUpdates(this);
78
101
  }
79
102
  };
103
+ UpdateSuspender.prototype.delete = function () {
104
+ this.remove();
105
+ this.targetProperty = undefined;
106
+ };
107
+ UpdateSuspender.prototype.remove = function () {
108
+ UpdateSuspender.suspendedInstances.remove(this.targetProperty.suspendableId);
109
+ };
80
110
  UpdateSuspender.prototype.increment = function (target) {
81
111
  UpdateSuspender.suspendedInstances.item(target.suspendableId).suspendCount++;
82
112
  };
@@ -91,5 +121,5 @@ var UpdateSuspender = /** @class */ (function () {
91
121
  */
92
122
  UpdateSuspender.suspendedInstances = new Dictionary_1.Dictionary();
93
123
  return UpdateSuspender;
94
- }());
124
+ }(DeletableEntity_1.DeletableEntity));
95
125
  exports.UpdateSuspender = UpdateSuspender;
@@ -0,0 +1,5 @@
1
+ import type { TSciChartDestination } from "./SciChartSurfaceBase";
2
+ /** @ignore */
3
+ export declare type TGetDestinationFn = (destinationId: string) => TSciChartDestination;
4
+ /** @ignore */
5
+ export declare const copyToCanvas: (sourceCanvas: HTMLCanvasElement, getDestinationById: TGetDestinationFn) => (destinationId: string) => void;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.copyToCanvas = void 0;
4
+ var logger_1 = require("../../utils/logger");
5
+ /** @ignore */
6
+ var copyToCanvas = function (sourceCanvas, getDestinationById) { return function (destinationId) {
7
+ logger_1.Logger.debug("copyToCanvas");
8
+ var destination = getDestinationById(destinationId);
9
+ var sciChartSurface = destination === null || destination === void 0 ? void 0 : destination.sciChartSurface;
10
+ var destinationCanvas = destination === null || destination === void 0 ? void 0 : destination.sciChartSurface.domCanvas2D;
11
+ if (destinationCanvas) {
12
+ var destinationCanvasContext = destinationCanvas.getContext("2d");
13
+ destinationCanvasContext.clearRect(0, 0, destinationCanvasContext.canvas.width, destinationCanvasContext.canvas.height);
14
+ destinationCanvasContext.drawImage(sourceCanvas, 0, 0);
15
+ // destinationCanvasContext.drawImage(sourceCanvas,
16
+ // 0, 0,
17
+ // sourceCanvas.width,
18
+ // sourceCanvas.height,
19
+ // 0, 0,
20
+ // destinationCanvas.clientWidth, destinationCanvas.clientHeight);
21
+ sciChartSurface.rendered.raiseEvent(sciChartSurface.isInvalidated);
22
+ }
23
+ }; };
24
+ exports.copyToCanvas = copyToCanvas;
@@ -54,6 +54,9 @@ var NativeObject_1 = require("./Helpers/NativeObject");
54
54
  var LabelCache_1 = require("./Axis/LabelProvider/LabelCache");
55
55
  var MemoryUsageHelper_1 = require("../../utils/MemoryUsageHelper");
56
56
  var WebGlHelper_1 = require("../../Core/WebGlHelper");
57
+ var logger_1 = require("../../utils/logger");
58
+ var copyCanvasUtils_1 = require("./copyCanvasUtils");
59
+ var perfomance_1 = require("../../utils/perfomance");
57
60
  // Global variables
58
61
  /** @ignore */
59
62
  var sciChartMaster = {
@@ -85,8 +88,15 @@ var createMultichart = function (divElement, options) { return __awaiter(void 0,
85
88
  sciChartSurface_1 = createChildSurface(divElementId, canvases, options === null || options === void 0 ? void 0 : options.theme);
86
89
  return [2 /*return*/, new Promise(function (resolve) {
87
90
  setTimeout(function () {
91
+ var _a;
92
+ if ((_a = options === null || options === void 0 ? void 0 : options.createSuspended) !== null && _a !== void 0 ? _a : SciChartDefaults_1.SciChartDefaults.createSuspended) {
93
+ // // @ts-ignore
94
+ // sciChartSurface.createSuspended = true;
95
+ sciChartSurface_1.suspendUpdates();
96
+ }
88
97
  loader.removeChartLoader(canvases.domDivContainer, loaderDiv);
89
98
  loaderDiv = undefined;
99
+ sciChartSurface_1.setIsInitialized();
90
100
  resolve({ wasmContext: wasmContext_1, sciChartSurface: sciChartSurface_1 });
91
101
  }, 0);
92
102
  })];
@@ -115,10 +125,12 @@ var getSharedWasmContext = function () { return __awaiter(void 0, void 0, void 0
115
125
  }); };
116
126
  exports.getSharedWasmContext = getSharedWasmContext;
117
127
  var initializeChartEngine2D = function () { return __awaiter(void 0, void 0, void 0, function () {
118
- var master;
119
- return __generator(this, function (_a) {
120
- switch (_a.label) {
128
+ var mark, master;
129
+ var _a;
130
+ return __generator(this, function (_b) {
131
+ switch (_b.label) {
121
132
  case 0:
133
+ mark = perfomance_1.PerformanceDebugHelper.mark(perfomance_1.EPerformanceMarkType.EngineInitStart);
122
134
  WebGlHelper_1.WebGlHelper.initialize();
123
135
  if (!(!sciChartMaster.wasmContext || !sciChartMaster.createChildSurface || !sciChartMaster.getChildSurfaces)) return [3 /*break*/, 2];
124
136
  if (!sciChartMasterPromise) {
@@ -127,14 +139,16 @@ var initializeChartEngine2D = function () { return __awaiter(void 0, void 0, voi
127
139
  }
128
140
  return [4 /*yield*/, sciChartMasterPromise];
129
141
  case 1:
130
- master = _a.sent();
142
+ master = _b.sent();
131
143
  sciChartMaster.wasmContext = master.wasmContext;
132
144
  (0, BuildStamp_1.checkBuildStamp)(master.wasmContext);
133
145
  sciChartMaster.createChildSurface = master.createChildSurface;
134
146
  sciChartMaster.getChildSurfaces = master.getChildSurfaces;
135
147
  (0, exports.monitorWebGL)(master.wasmContext);
136
- _a.label = 2;
137
- case 2: return [2 /*return*/, sciChartMasterPromise];
148
+ _b.label = 2;
149
+ case 2:
150
+ perfomance_1.PerformanceDebugHelper.mark(perfomance_1.EPerformanceMarkType.EngineInitEnd, { relatedId: (_a = mark === null || mark === void 0 ? void 0 : mark.detail) === null || _a === void 0 ? void 0 : _a.relatedId });
151
+ return [2 /*return*/, sciChartMasterPromise];
138
152
  }
139
153
  });
140
154
  }); };
@@ -232,7 +246,7 @@ var createMaster = function () {
232
246
  var frameRenderer2D = new wasmContext.SCRTFrameRenderer2D();
233
247
  /// create an object that native side can trigger the copy to from...
234
248
  var canvasCopyObj = wasmContext.SCRTCopyToDestinationInterface.implement({
235
- CopyToDestination: (0, SciChartSurfaceBase_1.copyToCanvas)(SciChartSurfaceBase_1.SciChartSurfaceBase.domMasterCanvas, getDestinationById)
249
+ CopyToDestination: (0, copyCanvasUtils_1.copyToCanvas)(SciChartSurfaceBase_1.SciChartSurfaceBase.domMasterCanvas, getDestinationById)
236
250
  });
237
251
  var getChildSurfaces = function () { return Globals_1.sciChartDestinations.map(function (el) { return el.sciChartSurface; }); };
238
252
  // Create of replace child surface
@@ -297,19 +311,21 @@ var createMaster = function () {
297
311
  wasmContext.canvas = canvas;
298
312
  var chartInitializer = {
299
313
  InitializeChart: function () {
314
+ logger_1.Logger.debug("InitializeChart");
300
315
  resolve({ getChildSurfaces: getChildSurfaces, createChildSurface: createChildSurface, wasmContext: wasmContext });
301
316
  },
302
317
  Draw: function (canvasId) {
318
+ logger_1.Logger.debug("Draw", canvasId);
303
319
  var dest = Globals_1.sciChartDestinations.find(function (d) { return d.canvasElementId === canvasId; });
304
320
  if (dest) {
305
321
  dest.sciChartSurface.renderSurface.onRenderTimeElapsed();
306
322
  }
307
323
  },
308
324
  Update: function (deltaTime) {
309
- // Logger.log("sciChartInitCommon.ts Update");
325
+ logger_1.Logger.debug("sciChartInitCommon.ts Update", deltaTime);
310
326
  },
311
327
  ShutDownChart: function () {
312
- // Logger.log("sciChartInitCommon.ts ShutDownChart");
328
+ logger_1.Logger.debug("sciChartInitCommon.ts ShutDownChart");
313
329
  }
314
330
  };
315
331
  var chartInitObj = wasmContext.SCRTSampleChartInterface.implement(chartInitializer);
@@ -18,6 +18,7 @@ var DeletableEntity_1 = require("../../Core/DeletableEntity");
18
18
  var Globals_1 = require("../../Core/Globals");
19
19
  var LabelCache_1 = require("./Axis/LabelProvider/LabelCache");
20
20
  var createMaster_1 = require("./createMaster");
21
+ var perfomance_1 = require("../../utils/perfomance");
21
22
  // Global variables
22
23
  /** @ignore */
23
24
  var createSingleInternal = function (divElement, options) {
@@ -26,6 +27,7 @@ var createSingleInternal = function (divElement, options) {
26
27
  var canvases = sciChartInitCommon_1.default.initCanvas(divElement, options === null || options === void 0 ? void 0 : options.widthAspect, options === null || options === void 0 ? void 0 : options.heightAspect, undefined, options === null || options === void 0 ? void 0 : options.disableAspect, options === null || options === void 0 ? void 0 : options.touchAction);
27
28
  var loader = (_a = options === null || options === void 0 ? void 0 : options.loader) !== null && _a !== void 0 ? _a : new loader_1.DefaultSciChartLoader();
28
29
  var loaderDiv = loader.addChartLoader(canvases.domDivContainer, options === null || options === void 0 ? void 0 : options.theme);
30
+ perfomance_1.PerformanceDebugHelper.mark(perfomance_1.EPerformanceMarkType.EngineInitStart);
29
31
  var webGLSupport = WebGlHelper_1.WebGlHelper.getWebGlSupport();
30
32
  // console.log("webGLSupport", webGLSupport);
31
33
  if (webGLSupport === WebGlHelper_1.EWebGLSupport.WebGL2 || webGLSupport === WebGlHelper_1.EWebGLSupport.WebGL1) {
@@ -41,6 +43,12 @@ var createSingleInternal = function (divElement, options) {
41
43
  // if (process.env.NODE_ENV !== "production") {
42
44
  var revocable = (0, DeletableEntity_1.createWasmContextRevocableProxy)(wasmContext);
43
45
  var customResolve = function (res) {
46
+ var _a;
47
+ if ((_a = options === null || options === void 0 ? void 0 : options.createSuspended) !== null && _a !== void 0 ? _a : SciChartDefaults_1.SciChartDefaults.createSuspended) {
48
+ // // @ts-ignore
49
+ // sciChartSurface.createSuspended = true;
50
+ res.sciChartSurface.suspendUpdates();
51
+ }
44
52
  res.sciChartSurface.addDeletable({
45
53
  delete: function () {
46
54
  revocable.revoke();
@@ -107,6 +115,7 @@ var initDrawEngineSingleChart = function (wasmContext, canvases, resolve, theme)
107
115
  var unsub = sciChartInitCommon_1.default.subscribeToResize(canvases.domChartRoot, canvases.aspect, scs, canvases.disableAspect);
108
116
  scs.addDeletable(unsub);
109
117
  scs.addDeletable((0, NativeObject_1.freeCache)(wasmContext));
118
+ scs.setIsInitialized();
110
119
  resolve({ wasmContext: wasmContext, sciChartSurface: scs });
111
120
  }, 0);
112
121
  },
@@ -127,5 +136,6 @@ var initDrawEngineSingleChart = function (wasmContext, canvases, resolve, theme)
127
136
  wasmContext.SCRTSetGlobalSampleChartInterface(chartInitObj);
128
137
  // @ts-ignore
129
138
  wasmContext.callMain();
139
+ perfomance_1.PerformanceDebugHelper.mark(perfomance_1.EPerformanceMarkType.EngineInitEnd, { contextId: scs === null || scs === void 0 ? void 0 : scs.id });
130
140
  };
131
141
  exports.initDrawEngineSingleChart = initDrawEngineSingleChart;
@@ -35,7 +35,7 @@ interface ILicenseCookie {
35
35
  }
36
36
  export declare const getLicenseCookie: () => ILicenseCookie;
37
37
  export declare const forceReapplyLicense2D: () => void;
38
- export declare const applyLicense: (licenseContext: TLicenseContext, sciChartSurface: ISciChartSurfaceBase) => void;
38
+ export declare const applyLicense: (licenseContext: TLicenseContext, sciChartSurface?: ISciChartSurfaceBase) => void;
39
39
  export declare type TLicenseContext = {
40
40
  SCRTCredentials: {
41
41
  GetLicenseType: () => SCRTLicenseType;
@@ -433,7 +433,7 @@ var applyLicense2D = function (licenseContext, sciChartSurface, isSingle) {
433
433
  shouldApplyLicense2D = false;
434
434
  };
435
435
  var applyLicense = function (licenseContext, sciChartSurface) {
436
- var _a, _b;
436
+ var _a, _b, _c, _d;
437
437
  debug("applyLicense running");
438
438
  var licenseKey = "";
439
439
  var lt = licenseContext.SCRTCredentials.GetLicenseType();
@@ -467,7 +467,7 @@ var applyLicense = function (licenseContext, sciChartSurface) {
467
467
  }
468
468
  else {
469
469
  var errorMsg = licenseContext.SCRTCredentials.GetLicenseErrors();
470
- if ((window && ((_a = window.location) === null || _a === void 0 ? void 0 : _a.hostname) && !window.location.hostname.includes("localhost")) ||
470
+ if ((window && ((_a = window.location) === null || _a === void 0 ? void 0 : _a.hostname) && !((_c = (_b = window.location) === null || _b === void 0 ? void 0 : _b.hostname) === null || _c === void 0 ? void 0 : _c.includes("localhost"))) ||
471
471
  !errorMsg.startsWith("License is not valid for this domain")) {
472
472
  if (isDebug) {
473
473
  debug("Runtime license is invalid: " + errorMsg);
@@ -566,7 +566,7 @@ var applyLicense = function (licenseContext, sciChartSurface) {
566
566
  console.log("Defaulting to SciChart Community Edition. Usage constitutes acceptance of our EULA and terms at https://www.scichart.com/community-licensing. See https://store.scichart.com for commercial licensing options.");
567
567
  var daysRemaining = licenseContext.SCRTCredentials.GetLicenseDaysRemaining();
568
568
  console.log("The community license is valid for 6 months from the date the version in use was released. This version ".concat(BuildStamp_1.libraryVersion, " has ").concat(daysRemaining, " day").concat(daysRemaining === 1 ? "" : "s", " remaining"));
569
- if (!app_1.IS_TEST_ENV && ((_b = document === null || document === void 0 ? void 0 : document.location) === null || _b === void 0 ? void 0 : _b.hostname.startsWith("localhost")) && useLicenseWizard) {
569
+ if (!app_1.IS_TEST_ENV && ((_d = document === null || document === void 0 ? void 0 : document.location) === null || _d === void 0 ? void 0 : _d.hostname.startsWith("localhost")) && useLicenseWizard) {
570
570
  console.log("SciChart is looking for a paid developer activation from the scichart licensing wizard... To disable this call SciChartSurface.UseCommunityLicense()");
571
571
  }
572
572
  communityNotice = true;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var WebGlHelper_1 = require("../../Core/WebGlHelper");
4
+ var perfomance_1 = require("../../utils/perfomance");
4
5
  var SciChartSurfaceBase_1 = require("./SciChartSurfaceBase");
5
6
  var DpiHelper_1 = require("./TextureManager/DpiHelper");
6
7
  var ECanvasType;
@@ -211,10 +212,12 @@ var subscribeToResize = function (chartRoot, aspect, sciChartSurface, disableAsp
211
212
  newHeight = maxHeight;
212
213
  }
213
214
  var isNotZero = newWidth !== 0 && newHeight !== 0;
214
- var isChanged = sciChartSurface.domCanvas2D.width !== newWidth || sciChartSurface.domCanvas2D.height !== newHeight;
215
+ var isChanged = sciChartSurface.domCanvas2D.width !== newWidth * DpiHelper_1.DpiHelper.PIXEL_RATIO ||
216
+ sciChartSurface.domCanvas2D.height !== newHeight * DpiHelper_1.DpiHelper.PIXEL_RATIO;
215
217
  if (isNotZero && isChanged) {
216
218
  // We use setTimeout to fix "ResizeObserver loop limit exceeded" issue which occurs in Electron app
217
219
  setTimeout(function () {
220
+ perfomance_1.PerformanceDebugHelper.mark(perfomance_1.EPerformanceMarkType.Resize, { contextId: sciChartSurface.id });
218
221
  sciChartSurface.changeViewportSize(newWidth, newHeight);
219
222
  }, 0);
220
223
  }
@@ -224,7 +227,7 @@ var subscribeToResize = function (chartRoot, aspect, sciChartSurface, disableAsp
224
227
  _loop_1(entry);
225
228
  }
226
229
  });
227
- resizeObserver.observe(chartRoot);
230
+ resizeObserver.observe(chartRoot, { box: "border-box" });
228
231
  // Return an IDeletable which will unsubscribe
229
232
  var unsub = { delete: function () { return resizeObserver.disconnect(); } };
230
233
  return unsub;
@@ -23,6 +23,7 @@ export declare class SciChart3DRenderer {
23
23
  * @param scs the {@link SciChart3DSurface} we are drawing
24
24
  */
25
25
  static tryPerformAutoRangeOn(axis: AxisBase3D, scs: SciChart3DSurface): void;
26
+ isInvalidated: boolean;
26
27
  private readonly scs;
27
28
  private wasmContext;
28
29
  private prevRect;
@@ -16,6 +16,7 @@ var Guard_1 = require("../../Core/Guard");
16
16
  var Rect_1 = require("../../Core/Rect");
17
17
  var AutoRange_1 = require("../../types/AutoRange");
18
18
  var WatermarkPosition_1 = require("../../types/WatermarkPosition");
19
+ var perfomance_1 = require("../../utils/perfomance");
19
20
  var AxisCubeDescriptor_1 = require("./Primitives/AxisCubeDescriptor");
20
21
  var RenderPassInfo3D_1 = require("./Primitives/RenderPassInfo3D");
21
22
  var SceneDescriptor_1 = require("./Primitives/SceneDescriptor");
@@ -24,6 +25,7 @@ var SceneDescriptor_1 = require("./Primitives/SceneDescriptor");
24
25
  */
25
26
  var SciChart3DRenderer = /** @class */ (function () {
26
27
  function SciChart3DRenderer(scs, wasmContext) {
28
+ this.isInvalidated = false;
27
29
  Guard_1.Guard.notNull(scs, "scs");
28
30
  this.scs = scs;
29
31
  this.wasmContext = wasmContext;
@@ -76,6 +78,7 @@ var SciChart3DRenderer = /** @class */ (function () {
76
78
  * The main render loop
77
79
  */
78
80
  SciChart3DRenderer.prototype.render = function () {
81
+ var _a;
79
82
  if (this.scs.isDeleted || !this.scs.isInitialized) {
80
83
  return;
81
84
  }
@@ -83,6 +86,8 @@ var SciChart3DRenderer = /** @class */ (function () {
83
86
  if (!this.isSurfaceValid(this.scs)) {
84
87
  throw Error("SciChart3DSurface is not valid");
85
88
  }
89
+ var mark = perfomance_1.PerformanceDebugHelper.mark(perfomance_1.EPerformanceMarkType.RenderStart, { contextId: this.scs.id });
90
+ this.isInvalidated = false;
86
91
  // Enable/disable hit test as required.
87
92
  this.scs.webAssemblyContext3D.SCRTSetIsSelectionBufferEnabled(this.scs.isHitTestEnabled);
88
93
  // Step 1: Update the current active SceneWorld and camera
@@ -97,7 +102,7 @@ var SciChart3DRenderer = /** @class */ (function () {
97
102
  var tsrCamera = sceneWorld.GetMainCamera();
98
103
  var typescriptCamera = this.scs.camera;
99
104
  typescriptCamera.updateEngineCamera(tsrCamera);
100
- var _a = this.scs.viewportManager, width = _a.width, height = _a.height;
105
+ var _b = this.scs.viewportManager, width = _b.width, height = _b.height;
101
106
  var viewRect = new Rect_1.Rect(0, 0, width, height);
102
107
  this.scs.setSeriesViewRect(viewRect);
103
108
  // Animation Step
@@ -124,6 +129,10 @@ var SciChart3DRenderer = /** @class */ (function () {
124
129
  svgAnnotations.forEach(function (svg) { return svg.update(undefined, undefined, 0, 0); });
125
130
  // We add the same padding as we have for 2D 6px
126
131
  this.updateWatermark();
132
+ perfomance_1.PerformanceDebugHelper.mark(perfomance_1.EPerformanceMarkType.RenderEnd, {
133
+ contextId: this.scs.id,
134
+ relatedId: (_a = mark === null || mark === void 0 ? void 0 : mark.detail) === null || _a === void 0 ? void 0 : _a.relatedId
135
+ });
127
136
  // Step 6: Notify that scene is about to be drawn
128
137
  this.scs.onSciChartRendered();
129
138
  // Invalidate for the animations
@@ -294,6 +294,7 @@ export declare class SciChart3DSurface extends SciChartSurfaceBase {
294
294
  * @inheritDoc
295
295
  */
296
296
  get surfaceType(): ESurfaceType;
297
+ get isInvalidated(): boolean;
297
298
  /**
298
299
  * Called after the {@link SciChart3DSurface} has rendered.
299
300
  */