scichart 2.0.2179 → 2.0.2195

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.
@@ -24,6 +24,10 @@ export interface ICursorModifierOptions extends IChartModifierBaseOptions {
24
24
  showAxisLabels?: boolean;
25
25
  axisLabelStroke?: string;
26
26
  axisLabelFill?: string;
27
+ xAxisLabelStroke?: string;
28
+ xAxisLabelFill?: string;
29
+ yAxisLabelStroke?: string;
30
+ yAxisLabelFill?: string;
27
31
  tooltipLegendTemplate?: TCursorTooltipSvgTemplate | string;
28
32
  tooltipLegendOffsetX?: number;
29
33
  tooltipLegendOffsetY?: number;
@@ -70,13 +74,29 @@ export declare class CursorModifier extends ChartModifierBase2D implements IIncl
70
74
  */
71
75
  showAxisLabels: boolean;
72
76
  /**
73
- * Gets or sets the axis label text color as an HTML Color code
77
+ * Gets or sets both axiseslabel text color as an HTML Color code
74
78
  */
75
79
  axisLabelStroke: string;
76
80
  /**
77
- * Gets or sets the axis label fill as an HTML Color code.
81
+ * Gets or sets both axises label fill as an HTML Color code.
78
82
  */
79
83
  axisLabelFill: string;
84
+ /**
85
+ * Gets or sets the xAxis label text color as an HTML Color code
86
+ */
87
+ xAxisLabelStroke: string;
88
+ /**
89
+ * Gets or sets the xAxis label fill as an HTML Color code.
90
+ */
91
+ xAxisLabelFill: string;
92
+ /**
93
+ * Gets or sets the xAxis label text color as an HTML Color code
94
+ */
95
+ yAxisLabelStroke: string;
96
+ /**
97
+ * Gets or sets the xAxis label fill as an HTML Color code.
98
+ */
99
+ yAxisLabelFill: string;
80
100
  /**
81
101
  * Gets or sets the template for the legend
82
102
  */
@@ -97,7 +117,10 @@ export declare class CursorModifier extends ChartModifierBase2D implements IIncl
97
117
  private tooltipDataTemplateProperty?;
98
118
  private includedSeriesMap;
99
119
  /**
100
- * Creates an instance of the RolloverModifier
120
+ * Creates an instance of the CursorModifier
121
+ *
122
+ * If number of renderable series is more then 10 and showTooltip enabled consider passing {@link TCursorTooltipDataTemplate} or {@link TCursorTooltipSvgTemplate} to reduce the output for the tooltip
123
+ *
101
124
  * @param options Optional parameters {@link ICursorModifierOptions} used to configure the modifier
102
125
  */
103
126
  constructor(options?: ICursorModifierOptions);
@@ -44,11 +44,14 @@ var constants_1 = require("./constants");
44
44
  var CursorModifier = /** @class */ (function (_super) {
45
45
  __extends(CursorModifier, _super);
46
46
  /**
47
- * Creates an instance of the RolloverModifier
47
+ * Creates an instance of the CursorModifier
48
+ *
49
+ * If number of renderable series is more then 10 and showTooltip enabled consider passing {@link TCursorTooltipDataTemplate} or {@link TCursorTooltipSvgTemplate} to reduce the output for the tooltip
50
+ *
48
51
  * @param options Optional parameters {@link ICursorModifierOptions} used to configure the modifier
49
52
  */
50
53
  function CursorModifier(options) {
51
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
54
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
52
55
  var _this = _super.call(this, options) || this;
53
56
  _this.type = ChartModifierType_1.EChart2DModifierType.Cursor;
54
57
  _this.tooltipSvgTemplate = defaultTooltipTemplate;
@@ -77,13 +80,29 @@ var CursorModifier = /** @class */ (function (_super) {
77
80
  */
78
81
  _this.showAxisLabels = true;
79
82
  /**
80
- * Gets or sets the axis label text color as an HTML Color code
83
+ * Gets or sets both axiseslabel text color as an HTML Color code
81
84
  */
82
85
  _this.axisLabelStroke = "#fff";
83
86
  /**
84
- * Gets or sets the axis label fill as an HTML Color code.
87
+ * Gets or sets both axises label fill as an HTML Color code.
85
88
  */
86
89
  _this.axisLabelFill = "#228B22";
90
+ /**
91
+ * Gets or sets the xAxis label text color as an HTML Color code
92
+ */
93
+ _this.xAxisLabelStroke = undefined;
94
+ /**
95
+ * Gets or sets the xAxis label fill as an HTML Color code.
96
+ */
97
+ _this.xAxisLabelFill = undefined;
98
+ /**
99
+ * Gets or sets the xAxis label text color as an HTML Color code
100
+ */
101
+ _this.yAxisLabelStroke = undefined;
102
+ /**
103
+ * Gets or sets the xAxis label fill as an HTML Color code.
104
+ */
105
+ _this.yAxisLabelFill = undefined;
87
106
  /**
88
107
  * Gets or sets the legend X offset
89
108
  */
@@ -110,8 +129,12 @@ var CursorModifier = /** @class */ (function (_super) {
110
129
  _this.tooltipTextStroke = (_f = options === null || options === void 0 ? void 0 : options.tooltipTextStroke) !== null && _f !== void 0 ? _f : _this.tooltipTextStroke;
111
130
  _this.showTooltip = (_g = options === null || options === void 0 ? void 0 : options.showTooltip) !== null && _g !== void 0 ? _g : _this.showTooltip;
112
131
  _this.showAxisLabels = (_h = options === null || options === void 0 ? void 0 : options.showAxisLabels) !== null && _h !== void 0 ? _h : _this.showAxisLabels;
113
- _this.axisLabelStroke = (_j = options === null || options === void 0 ? void 0 : options.axisLabelStroke) !== null && _j !== void 0 ? _j : _this.axisLabelStroke;
114
- _this.axisLabelFill = (_k = options === null || options === void 0 ? void 0 : options.axisLabelFill) !== null && _k !== void 0 ? _k : _this.axisLabelFill;
132
+ _this.axisLabelFill = (_j = options === null || options === void 0 ? void 0 : options.axisLabelFill) !== null && _j !== void 0 ? _j : _this.axisLabelFill;
133
+ _this.axisLabelStroke = (_k = options === null || options === void 0 ? void 0 : options.axisLabelStroke) !== null && _k !== void 0 ? _k : _this.axisLabelStroke;
134
+ _this.xAxisLabelStroke = (_l = options === null || options === void 0 ? void 0 : options.xAxisLabelStroke) !== null && _l !== void 0 ? _l : _this.xAxisLabelStroke;
135
+ _this.xAxisLabelFill = (_m = options === null || options === void 0 ? void 0 : options.xAxisLabelFill) !== null && _m !== void 0 ? _m : _this.xAxisLabelFill;
136
+ _this.yAxisLabelStroke = (_o = options === null || options === void 0 ? void 0 : options.yAxisLabelStroke) !== null && _o !== void 0 ? _o : _this.yAxisLabelStroke;
137
+ _this.yAxisLabelFill = (_p = options === null || options === void 0 ? void 0 : options.yAxisLabelFill) !== null && _p !== void 0 ? _p : _this.yAxisLabelFill;
115
138
  if (options === null || options === void 0 ? void 0 : options.tooltipLegendTemplate) {
116
139
  if (typeof options.tooltipLegendTemplate === "string") {
117
140
  _this.typeMap.set("tooltipLegendTemplate", options.tooltipLegendTemplate);
@@ -120,9 +143,9 @@ var CursorModifier = /** @class */ (function (_super) {
120
143
  }
121
144
  }
122
145
  _this.tooltipLegendTemplate =
123
- (_l = options === null || options === void 0 ? void 0 : options.tooltipLegendTemplate) !== null && _l !== void 0 ? _l : _this.tooltipLegendTemplate;
124
- _this.tooltipLegendOffsetX = (_m = options === null || options === void 0 ? void 0 : options.tooltipLegendOffsetX) !== null && _m !== void 0 ? _m : _this.tooltipLegendOffsetX;
125
- _this.tooltipLegendOffsetY = (_o = options === null || options === void 0 ? void 0 : options.tooltipLegendOffsetY) !== null && _o !== void 0 ? _o : _this.tooltipLegendOffsetY;
146
+ (_q = options === null || options === void 0 ? void 0 : options.tooltipLegendTemplate) !== null && _q !== void 0 ? _q : _this.tooltipLegendTemplate;
147
+ _this.tooltipLegendOffsetX = (_r = options === null || options === void 0 ? void 0 : options.tooltipLegendOffsetX) !== null && _r !== void 0 ? _r : _this.tooltipLegendOffsetX;
148
+ _this.tooltipLegendOffsetY = (_s = options === null || options === void 0 ? void 0 : options.tooltipLegendOffsetY) !== null && _s !== void 0 ? _s : _this.tooltipLegendOffsetY;
126
149
  if (options === null || options === void 0 ? void 0 : options.tooltipDataTemplate) {
127
150
  if (typeof options.tooltipDataTemplate === "string") {
128
151
  _this.typeMap.set("tooltipDataTemplate", options.tooltipDataTemplate);
@@ -131,7 +154,7 @@ var CursorModifier = /** @class */ (function (_super) {
131
154
  }
132
155
  }
133
156
  _this.tooltipDataTemplateProperty =
134
- (_p = options === null || options === void 0 ? void 0 : options.tooltipDataTemplate) !== null && _p !== void 0 ? _p : _this.tooltipDataTemplateProperty;
157
+ (_t = options === null || options === void 0 ? void 0 : options.tooltipDataTemplate) !== null && _t !== void 0 ? _t : _this.tooltipDataTemplateProperty;
135
158
  return _this;
136
159
  }
137
160
  /**
@@ -148,8 +171,12 @@ var CursorModifier = /** @class */ (function (_super) {
148
171
  CursorModifier.prototype.onAttach = function () {
149
172
  var _a;
150
173
  _super.prototype.onAttach.call(this);
151
- this.xLineAnnotation = this.newLineAnnotation();
152
- this.yLineAnnotation = this.newLineAnnotation();
174
+ var xAxisLabelFill = this.xAxisLabelFill ? this.xAxisLabelFill : this.axisLabelFill;
175
+ var yAxisLabelFill = this.yAxisLabelFill ? this.yAxisLabelFill : this.axisLabelFill;
176
+ var xAxisLabelStroke = this.xAxisLabelStroke ? this.xAxisLabelStroke : this.axisLabelStroke;
177
+ var yAxisLabelStroke = this.yAxisLabelStroke ? this.yAxisLabelStroke : this.axisLabelStroke;
178
+ this.xLineAnnotation = this.newLineAnnotation(xAxisLabelFill, xAxisLabelStroke);
179
+ this.yLineAnnotation = this.newLineAnnotation(yAxisLabelFill, yAxisLabelStroke);
153
180
  this.tooltipAnnotation = new CursorTooltipSvgAnnotation_1.CursorTooltipSvgAnnotation({
154
181
  cursorModifier: this,
155
182
  xCoordinateMode: AnnotationBase_1.ECoordinateMode.Pixel,
@@ -299,6 +326,10 @@ var CursorModifier = /** @class */ (function (_super) {
299
326
  var options = {
300
327
  axisLabelFill: this.axisLabelFill,
301
328
  axisLabelStroke: this.axisLabelStroke,
329
+ xAxisLabelFill: this.xAxisLabelFill,
330
+ xAxisLabelStroke: this.xAxisLabelStroke,
331
+ yAxisLabelFill: this.yAxisLabelFill,
332
+ yAxisLabelStroke: this.yAxisLabelStroke,
302
333
  crosshairStroke: this.crosshairStroke,
303
334
  crosshairStrokeDashArray: this.crosshairStrokeDashArray,
304
335
  crosshairStrokeThickness: this.crosshairStrokeThickness,
@@ -383,7 +414,7 @@ var CursorModifier = /** @class */ (function (_super) {
383
414
  }
384
415
  }
385
416
  };
386
- CursorModifier.prototype.newLineAnnotation = function () {
417
+ CursorModifier.prototype.newLineAnnotation = function (axisLabelFill, axisLabelStroke) {
387
418
  return new LineAnnotation_1.LineAnnotation({
388
419
  xCoordinateMode: AnnotationBase_1.ECoordinateMode.Pixel,
389
420
  yCoordinateMode: AnnotationBase_1.ECoordinateMode.Pixel,
@@ -392,8 +423,8 @@ var CursorModifier = /** @class */ (function (_super) {
392
423
  stroke: this.crosshairStroke,
393
424
  isHidden: true,
394
425
  showLabel: this.showAxisLabels,
395
- axisLabelFill: this.axisLabelFill,
396
- axisLabelStroke: this.axisLabelStroke,
426
+ axisLabelFill: axisLabelFill,
427
+ axisLabelStroke: axisLabelStroke,
397
428
  xAxisId: this.xAxisId,
398
429
  yAxisId: this.yAxisId
399
430
  });
@@ -87,7 +87,11 @@ var TextureWorkerWrapper = /** @class */ (function () {
87
87
  var _this = this;
88
88
  this.timeout = 200;
89
89
  this.isActiveProperty = true;
90
- if (!app_1.IS_TEST_ENV && typeof window !== "undefined" && !!window.Worker) {
90
+ if (!app_1.IS_TEST_ENV &&
91
+ typeof window !== "undefined" &&
92
+ !!window.Worker &&
93
+ // @ts-ignore
94
+ typeof OffscreenCanvas !== "undefined") {
91
95
  this.worker = this.makeWorker(); // new Worker("./TextureWorkerSource.ts", { type: "module" });
92
96
  this.worker.onmessage = handleMsg;
93
97
  this.worker.onerror = function (ev) {
@@ -42,7 +42,7 @@ export declare class CursorTooltipSvgAnnotation extends SvgAnnotationBase {
42
42
  /**
43
43
  * Gets or sets seriesInfos {@link SeriesInfo} value on the tooltip
44
44
  */
45
- set seriesInfos(value: SeriesInfo[]);
45
+ set seriesInfos(newSeriesInfos: SeriesInfo[]);
46
46
  get title(): string;
47
47
  set title(value: string);
48
48
  get tooltipSvgTemplate(): TCursorTooltipSvgTemplate;
@@ -56,13 +56,16 @@ var CursorTooltipSvgAnnotation = /** @class */ (function (_super) {
56
56
  /**
57
57
  * Gets or sets seriesInfos {@link SeriesInfo} value on the tooltip
58
58
  */
59
- set: function (value) {
60
- if (this.seriesInfosProperty && value) {
59
+ set: function (newSeriesInfos) {
60
+ if (this.seriesInfosProperty && newSeriesInfos) {
61
61
  // Compare infos against the ones for the matching series. See if any are different
62
- if (this.seriesInfos
63
- .map(function (si) { return si.equals(value.find(function (o) { return o.renderableSeries.id === si.renderableSeries.id; })); })
64
- .find(function (a) { return !a; })) {
65
- this.seriesInfosProperty = value;
62
+ if (newSeriesInfos.length !== this.seriesInfosProperty.length ||
63
+ this.seriesInfosProperty
64
+ .map(function (seriesInfo) {
65
+ return seriesInfo.equals(newSeriesInfos.find(function (newSeriesInfo) { return newSeriesInfo.renderableSeries.id === seriesInfo.renderableSeries.id; }));
66
+ })
67
+ .some(function (sameSeriesInfo) { return sameSeriesInfo === false; })) {
68
+ this.seriesInfosProperty = newSeriesInfos;
66
69
  this.notifyPropertyChanged(constants_1.PROPERTY.SERIES_INFOS);
67
70
  }
68
71
  }
@@ -981,6 +981,8 @@ var AxisBase2D = /** @class */ (function (_super) {
981
981
  };
982
982
  AxisBase2D.prototype.getMaxXRange = function () {
983
983
  var maximumRange = this.getXDataRange();
984
+ if (!maximumRange)
985
+ return undefined;
984
986
  // TODO: Coerce a zero range
985
987
  if (this.growBy) {
986
988
  maximumRange = maximumRange.growBy(this.growBy);
@@ -277,6 +277,8 @@ var LogarithmicAxis = /** @class */ (function (_super) {
277
277
  };
278
278
  LogarithmicAxis.prototype.getMaxXRange = function () {
279
279
  var maximumRange = this.getXDataRange();
280
+ if (!maximumRange)
281
+ return undefined;
280
282
  // TODO: Coerce a zero range
281
283
  if (this.growBy && maximumRange) {
282
284
  maximumRange = maximumRange.growByLog(this.growBy, this.logBase);
@@ -662,8 +662,6 @@ var SciChartSurface = /** @class */ (function (_super) {
662
662
  if (!animation.isComplete) {
663
663
  animation.update(timeElapsed);
664
664
  if (!animation.isComplete) {
665
- // Request another draw to advance animation
666
- this.invalidateElement();
667
665
  remainingAnimations.push(animation);
668
666
  }
669
667
  }
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.sciChartDestinations = exports.createMultichart = void 0;
40
40
  // @ts-ignore
41
41
  var WasmModule2D = require("../../_wasm/scichart2d");
42
+ var BuildStamp_1 = require("../../Core/BuildStamp");
42
43
  var Guard_1 = require("../../Core/Guard");
43
44
  var WebGlRenderContext2D_1 = require("../Drawing/WebGlRenderContext2D");
44
45
  var licenseManager2D_1 = require("./licenseManager2D");
@@ -57,7 +58,7 @@ var sciChartMaster = {
57
58
  var sciChartMasterPromise;
58
59
  /** @ignore */
59
60
  var createMultichart = function (divElementId, options) { return __awaiter(void 0, void 0, void 0, function () {
60
- var canvases, loader, loaderDiv, master, createChildSurface, wasmContext, sciChartSurface;
61
+ var canvases, loader, loaderDiv, master, createChildSurface, wasmContext_1, sciChartSurface_1, err_1;
61
62
  var _a, _b, _c;
62
63
  return __generator(this, function (_d) {
63
64
  switch (_d.label) {
@@ -66,27 +67,38 @@ var createMultichart = function (divElementId, options) { return __awaiter(void
66
67
  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);
67
68
  loader = (_c = options === null || options === void 0 ? void 0 : options.loader) !== null && _c !== void 0 ? _c : new loader_1.DefaultSciChartLoader();
68
69
  loaderDiv = loader.addChartLoader(canvases.domDivContainer, options === null || options === void 0 ? void 0 : options.theme);
69
- if (!(!sciChartMaster.wasmContext || !sciChartMaster.createChildSurface || !sciChartMaster.getChildSurfaces)) return [3 /*break*/, 2];
70
+ _d.label = 1;
71
+ case 1:
72
+ _d.trys.push([1, 4, , 5]);
73
+ if (!(!sciChartMaster.wasmContext || !sciChartMaster.createChildSurface || !sciChartMaster.getChildSurfaces)) return [3 /*break*/, 3];
70
74
  if (!sciChartMasterPromise) {
71
75
  sciChartMasterPromise = createMaster();
72
76
  }
73
77
  return [4 /*yield*/, sciChartMasterPromise];
74
- case 1:
78
+ case 2:
75
79
  master = _d.sent();
76
80
  sciChartMaster.wasmContext = master.wasmContext;
81
+ (0, BuildStamp_1.checkBuildStamp)(master.wasmContext);
77
82
  sciChartMaster.createChildSurface = master.createChildSurface;
78
83
  sciChartMaster.getChildSurfaces = master.getChildSurfaces;
79
84
  monitorWebGL(sciChartMaster);
80
- _d.label = 2;
81
- case 2:
82
- createChildSurface = sciChartMaster.createChildSurface, wasmContext = sciChartMaster.wasmContext;
83
- sciChartSurface = createChildSurface(divElementId, canvases, options === null || options === void 0 ? void 0 : options.theme);
85
+ _d.label = 3;
86
+ case 3:
87
+ createChildSurface = sciChartMaster.createChildSurface, wasmContext_1 = sciChartMaster.wasmContext;
88
+ sciChartSurface_1 = createChildSurface(divElementId, canvases, options === null || options === void 0 ? void 0 : options.theme);
84
89
  return [2 /*return*/, new Promise(function (resolve) {
85
90
  setTimeout(function () {
86
91
  loader.removeChartLoader(canvases.domDivContainer, loaderDiv);
87
- resolve({ wasmContext: wasmContext, sciChartSurface: sciChartSurface });
92
+ resolve({ wasmContext: wasmContext_1, sciChartSurface: sciChartSurface_1 });
88
93
  }, 0);
89
94
  })];
95
+ case 4:
96
+ err_1 = _d.sent();
97
+ console.error(err_1);
98
+ // replace with div with error message
99
+ loader.removeChartLoader(canvases.domDivContainer, loaderDiv);
100
+ return [2 /*return*/, Promise.reject(err_1)];
101
+ case 5: return [2 /*return*/];
90
102
  }
91
103
  });
92
104
  }); };
@@ -145,12 +157,13 @@ var createMaster = function () {
145
157
  chartInitObj.SetFPSCounterEnabled(false);
146
158
  exports.sciChartDestinations.push({ canvasElementId: canvasElementId, sciChartSurface: sciChartSurface, width: width, height: height });
147
159
  };
148
- return new Promise(function (resolve) {
160
+ return new Promise(function (resolve, reject) {
149
161
  // make sure canvas has event listener for context creation error
150
162
  var canvas = (0, SciChartSurfaceBase_1.getMasterCanvas)();
151
163
  var locateFile = (0, SciChartSurfaceBase_1.getLocateFile)(SciChartSurface_1.sciChartConfig);
152
164
  // @ts-ignore
153
- new WasmModule2D({ locateFile: locateFile, noInitialRun: true }).then(function (wasmContext) {
165
+ new WasmModule2D({ locateFile: locateFile, noInitialRun: true })
166
+ .then(function (wasmContext) {
154
167
  var getChildSurfaces = function () { return exports.sciChartDestinations.map(function (el) { return el.sciChartSurface; }); };
155
168
  // Create of replace child surface
156
169
  var createChildSurface = function (divElementId, canvases, theme) {
@@ -205,6 +218,9 @@ var createMaster = function () {
205
218
  wasmContext.TSRSetDrawRequestsEnabled(true);
206
219
  // @ts-ignore
207
220
  wasmContext.callMain();
221
+ })
222
+ .catch(function () {
223
+ reject("Could not load SciChart WebAssembly module.\n Check your build process and ensure that your scichart2d.wasm, scichart2d.data and scichart2d.js files are from the same version");
208
224
  });
209
225
  });
210
226
  };
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initDrawEngineSingleChart = exports.createSingleInternal = exports.sciChartSingleDestinations = void 0;
4
4
  // @ts-ignore
5
5
  var WasmModule2D = require("../../_wasm/scichart2d");
6
+ var BuildStamp_1 = require("../../Core/BuildStamp");
6
7
  var Guard_1 = require("../../Core/Guard");
7
8
  var WebGlHelper_1 = require("../../Core/WebGlHelper");
8
9
  var logger_1 = require("../../utils/logger");
@@ -15,7 +16,7 @@ var SciChartSurfaceBase_1 = require("./SciChartSurfaceBase");
15
16
  exports.sciChartSingleDestinations = [];
16
17
  /** @ignore */
17
18
  var createSingleInternal = function (divElementId, options) {
18
- return new Promise(function (resolve) {
19
+ return new Promise(function (resolve, reject) {
19
20
  var _a;
20
21
  var canvases = sciChartInitCommon_1.default.initCanvas(divElementId, options === null || options === void 0 ? void 0 : options.widthAspect, options === null || options === void 0 ? void 0 : options.heightAspect);
21
22
  var loader = (_a = options === null || options === void 0 ? void 0 : options.loader) !== null && _a !== void 0 ? _a : new loader_1.DefaultSciChartLoader();
@@ -25,11 +26,17 @@ var createSingleInternal = function (divElementId, options) {
25
26
  if (webGLSupport === WebGlHelper_1.EWebGLSupport.WebGL2 || webGLSupport === WebGlHelper_1.EWebGLSupport.WebGL1) {
26
27
  var locateFile = (0, SciChartSurfaceBase_1.getLocateFile)(SciChartSurface_1.sciChartConfig);
27
28
  // @ts-ignore
28
- new WasmModule2D({ locateFile: locateFile, noInitialRun: true }).then(function (wasmContext) {
29
+ new WasmModule2D({ locateFile: locateFile, noInitialRun: true })
30
+ .then(function (wasmContext) {
29
31
  loader.removeChartLoader(canvases.domDivContainer, loaderDiv);
30
32
  // @ts-ignore
31
33
  wasmContext.doNotCaptureKeyboard = true;
32
34
  (0, exports.initDrawEngineSingleChart)(wasmContext, canvases, resolve, options === null || options === void 0 ? void 0 : options.theme);
35
+ (0, BuildStamp_1.checkBuildStamp)(wasmContext);
36
+ })
37
+ .catch(function () {
38
+ loader.removeChartLoader(canvases.domDivContainer, loaderDiv);
39
+ reject("Could not load SciChart WebAssembly module.\n Check your build process and ensure that your scichart2d.wasm, scichart2d.data and scichart2d.js files are from the same version");
33
40
  });
34
41
  }
35
42
  else {
@@ -38,6 +38,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.licenseManager = exports.updateLicenseDisplay = exports.getLicenseInfo = exports.applyLicense = exports.getLicenseCookie = exports.setCallbacks3D = exports.setUseLicenseWizard = exports.setRuntimeLicenseKey = exports.setLicenseCallback = exports.setDependencies = void 0;
40
40
  var app_1 = require("../../constants/app");
41
+ var BuildStamp_1 = require("../../Core/BuildStamp");
41
42
  var Dictionary_1 = require("../../Core/Dictionary");
42
43
  var Color_1 = require("../../types/Color");
43
44
  var licensingClasses_1 = require("../../types/licensingClasses");
@@ -110,6 +111,7 @@ var debug = function (message) {
110
111
  licenseDependencies.debug(message);
111
112
  }
112
113
  };
114
+ debug("SciChart version " + BuildStamp_1.libraryVersion);
113
115
  // tslint:disable: no-console
114
116
  var licenseCallback;
115
117
  var setLicenseCallback = function (callback) {
@@ -43,6 +43,7 @@ var chartBuilder_1 = require("../../Builder/chartBuilder");
43
43
  var loader_1 = require("../../Charting/Visuals/loader");
44
44
  var sciChartInitCommon_1 = require("../../Charting/Visuals/sciChartInitCommon");
45
45
  var SciChartSurfaceBase_1 = require("../../Charting/Visuals/SciChartSurfaceBase");
46
+ var BuildStamp_1 = require("../../Core/BuildStamp");
46
47
  var licenseManager3D_1 = require("./licenseManager3D");
47
48
  var SciChart3DSurface_1 = require("./SciChart3DSurface");
48
49
  /** @ignore */
@@ -55,7 +56,7 @@ var sciChartMaster3D = {
55
56
  var sciChartMaster3DPromise;
56
57
  /** @ignore */
57
58
  var createMultichart3d = function (divElementId, options) { return __awaiter(void 0, void 0, void 0, function () {
58
- var canvases, loader, loaderDiv, master, createChildSurface, wasmContext, sciChart3DSurface;
59
+ var canvases, loader, loaderDiv, master, createChildSurface, wasmContext_1, sciChart3DSurface_1, err_1;
59
60
  var _a, _b, _c, _d, _e;
60
61
  return __generator(this, function (_f) {
61
62
  switch (_f.label) {
@@ -63,29 +64,42 @@ var createMultichart3d = function (divElementId, options) { return __awaiter(voi
63
64
  (0, chartBuilder_1.ensureRegistrations)();
64
65
  sciChartInitCommon_1.default.checkChartDivExists(divElementId);
65
66
  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);
66
- if (!(!sciChartMaster3D.wasmContext || !sciChartMaster3D.createChildSurface || !sciChartMaster3D.getChildSurfaces)) return [3 /*break*/, 2];
67
+ loader = (_c = options === null || options === void 0 ? void 0 : options.loader) !== null && _c !== void 0 ? _c : new loader_1.DefaultSciChartLoader();
68
+ loaderDiv = loader.addChartLoader(canvases.domDivContainer, (_d = options === null || options === void 0 ? void 0 : options.theme) !== null && _d !== void 0 ? _d : SciChartSurfaceBase_1.SciChartSurfaceBase.DEFAULT_THEME);
69
+ _f.label = 1;
70
+ case 1:
71
+ _f.trys.push([1, 4, , 5]);
72
+ if (!(!sciChartMaster3D.wasmContext ||
73
+ !sciChartMaster3D.createChildSurface ||
74
+ !sciChartMaster3D.getChildSurfaces)) return [3 /*break*/, 3];
67
75
  if (!sciChartMaster3DPromise) {
68
76
  sciChartMaster3DPromise = createMaster();
69
77
  }
70
- loader = (_c = options === null || options === void 0 ? void 0 : options.loader) !== null && _c !== void 0 ? _c : new loader_1.DefaultSciChartLoader();
71
- loaderDiv = loader.addChartLoader(canvases.domDivContainer, (_d = options === null || options === void 0 ? void 0 : options.theme) !== null && _d !== void 0 ? _d : SciChartSurfaceBase_1.SciChartSurfaceBase.DEFAULT_THEME);
72
78
  return [4 /*yield*/, sciChartMaster3DPromise];
73
- case 1:
79
+ case 2:
74
80
  master = _f.sent();
75
- loader.removeChartLoader(canvases.domDivContainer, loaderDiv);
81
+ (0, BuildStamp_1.checkBuildStamp)(master.wasmContext);
76
82
  sciChartMaster3D.wasmContext = master.wasmContext;
77
83
  sciChartMaster3D.createChildSurface = master.createChildSurface;
78
84
  sciChartMaster3D.getChildSurfaces = master.getChildSurfaces;
79
- _f.label = 2;
80
- case 2:
81
- createChildSurface = sciChartMaster3D.createChildSurface, wasmContext = sciChartMaster3D.wasmContext;
82
- sciChart3DSurface = createChildSurface(divElementId, canvases, (_e = options === null || options === void 0 ? void 0 : options.theme) !== null && _e !== void 0 ? _e : SciChartSurfaceBase_1.SciChartSurfaceBase.DEFAULT_THEME);
85
+ _f.label = 3;
86
+ case 3:
87
+ createChildSurface = sciChartMaster3D.createChildSurface, wasmContext_1 = sciChartMaster3D.wasmContext;
88
+ sciChart3DSurface_1 = createChildSurface(divElementId, canvases, (_e = options === null || options === void 0 ? void 0 : options.theme) !== null && _e !== void 0 ? _e : SciChartSurfaceBase_1.SciChartSurfaceBase.DEFAULT_THEME);
83
89
  return [2 /*return*/, new Promise(function (resolve) {
84
90
  setTimeout(function () {
85
- sciChart3DSurface.setIsInitialized();
86
- resolve({ wasmContext: wasmContext, sciChart3DSurface: sciChart3DSurface });
91
+ loader.removeChartLoader(canvases.domDivContainer, loaderDiv);
92
+ sciChart3DSurface_1.setIsInitialized();
93
+ resolve({ wasmContext: wasmContext_1, sciChart3DSurface: sciChart3DSurface_1 });
87
94
  }, 0);
88
95
  })];
96
+ case 4:
97
+ err_1 = _f.sent();
98
+ console.error(err_1);
99
+ // replace with div with error message
100
+ loader.removeChartLoader(canvases.domDivContainer, loaderDiv);
101
+ return [2 /*return*/, Promise.reject(err_1)];
102
+ case 5: return [2 /*return*/];
89
103
  }
90
104
  });
91
105
  }); };
@@ -112,10 +126,11 @@ var createMaster = function () {
112
126
  chartInitObj3D.AddDestination(dest);
113
127
  exports.sciChartDestinations.push({ canvasElementId: canvasElementId, sciChartSurface: sciChartSurface, width: width, height: height });
114
128
  };
115
- return new Promise(function (resolve) {
129
+ return new Promise(function (resolve, reject) {
116
130
  var locateFile3d = (0, SciChartSurfaceBase_1.getLocateFile)(SciChart3DSurface_1.sciChartConfig3D);
117
131
  // @ts-ignore
118
- new WasmModule3D({ locateFile3d: locateFile3d, noInitialRun: true }).then(function (wasmContext) {
132
+ new WasmModule3D({ locateFile3d: locateFile3d, noInitialRun: true })
133
+ .then(function (wasmContext) {
119
134
  var getChildSurfaces = function () { return exports.sciChartDestinations.map(function (el) { return el.sciChartSurface; }); };
120
135
  // Create of replace child surface
121
136
  var createChildSurface = function (divElementId, canvases, theme) {
@@ -173,6 +188,9 @@ var createMaster = function () {
173
188
  wasmContext.TSRSetDrawRequestsEnabled(true);
174
189
  // @ts-ignore
175
190
  wasmContext.callMain();
191
+ })
192
+ .catch(function () {
193
+ reject("Could not load SciChart WebAssembly module.\n Check your build process and ensure that your scichart2d.wasm, scichart2d.data and scichart2d.js files are from the same version");
176
194
  });
177
195
  });
178
196
  };
@@ -7,28 +7,35 @@ var chartBuilder_1 = require("../../Builder/chartBuilder");
7
7
  var loader_1 = require("../../Charting/Visuals/loader");
8
8
  var sciChartInitCommon_1 = require("../../Charting/Visuals/sciChartInitCommon");
9
9
  var SciChartSurfaceBase_1 = require("../../Charting/Visuals/SciChartSurfaceBase");
10
+ var BuildStamp_1 = require("../../Core/BuildStamp");
10
11
  var WebGlHelper_1 = require("../../Core/WebGlHelper");
11
12
  var logger_1 = require("../../utils/logger");
12
13
  var licenseManager3D_1 = require("./licenseManager3D");
13
14
  var SciChart3DSurface_1 = require("./SciChart3DSurface");
14
15
  var createSingle3dInternal = function (divElementId, options) {
15
16
  (0, chartBuilder_1.ensureRegistrations)();
16
- return new Promise(function (resolve) {
17
+ return new Promise(function (resolve, reject) {
17
18
  var _a, _b, _c, _d;
18
19
  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);
19
20
  var loader = (_c = options === null || options === void 0 ? void 0 : options.loader) !== null && _c !== void 0 ? _c : new loader_1.DefaultSciChartLoader();
20
21
  var loaderDiv = loader.addChartLoader(canvases.domDivContainer, (_d = options === null || options === void 0 ? void 0 : options.theme) !== null && _d !== void 0 ? _d : SciChartSurfaceBase_1.SciChartSurfaceBase.DEFAULT_THEME);
21
22
  var webGLSupport = WebGlHelper_1.WebGlHelper.getWebGlSupport();
22
- console.log("webGLSupport", webGLSupport);
23
+ // console.log("webGLSupport", webGLSupport);
23
24
  if (webGLSupport === WebGlHelper_1.EWebGLSupport.WebGL2 || webGLSupport === WebGlHelper_1.EWebGLSupport.WebGL1) {
24
25
  var locateFile3d = (0, SciChartSurfaceBase_1.getLocateFile)(SciChart3DSurface_1.sciChartConfig3D);
25
26
  // @ts-ignore
26
- new WasmModule3D({ locateFile3d: locateFile3d, noInitialRun: true }).then(function (wasmContext) {
27
+ new WasmModule3D({ locateFile3d: locateFile3d, noInitialRun: true })
28
+ .then(function (wasmContext) {
27
29
  var _a;
28
30
  loader.removeChartLoader(canvases.domDivContainer, loaderDiv);
29
31
  // @ts-ignore
30
32
  wasmContext.doNotCaptureKeyboard = true;
31
33
  initDrawEngineSingleChart(wasmContext, canvases, resolve, (_a = options === null || options === void 0 ? void 0 : options.theme) !== null && _a !== void 0 ? _a : SciChartSurfaceBase_1.SciChartSurfaceBase.DEFAULT_THEME);
34
+ (0, BuildStamp_1.checkBuildStamp)(wasmContext);
35
+ })
36
+ .catch(function () {
37
+ loader.removeChartLoader(canvases.domDivContainer, loaderDiv);
38
+ reject("Could not load SciChart WebAssembly module.\n Check your build process and ensure that your scichart3d.wasm, scichart3d.data and scichart3d.js files are from the same version");
32
39
  });
33
40
  }
34
41
  else {
@@ -0,0 +1,4 @@
1
+ import { TSciChart } from "../types/TSciChart";
2
+ import { TSciChart3D } from "../types/TSciChart3D";
3
+ export declare const libraryVersion = "2.0.2195";
4
+ export declare const checkBuildStamp: (wasmContext: TSciChart | TSciChart3D) => boolean;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkBuildStamp = exports.libraryVersion = void 0;
4
+ var buildStamp = "2022-01-05T00:00:00";
5
+ var result;
6
+ // tslint:disable-next-line:no-var-requires
7
+ exports.libraryVersion = "2.0.2195";
8
+ var checkBuildStamp = function (wasmContext) {
9
+ if (result !== undefined)
10
+ return result;
11
+ if (!wasmContext)
12
+ return false;
13
+ if (wasmContext.SCRTCredentials.GetBuildStamp) {
14
+ if (wasmContext.SCRTCredentials.GetBuildStamp() === buildStamp) {
15
+ result = true;
16
+ return result;
17
+ }
18
+ }
19
+ console.warn("The SciChart webassembly module is from a different version than the javascript that is calling it.\n Ensure that your build process is copying the correct wasm and data files.");
20
+ result = false;
21
+ return result;
22
+ };
23
+ exports.checkBuildStamp = checkBuildStamp;