scichart 3.0.301 → 3.1.329
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.
- package/Charting/Drawing/Pen2DCache.d.ts +1 -1
- package/Charting/Drawing/Pen2DCache.js +3 -2
- package/Charting/Services/ChartTitleRenderer.d.ts +37 -0
- package/Charting/Services/ChartTitleRenderer.js +176 -0
- package/Charting/Services/SciChartRenderer.d.ts +7 -1
- package/Charting/Services/SciChartRenderer.js +60 -9
- package/Charting/Services/TitleRenderer.d.ts +91 -0
- package/Charting/Services/TitleRenderer.js +190 -0
- package/Charting/Themes/IThemeProvider.d.ts +16 -0
- package/Charting/Themes/SciChartJSDarkTheme.d.ts +2 -0
- package/Charting/Themes/SciChartJSDarkTheme.js +2 -0
- package/Charting/Themes/SciChartJSLightTheme.d.ts +2 -0
- package/Charting/Themes/SciChartJSLightTheme.js +2 -0
- package/Charting/Visuals/Annotations/AnnotationBase.d.ts +12 -1
- package/Charting/Visuals/Annotations/AnnotationBase.js +25 -2
- package/Charting/Visuals/Annotations/BoxAnnotation.js +1 -1
- package/Charting/Visuals/Annotations/NativeTextAnnotation.js +1 -5
- package/Charting/Visuals/Annotations/SvgAnnotationBase.js +2 -1
- package/Charting/Visuals/Axis/AxisBase2D.js +2 -2
- package/Charting/Visuals/Axis/AxisCore.d.ts +9 -1
- package/Charting/Visuals/Axis/AxisRenderer.d.ts +0 -1
- package/Charting/Visuals/Axis/AxisRenderer.js +7 -7
- package/Charting/Visuals/Axis/AxisTitleRenderer.d.ts +7 -2
- package/Charting/Visuals/Axis/AxisTitleRenderer.js +28 -2
- package/Charting/Visuals/Axis/LabelProvider/LabelProviderBase2D.d.ts +5 -12
- package/Charting/Visuals/Axis/LabelProvider/LabelProviderBase2D.js +8 -55
- package/Charting/Visuals/Axis/LabelProvider/TextLabelProvider.d.ts +0 -1
- package/Charting/Visuals/Axis/LabelProvider/TextLabelProvider.js +0 -60
- package/Charting/Visuals/I2DSurfaceOptions.d.ts +9 -0
- package/Charting/Visuals/RenderableSeries/FastColumnRenderableSeries.d.ts +2 -2
- package/Charting/Visuals/RenderableSeries/FastColumnRenderableSeries.js +2 -2
- package/Charting/Visuals/SciChartDefaults.d.ts +2 -3
- package/Charting/Visuals/SciChartDefaults.js +2 -3
- package/Charting/Visuals/SciChartSurface.d.ts +29 -0
- package/Charting/Visuals/SciChartSurface.js +100 -7
- package/Charting/Visuals/TextureManager/DpiHelper.js +1 -1
- package/Charting/Visuals/TextureManager/TextureManager.js +32 -17
- package/Charting3D/Visuals/SciChart3DSurface.js +6 -2
- package/Core/BuildStamp.d.ts +1 -1
- package/Core/BuildStamp.js +2 -2
- package/_wasm/scichart.browser.js +1 -1
- package/_wasm/scichart2d.js +7 -7
- package/_wasm/scichart2d.wasm +0 -0
- package/_wasm/scichart3d.js +16 -16
- package/_wasm/scichart3d.wasm +0 -0
- package/index.d.ts +14 -1
- package/index.js +21 -12
- package/index.min.js +1 -1
- package/package.json +1 -1
- package/types/NumberArray.js +2 -1
- package/types/TextStyle.d.ts +97 -0
- package/types/TextStyle.js +86 -0
- package/utils/imageUtil.js +1 -0
- package/utils/text.d.ts +8 -1
- package/utils/text.js +23 -1
- package/Charting/Services/Workers/TextureWorker.d.ts +0 -16
- package/Charting/Services/Workers/TextureWorker.js +0 -142
- package/Charting/Services/Workers/TextureWorkerSource.d.ts +0 -1
- package/Charting/Services/Workers/TextureWorkerSource.js +0 -133
|
@@ -65,7 +65,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
65
65
|
exports.LabelProviderBase2D = exports.LabelInfo = void 0;
|
|
66
66
|
var app_1 = require("../../../../constants/app");
|
|
67
67
|
var guid_1 = require("../../../../utils/guid");
|
|
68
|
-
var TextureWorker_1 = require("../../../Services/Workers/TextureWorker");
|
|
69
68
|
var NativeObject_1 = require("../../Helpers/NativeObject");
|
|
70
69
|
var SciChartDefaults_1 = require("../../SciChartDefaults");
|
|
71
70
|
var TextureManager_1 = require("../../TextureManager/TextureManager");
|
|
@@ -73,7 +72,6 @@ var LabelCache_1 = require("./LabelCache");
|
|
|
73
72
|
var LabelProvider_1 = require("./LabelProvider");
|
|
74
73
|
var LabelInfo = /** @class */ (function () {
|
|
75
74
|
function LabelInfo(tick, text, bitmapTexture, textureHeight, textureWidth) {
|
|
76
|
-
this.subs = [];
|
|
77
75
|
this.tick = tick;
|
|
78
76
|
this.text = text;
|
|
79
77
|
this.bitmapTexture = bitmapTexture;
|
|
@@ -81,13 +79,6 @@ var LabelInfo = /** @class */ (function () {
|
|
|
81
79
|
this.textureWidth = textureWidth;
|
|
82
80
|
this.lastUsed = Date.now();
|
|
83
81
|
}
|
|
84
|
-
LabelInfo.prototype.registerNotifier = function (callback) {
|
|
85
|
-
this.subs.push(callback);
|
|
86
|
-
};
|
|
87
|
-
LabelInfo.prototype.textureUpdated = function () {
|
|
88
|
-
this.subs.forEach(function (notifier) { return notifier(); });
|
|
89
|
-
this.subs = [];
|
|
90
|
-
};
|
|
91
82
|
return LabelInfo;
|
|
92
83
|
}());
|
|
93
84
|
exports.LabelInfo = LabelInfo;
|
|
@@ -99,7 +90,7 @@ var LabelProviderBase2D = /** @class */ (function (_super) {
|
|
|
99
90
|
__extends(LabelProviderBase2D, _super);
|
|
100
91
|
function LabelProviderBase2D(options) {
|
|
101
92
|
var _this = this;
|
|
102
|
-
var _a, _b, _c, _d
|
|
93
|
+
var _a, _b, _c, _d;
|
|
103
94
|
_this = _super.call(this, options) || this;
|
|
104
95
|
_this.useCache = !app_1.IS_TEST_ENV;
|
|
105
96
|
/**
|
|
@@ -114,9 +105,8 @@ var LabelProviderBase2D = /** @class */ (function (_super) {
|
|
|
114
105
|
_this.providerId = (0, guid_1.generateGuid)();
|
|
115
106
|
_this.rotationProperty = (_a = options === null || options === void 0 ? void 0 : options.rotation) !== null && _a !== void 0 ? _a : _this.rotationProperty;
|
|
116
107
|
_this.lineSpacing = (_b = options === null || options === void 0 ? void 0 : options.lineSpacing) !== null && _b !== void 0 ? _b : _this.lineSpacing;
|
|
117
|
-
_this.
|
|
118
|
-
_this.
|
|
119
|
-
_this.useNativeText = (_e = options === null || options === void 0 ? void 0 : options.useNativeText) !== null && _e !== void 0 ? _e : SciChartDefaults_1.SciChartDefaults.useNativeText;
|
|
108
|
+
_this.useSharedCache = (_c = options === null || options === void 0 ? void 0 : options.useSharedCache) !== null && _c !== void 0 ? _c : SciChartDefaults_1.SciChartDefaults.useSharedCache;
|
|
109
|
+
_this.useNativeText = (_d = options === null || options === void 0 ? void 0 : options.useNativeText) !== null && _d !== void 0 ? _d : SciChartDefaults_1.SciChartDefaults.useNativeText;
|
|
120
110
|
return _this;
|
|
121
111
|
}
|
|
122
112
|
Object.defineProperty(LabelProviderBase2D.prototype, "rotation", {
|
|
@@ -337,69 +327,32 @@ var LabelProviderBase2D = /** @class */ (function (_super) {
|
|
|
337
327
|
* @returns A TTextureObject containing the bitmapTexture and the size
|
|
338
328
|
*/
|
|
339
329
|
LabelProviderBase2D.prototype.getCachedLabelTexture = function (labelText, textureManager, labelStyle) {
|
|
340
|
-
var _this = this;
|
|
341
330
|
var _a;
|
|
342
331
|
var cachedLabel = LabelCache_1.labelCache.getLabel(labelText, this.styleId);
|
|
343
332
|
if (cachedLabel) {
|
|
344
|
-
if (cachedLabel.textureWidth === undefined) {
|
|
345
|
-
// Log when this texture request was made. Kill and restart if too old
|
|
346
|
-
// Make sure this chart redraws if it is waiting on a label that was requested by a different chart
|
|
347
|
-
cachedLabel.registerNotifier(function () { return _super.prototype.invalidateParent.call(_this); });
|
|
348
|
-
}
|
|
349
333
|
return {
|
|
350
334
|
textureWidth: (_a = cachedLabel.textureWidth) !== null && _a !== void 0 ? _a : null,
|
|
351
335
|
textureHeight: cachedLabel.textureHeight,
|
|
352
336
|
bitmapTexture: cachedLabel.bitmapTexture
|
|
353
337
|
};
|
|
354
338
|
}
|
|
355
|
-
else if (this.asyncLabels) {
|
|
356
|
-
// Capture the styleId as it might have changed by the time the result comes in.
|
|
357
|
-
var callBackStyleId_1 = this.styleId;
|
|
358
|
-
this.getLabelTextureAsync(labelText, textureManager, labelStyle).then(function (result) {
|
|
359
|
-
var cached = LabelCache_1.labelCache.getLabel(labelText, callBackStyleId_1);
|
|
360
|
-
// This may not exist if the target chart has been deleted already.
|
|
361
|
-
if (cached) {
|
|
362
|
-
cached.textureHeight = result.textureHeight;
|
|
363
|
-
cached.textureWidth = result.textureWidth;
|
|
364
|
-
cached.bitmapTexture = result.bitmapTexture;
|
|
365
|
-
cached.textureUpdated();
|
|
366
|
-
// this.invalidateParent also clears cache, which we don't want here.
|
|
367
|
-
_super.prototype.invalidateParent.call(_this);
|
|
368
|
-
}
|
|
369
|
-
});
|
|
370
|
-
return {
|
|
371
|
-
textureWidth: undefined,
|
|
372
|
-
textureHeight: undefined,
|
|
373
|
-
bitmapTexture: undefined
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
339
|
else {
|
|
377
340
|
return this.getLabelTexture(labelText, textureManager, labelStyle);
|
|
378
341
|
}
|
|
379
342
|
};
|
|
380
343
|
/**
|
|
381
|
-
*
|
|
382
|
-
* If
|
|
383
|
-
* otherwise other axes using the same style and text may see your custom texture. Alternatively you can override getCachedStyle or set styleId directly
|
|
344
|
+
* @deprecated AsyncLabels have been removed. useNativeText: true provides much greater performance benefit.
|
|
345
|
+
* If using texture labels override getLabelTexture instead
|
|
384
346
|
*/
|
|
385
347
|
LabelProviderBase2D.prototype.getLabelTextureAsync = function (labelText, textureManager, labelStyle) {
|
|
386
348
|
return __awaiter(this, void 0, void 0, function () {
|
|
387
|
-
var image;
|
|
388
349
|
return __generator(this, function (_a) {
|
|
389
|
-
|
|
390
|
-
case 0:
|
|
391
|
-
if (!TextureWorker_1.textureWorker.isActive) return [3 /*break*/, 2];
|
|
392
|
-
return [4 /*yield*/, TextureWorker_1.textureWorker.measureAndGetImageData([labelText], labelStyle, this.rotationProperty)];
|
|
393
|
-
case 1:
|
|
394
|
-
image = _a.sent();
|
|
395
|
-
return [2 /*return*/, textureManager.createTextureFromImageData(image.imageData, image.textureWidth, image.textureHeight)];
|
|
396
|
-
case 2: return [2 /*return*/, this.getLabelTexture(labelText, textureManager, labelStyle)];
|
|
397
|
-
}
|
|
350
|
+
return [2 /*return*/, this.getLabelTexture(labelText, textureManager, labelStyle)];
|
|
398
351
|
});
|
|
399
352
|
});
|
|
400
353
|
};
|
|
401
354
|
/**
|
|
402
|
-
* Create a texture for the given label text. This method is called if
|
|
355
|
+
* Create a texture for the given label text. This method is called if useNativeText is false.
|
|
403
356
|
* If overriding this method with useSharedCache = true, consider setting it false for this LabelProvider,
|
|
404
357
|
* otherwise other axes using the same style and text may see your custom texture. Alternatively you can override getCachedStyle or set styleId directly
|
|
405
358
|
*/
|
|
@@ -421,7 +374,7 @@ var LabelProviderBase2D = /** @class */ (function (_super) {
|
|
|
421
374
|
var options = {
|
|
422
375
|
rotation: this.rotation,
|
|
423
376
|
lineSpacing: this.lineSpacing,
|
|
424
|
-
asyncLabels:
|
|
377
|
+
asyncLabels: false,
|
|
425
378
|
useSharedCache: this.useSharedCache,
|
|
426
379
|
useNativeText: this.useNativeText
|
|
427
380
|
};
|
|
@@ -49,7 +49,6 @@ export declare class TextLabelProvider extends LabelProviderBase2D {
|
|
|
49
49
|
set maxLength(value: number);
|
|
50
50
|
onBeginAxisDraw(): void;
|
|
51
51
|
getLabelWidth(ctx: CanvasRenderingContext2D, labelText: string, labelStyle?: TTextStyle): number;
|
|
52
|
-
getLabelTextureAsync(labelText: string, textureManager: TextureManager, labelStyle: TTextStyle): Promise<import("../../TextureManager/TextureManager").TTextureObject>;
|
|
53
52
|
getLabelTexture(labelText: string, textureManager: TextureManager, labelStyle: TTextStyle): import("../../TextureManager/TextureManager").TTextureObject;
|
|
54
53
|
/**
|
|
55
54
|
* Wraps the label text and returns it as a string with newlines
|
|
@@ -25,46 +25,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
25
25
|
};
|
|
26
26
|
return __assign.apply(this, arguments);
|
|
27
27
|
};
|
|
28
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
38
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
39
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
|
-
function step(op) {
|
|
42
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
-
while (_) try {
|
|
44
|
-
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;
|
|
45
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
|
-
switch (op[0]) {
|
|
47
|
-
case 0: case 1: t = op; break;
|
|
48
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
49
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
50
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
51
|
-
default:
|
|
52
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
53
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
54
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
55
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
56
|
-
if (t[2]) _.ops.pop();
|
|
57
|
-
_.trys.pop(); continue;
|
|
58
|
-
}
|
|
59
|
-
op = body.call(thisArg, _);
|
|
60
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
29
|
exports.wrapText = exports.TextLabelProvider = void 0;
|
|
66
30
|
var LabelProviderType_1 = require("../../../../types/LabelProviderType");
|
|
67
|
-
var TextureWorker_1 = require("../../../Services/Workers/TextureWorker");
|
|
68
31
|
var TextureManager_1 = require("../../TextureManager/TextureManager");
|
|
69
32
|
var LabelCache_1 = require("./LabelCache");
|
|
70
33
|
var LabelProviderBase2D_1 = require("./LabelProviderBase2D");
|
|
@@ -150,29 +113,6 @@ var TextLabelProvider = /** @class */ (function (_super) {
|
|
|
150
113
|
labelStyle.padding.right);
|
|
151
114
|
}
|
|
152
115
|
};
|
|
153
|
-
TextLabelProvider.prototype.getLabelTextureAsync = function (labelText, textureManager, labelStyle) {
|
|
154
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
155
|
-
var image;
|
|
156
|
-
return __generator(this, function (_a) {
|
|
157
|
-
switch (_a.label) {
|
|
158
|
-
case 0:
|
|
159
|
-
if (!TextureWorker_1.textureWorker.isActive) return [3 /*break*/, 5];
|
|
160
|
-
image = void 0;
|
|
161
|
-
if (!Array.isArray(labelText)) return [3 /*break*/, 2];
|
|
162
|
-
return [4 /*yield*/, TextureWorker_1.textureWorker.measureAndGetImageData(labelText, labelStyle, this.rotation, this.lineSpacing)];
|
|
163
|
-
case 1:
|
|
164
|
-
image = _a.sent();
|
|
165
|
-
return [3 /*break*/, 4];
|
|
166
|
-
case 2: return [4 /*yield*/, TextureWorker_1.textureWorker.measureAndGetImageData([labelText], labelStyle, this.rotation, this.lineSpacing)];
|
|
167
|
-
case 3:
|
|
168
|
-
image = _a.sent();
|
|
169
|
-
_a.label = 4;
|
|
170
|
-
case 4: return [2 /*return*/, textureManager.createTextureFromImageData(image.imageData, image.textureWidth, image.textureHeight)];
|
|
171
|
-
case 5: return [2 /*return*/, this.getLabelTexture(labelText, textureManager, labelStyle)];
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
};
|
|
176
116
|
TextLabelProvider.prototype.getLabelTexture = function (labelText, textureManager, labelStyle) {
|
|
177
117
|
var lines = labelText.split("\n");
|
|
178
118
|
return textureManager.createTextTexture(lines, labelStyle, this.rotation, this.lineSpacing);
|
|
@@ -3,6 +3,7 @@ import { Rect } from "../../Core/Rect";
|
|
|
3
3
|
import { Thickness } from "../../Core/Thickness";
|
|
4
4
|
import { EAutoColorMode } from "../../types/AutoColorMode";
|
|
5
5
|
import { TBorder } from "../../types/TBorder";
|
|
6
|
+
import { TChartTitleStyle } from "../../types/TextStyle";
|
|
6
7
|
import { ECoordinateMode } from "./Annotations/AnnotationBase";
|
|
7
8
|
import { ISurfaceOptionsBase } from "./SciChartSurfaceBase";
|
|
8
9
|
/**
|
|
@@ -45,6 +46,14 @@ export interface I2DSurfaceOptions extends ISurfaceOptionsBase {
|
|
|
45
46
|
* Optional - An {@link EAutoColorMode} which controls how often series colours set to AUTO_COLOR will be resolved. Default OnAddRemoveSeries
|
|
46
47
|
*/
|
|
47
48
|
autoColorMode?: EAutoColorMode;
|
|
49
|
+
/**
|
|
50
|
+
* Optional a title for the SciChartSurface
|
|
51
|
+
*/
|
|
52
|
+
title?: string | string[];
|
|
53
|
+
/**
|
|
54
|
+
* The title text style and placement for the SciChartSurface as {@link TChartTitleStyle}
|
|
55
|
+
*/
|
|
56
|
+
titleStyle?: TChartTitleStyle;
|
|
48
57
|
}
|
|
49
58
|
export interface I2DSubSurfaceOptions extends I2DSurfaceOptions {
|
|
50
59
|
/**
|
|
@@ -92,11 +92,11 @@ export declare class FastColumnRenderableSeries extends BaseRenderableSeries {
|
|
|
92
92
|
*/
|
|
93
93
|
set zeroLineY(zeroLineY: number);
|
|
94
94
|
/**
|
|
95
|
-
* Gets or sets the width of
|
|
95
|
+
* Gets or sets the width of columns as a fraction of available space. Valid values range from 0.0 - 1.0
|
|
96
96
|
*/
|
|
97
97
|
get dataPointWidth(): number;
|
|
98
98
|
/**
|
|
99
|
-
* Gets or sets the width of
|
|
99
|
+
* Gets or sets the width of columns as a fraction of available space. Valid values range from 0.0 - 1.0
|
|
100
100
|
*/
|
|
101
101
|
set dataPointWidth(dataPointWidth: number);
|
|
102
102
|
/**
|
|
@@ -145,13 +145,13 @@ var FastColumnRenderableSeries = /** @class */ (function (_super) {
|
|
|
145
145
|
});
|
|
146
146
|
Object.defineProperty(FastColumnRenderableSeries.prototype, "dataPointWidth", {
|
|
147
147
|
/**
|
|
148
|
-
* Gets or sets the width of
|
|
148
|
+
* Gets or sets the width of columns as a fraction of available space. Valid values range from 0.0 - 1.0
|
|
149
149
|
*/
|
|
150
150
|
get: function () {
|
|
151
151
|
return this.dataPointWidthProperty;
|
|
152
152
|
},
|
|
153
153
|
/**
|
|
154
|
-
* Gets or sets the width of
|
|
154
|
+
* Gets or sets the width of columns as a fraction of available space. Valid values range from 0.0 - 1.0
|
|
155
155
|
*/
|
|
156
156
|
set: function (dataPointWidth) {
|
|
157
157
|
this.dataPointWidthProperty = dataPointWidth;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { EWatermarkPosition } from "../../types/WatermarkPosition";
|
|
2
2
|
export declare class SciChartDefaults {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
* Can also be set on individual labelProviders.
|
|
4
|
+
* @deprecated This functionality has been removed. useNativeText: true provides much greater performance benefit.
|
|
6
5
|
*/
|
|
7
6
|
static asyncLabels: boolean;
|
|
8
7
|
/**
|
|
@@ -18,7 +17,7 @@ export declare class SciChartDefaults {
|
|
|
18
17
|
*/
|
|
19
18
|
static performanceWarnings: boolean;
|
|
20
19
|
/**
|
|
21
|
-
* Experimental - set true to use native text for axes. Not all text features currently supported
|
|
20
|
+
* Experimental - set true to use native text for axes and titles. Not all text features currently supported
|
|
22
21
|
*/
|
|
23
22
|
static useNativeText: boolean;
|
|
24
23
|
/**
|
|
@@ -6,8 +6,7 @@ var SciChartDefaults = /** @class */ (function () {
|
|
|
6
6
|
function SciChartDefaults() {
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* Can also be set on individual labelProviders.
|
|
9
|
+
* @deprecated This functionality has been removed. useNativeText: true provides much greater performance benefit.
|
|
11
10
|
*/
|
|
12
11
|
SciChartDefaults.asyncLabels = false;
|
|
13
12
|
/**
|
|
@@ -23,7 +22,7 @@ var SciChartDefaults = /** @class */ (function () {
|
|
|
23
22
|
*/
|
|
24
23
|
SciChartDefaults.performanceWarnings = true;
|
|
25
24
|
/**
|
|
26
|
-
* Experimental - set true to use native text for axes. Not all text features currently supported
|
|
25
|
+
* Experimental - set true to use native text for axes and titles. Not all text features currently supported
|
|
27
26
|
*/
|
|
28
27
|
SciChartDefaults.useNativeText = false;
|
|
29
28
|
/**
|
|
@@ -29,6 +29,8 @@ import { ESurfaceType, SciChartSurfaceBase, TSciChartConfig } from "./SciChartSu
|
|
|
29
29
|
import { TDpiChangedEventArgs } from "./TextureManager/DpiHelper";
|
|
30
30
|
import { Point } from "../../Core/Point";
|
|
31
31
|
import { EWatermarkPosition } from "../../types/WatermarkPosition";
|
|
32
|
+
import { TChartTitleStyle } from "../../types/TextStyle";
|
|
33
|
+
import { IChartTitleRenderer } from "../Services/TitleRenderer";
|
|
32
34
|
export declare type TSciChart = TWasmContext;
|
|
33
35
|
export declare type TWebAssemblyChart = {
|
|
34
36
|
wasmContext: TSciChart;
|
|
@@ -97,6 +99,7 @@ export declare class SciChartSurface extends SciChartSurfaceBase {
|
|
|
97
99
|
* Tell SciChart to load the Wasm and Data files from the local server, rather than from CDN.
|
|
98
100
|
*/
|
|
99
101
|
static useWasmLocal(): void;
|
|
102
|
+
static isSubSurface(surface: SciChartSurface): surface is SciChartSubSurface;
|
|
100
103
|
private static createTest;
|
|
101
104
|
readonly renderSurface: RenderSurface;
|
|
102
105
|
/**
|
|
@@ -218,6 +221,9 @@ export declare class SciChartSurface extends SciChartSurfaceBase {
|
|
|
218
221
|
/** Set true to position the watermark relative to the overall canvas, rather than the series area. */
|
|
219
222
|
watermarkRelativeToCanvas: boolean;
|
|
220
223
|
protected animationList: IGenericAnimation[];
|
|
224
|
+
protected titleProperty: string | string[];
|
|
225
|
+
protected titleStyleProperty: Readonly<Required<TChartTitleStyle>>;
|
|
226
|
+
protected chartTitleRendererProperty: IChartTitleRenderer;
|
|
221
227
|
protected paddingProperty: Thickness;
|
|
222
228
|
private readonly sciChartRenderer;
|
|
223
229
|
private layoutManagerProperty;
|
|
@@ -272,6 +278,11 @@ export declare class SciChartSurface extends SciChartSurfaceBase {
|
|
|
272
278
|
* Used internally - gets or sets the {@link LayoutManager}
|
|
273
279
|
*/
|
|
274
280
|
set layoutManager(value: LayoutManager);
|
|
281
|
+
/**
|
|
282
|
+
* Controls the rendering of {@link SiCharSurface.title}
|
|
283
|
+
*/
|
|
284
|
+
get chartTitleRenderer(): IChartTitleRenderer;
|
|
285
|
+
set chartTitleRenderer(value: IChartTitleRenderer);
|
|
275
286
|
/**
|
|
276
287
|
* Gets or sets the {@link ISeriesTextLayoutManager} for performing text layout across multiple series
|
|
277
288
|
*/
|
|
@@ -280,6 +291,24 @@ export declare class SciChartSurface extends SciChartSurfaceBase {
|
|
|
280
291
|
* Used internally - gets or sets the {@link ISeriesTextLayoutManager} for performing text layout across multiple series
|
|
281
292
|
*/
|
|
282
293
|
set dataLabelLayoutManager(value: IDataLabelLayoutManager);
|
|
294
|
+
/**
|
|
295
|
+
* Gets or sets the title for the SciChartSurface
|
|
296
|
+
*/
|
|
297
|
+
get title(): string | string[];
|
|
298
|
+
/**
|
|
299
|
+
* Gets or sets the title for the SciChartSurface
|
|
300
|
+
*/
|
|
301
|
+
set title(value: string | string[]);
|
|
302
|
+
/**
|
|
303
|
+
* Gets or sets the title text style and placement for the SciChartSurface as {@link TChartTitleStyle}
|
|
304
|
+
*/
|
|
305
|
+
get titleStyle(): Readonly<Required<TChartTitleStyle>>;
|
|
306
|
+
/**
|
|
307
|
+
* Gets or sets the title text style and placement for the SciChartSurface as {@link TChartTitleStyle}
|
|
308
|
+
* @remarks if updating, should be set as an object (or partial object) of type {@link TChartTitleStyle},
|
|
309
|
+
* instead of directly setting individual properties
|
|
310
|
+
*/
|
|
311
|
+
set titleStyle(value: TChartTitleStyle);
|
|
283
312
|
/**
|
|
284
313
|
* Gets or sets the Padding between the SciChartSurface and it's inner elements, in order top, right, bottom, left
|
|
285
314
|
* @remarks
|
|
@@ -91,7 +91,6 @@ var RenderSurface_1 = require("../Drawing/RenderSurface");
|
|
|
91
91
|
var SolidBrushCache_1 = require("../Drawing/SolidBrushCache");
|
|
92
92
|
var LayoutManager_1 = require("../LayoutManager/LayoutManager");
|
|
93
93
|
var SciChartRenderer_1 = require("../Services/SciChartRenderer");
|
|
94
|
-
var TextureWorker_1 = require("../Services/Workers/TextureWorker");
|
|
95
94
|
var AdornerLayer_1 = require("./Annotations/AdornerLayer");
|
|
96
95
|
var AnnotationBase_1 = require("./Annotations/AnnotationBase");
|
|
97
96
|
var AxisBase2D_1 = require("./Axis/AxisBase2D");
|
|
@@ -109,9 +108,10 @@ var DpiHelper_1 = require("./TextureManager/DpiHelper");
|
|
|
109
108
|
var UpdateSuspender_1 = require("./UpdateSuspender");
|
|
110
109
|
var Point_1 = require("../../Core/Point");
|
|
111
110
|
var SciChartDefaults_1 = require("./SciChartDefaults");
|
|
111
|
+
var ChartTitleRenderer_1 = require("../Services/ChartTitleRenderer");
|
|
112
|
+
var TextStyle_1 = require("../../types/TextStyle");
|
|
113
|
+
var TextPosition_1 = require("../../types/TextPosition");
|
|
112
114
|
exports.sciChartConfig = {};
|
|
113
|
-
// To force the worker to be created before it is needed, so we know if it alive or not
|
|
114
|
-
var t = TextureWorker_1.textureWorker;
|
|
115
115
|
/**
|
|
116
116
|
* @summary The {@link SciChartSurface} is the root 2D Chart control in SciChart's High Performance Real-time
|
|
117
117
|
* {@link https://www.scichart.com/javascript-chart-features | JavaScript Chart Library}
|
|
@@ -170,6 +170,21 @@ var SciChartSurface = /** @class */ (function (_super) {
|
|
|
170
170
|
/** Set true to position the watermark relative to the overall canvas, rather than the series area. */
|
|
171
171
|
_this.watermarkRelativeToCanvas = false;
|
|
172
172
|
_this.animationList = [];
|
|
173
|
+
_this.titleStyleProperty = {
|
|
174
|
+
fontSize: 60,
|
|
175
|
+
fontFamily: "Arial",
|
|
176
|
+
color: SciChartSurfaceBase_1.SciChartSurfaceBase.DEFAULT_THEME.chartTitleColor,
|
|
177
|
+
fontWeight: "normal",
|
|
178
|
+
fontStyle: "normal",
|
|
179
|
+
lineSpacing: 1.1,
|
|
180
|
+
padding: Thickness_1.Thickness.fromString("2 4 0 4"),
|
|
181
|
+
multilineAlignment: TextPosition_1.EMultiLineAlignment.Center,
|
|
182
|
+
// rotation: 0,
|
|
183
|
+
alignment: TextStyle_1.ETextAlignment.Center,
|
|
184
|
+
position: TextStyle_1.ETitlePosition.Top,
|
|
185
|
+
placeWithinChart: false,
|
|
186
|
+
useNativeText: SciChartDefaults_1.SciChartDefaults.useNativeText
|
|
187
|
+
};
|
|
173
188
|
_this.paddingProperty = Thickness_1.Thickness.fromNumber(10);
|
|
174
189
|
_this.zoomStateProperty = ZoomState_1.EZoomState.AtExtents;
|
|
175
190
|
_this.viewportBorderProperty = {
|
|
@@ -216,6 +231,7 @@ var SciChartSurface = /** @class */ (function (_super) {
|
|
|
216
231
|
_this.renderSurface = new RenderSurface_1.RenderSurface(webAssemblyContext, viewportSize, (_e = _this.domCanvas2D) === null || _e === void 0 ? void 0 : _e.id);
|
|
217
232
|
_this.renderSurface.handleDraw = _this.onRenderSurfaceDraw;
|
|
218
233
|
_this.sciChartRenderer = new SciChartRenderer_1.SciChartRenderer(_this);
|
|
234
|
+
_this.chartTitleRendererProperty = new ChartTitleRenderer_1.ChartTitleRenderer(_this.webAssemblyContext2D);
|
|
219
235
|
_this.layoutManager = new LayoutManager_1.LayoutManager();
|
|
220
236
|
// TODO: remove this
|
|
221
237
|
if (_this.domCanvas2D) {
|
|
@@ -345,6 +361,9 @@ var SciChartSurface = /** @class */ (function (_super) {
|
|
|
345
361
|
SciChartSurface.useWasmLocal = function () {
|
|
346
362
|
SciChartSurface.configure(undefined);
|
|
347
363
|
};
|
|
364
|
+
SciChartSurface.isSubSurface = function (surface) {
|
|
365
|
+
return surface.isSubSurface;
|
|
366
|
+
};
|
|
348
367
|
SciChartSurface.createTest = function (divElement, options) {
|
|
349
368
|
var _a, _b;
|
|
350
369
|
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);
|
|
@@ -453,6 +472,22 @@ var SciChartSurface = /** @class */ (function (_super) {
|
|
|
453
472
|
enumerable: false,
|
|
454
473
|
configurable: true
|
|
455
474
|
});
|
|
475
|
+
Object.defineProperty(SciChartSurface.prototype, "chartTitleRenderer", {
|
|
476
|
+
/**
|
|
477
|
+
* Controls the rendering of {@link SiCharSurface.title}
|
|
478
|
+
*/
|
|
479
|
+
get: function () {
|
|
480
|
+
return this.chartTitleRendererProperty;
|
|
481
|
+
},
|
|
482
|
+
set: function (value) {
|
|
483
|
+
var _a;
|
|
484
|
+
(_a = this.chartTitleRendererProperty) === null || _a === void 0 ? void 0 : _a.delete();
|
|
485
|
+
this.chartTitleRendererProperty = value;
|
|
486
|
+
this.invalidateElement();
|
|
487
|
+
},
|
|
488
|
+
enumerable: false,
|
|
489
|
+
configurable: true
|
|
490
|
+
});
|
|
456
491
|
Object.defineProperty(SciChartSurface.prototype, "dataLabelLayoutManager", {
|
|
457
492
|
/**
|
|
458
493
|
* Gets or sets the {@link ISeriesTextLayoutManager} for performing text layout across multiple series
|
|
@@ -470,6 +505,46 @@ var SciChartSurface = /** @class */ (function (_super) {
|
|
|
470
505
|
enumerable: false,
|
|
471
506
|
configurable: true
|
|
472
507
|
});
|
|
508
|
+
Object.defineProperty(SciChartSurface.prototype, "title", {
|
|
509
|
+
/**
|
|
510
|
+
* Gets or sets the title for the SciChartSurface
|
|
511
|
+
*/
|
|
512
|
+
get: function () {
|
|
513
|
+
return this.titleProperty;
|
|
514
|
+
},
|
|
515
|
+
/**
|
|
516
|
+
* Gets or sets the title for the SciChartSurface
|
|
517
|
+
*/
|
|
518
|
+
set: function (value) {
|
|
519
|
+
if (this.titleProperty !== value) {
|
|
520
|
+
this.titleProperty = value;
|
|
521
|
+
this.invalidateElement();
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
enumerable: false,
|
|
525
|
+
configurable: true
|
|
526
|
+
});
|
|
527
|
+
Object.defineProperty(SciChartSurface.prototype, "titleStyle", {
|
|
528
|
+
/**
|
|
529
|
+
* Gets or sets the title text style and placement for the SciChartSurface as {@link TChartTitleStyle}
|
|
530
|
+
*/
|
|
531
|
+
get: function () {
|
|
532
|
+
return this.titleStyleProperty;
|
|
533
|
+
},
|
|
534
|
+
/**
|
|
535
|
+
* Gets or sets the title text style and placement for the SciChartSurface as {@link TChartTitleStyle}
|
|
536
|
+
* @remarks if updating, should be set as an object (or partial object) of type {@link TChartTitleStyle},
|
|
537
|
+
* instead of directly setting individual properties
|
|
538
|
+
*/
|
|
539
|
+
set: function (value) {
|
|
540
|
+
if (this.titleStyleProperty !== value) {
|
|
541
|
+
this.titleStyleProperty = Object.assign({}, this.titleStyleProperty, value);
|
|
542
|
+
this.invalidateElement();
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
enumerable: false,
|
|
546
|
+
configurable: true
|
|
547
|
+
});
|
|
473
548
|
Object.defineProperty(SciChartSurface.prototype, "padding", {
|
|
474
549
|
/**
|
|
475
550
|
* Gets or sets the Padding between the SciChartSurface and it's inner elements, in order top, right, bottom, left
|
|
@@ -552,6 +627,11 @@ var SciChartSurface = /** @class */ (function (_super) {
|
|
|
552
627
|
* @inheritDoc
|
|
553
628
|
*/
|
|
554
629
|
SciChartSurface.prototype.applyTheme = function (themeProvider) {
|
|
630
|
+
// TODO move to base when title is implemented on 3d charts
|
|
631
|
+
var previousThemeProvider = this.previousThemeProvider;
|
|
632
|
+
if (this.titleStyle.color === previousThemeProvider.chartTitleColor) {
|
|
633
|
+
this.titleStyle = { color: themeProvider.chartTitleColor };
|
|
634
|
+
}
|
|
555
635
|
_super.prototype.applyTheme.call(this, themeProvider);
|
|
556
636
|
this.renderableSeries.asArray().forEach(function (rs) { return rs.applyTheme(themeProvider); });
|
|
557
637
|
this.xAxes.asArray().forEach(function (axis) { return axis.applyTheme(themeProvider); });
|
|
@@ -586,7 +666,9 @@ var SciChartSurface = /** @class */ (function (_super) {
|
|
|
586
666
|
var chart = _a[_i];
|
|
587
667
|
chart.updateSubLayout();
|
|
588
668
|
}
|
|
589
|
-
|
|
669
|
+
// Bypass the isSuspended check, otherwise the chart will go blank if it is resized while suspended
|
|
670
|
+
var canvasId = this.domCanvas2D ? this.domCanvas2D.id : "undefinedCanvasId";
|
|
671
|
+
this.renderSurface.invalidateElement(canvasId);
|
|
590
672
|
};
|
|
591
673
|
/**
|
|
592
674
|
* @inheritDoc
|
|
@@ -630,7 +712,7 @@ var SciChartSurface = /** @class */ (function (_super) {
|
|
|
630
712
|
if (err.name === "BindingError") {
|
|
631
713
|
console.error(err);
|
|
632
714
|
console.warn("Binding errors can occur if a previous chart using the same div id was not deleted correctly, or if you try to share data or series between charts that use different webassembly contexts.");
|
|
633
|
-
(0, NativeObject_1.freeCache)(this.webAssemblyContext2D);
|
|
715
|
+
(0, NativeObject_1.freeCache)(this.webAssemblyContext2D).delete();
|
|
634
716
|
}
|
|
635
717
|
else if (this.domChartRoot) {
|
|
636
718
|
console.error("Error from chart in div ".concat(this.domChartRoot.id), err);
|
|
@@ -663,6 +745,7 @@ var SciChartSurface = /** @class */ (function (_super) {
|
|
|
663
745
|
this.watermarkProperties = (0, Deleter_1.deleteSafe)(this.watermarkProperties);
|
|
664
746
|
this.watermarkPropertyPosition = (0, Deleter_1.deleteSafe)(this.watermarkPropertyPosition);
|
|
665
747
|
this.chartModifiers.asArray().forEach(function (chm) { return chm.delete(); });
|
|
748
|
+
this.chartTitleRendererProperty = (0, Deleter_1.deleteSafe)(this.chartTitleRenderer);
|
|
666
749
|
if (clearHtml && this.domChartRoot) {
|
|
667
750
|
var style = this.domChartRoot.style;
|
|
668
751
|
if (style) {
|
|
@@ -1092,6 +1175,8 @@ var SciChartSurface = /** @class */ (function (_super) {
|
|
|
1092
1175
|
}
|
|
1093
1176
|
var options = {
|
|
1094
1177
|
id: this.id,
|
|
1178
|
+
title: this.title,
|
|
1179
|
+
titleStyle: this.titleStyle,
|
|
1095
1180
|
canvasBorder: this.canvasBorder,
|
|
1096
1181
|
heightAspect: this.heightAspect,
|
|
1097
1182
|
widthAspect: this.widthAspect,
|
|
@@ -1144,6 +1229,12 @@ var SciChartSurface = /** @class */ (function (_super) {
|
|
|
1144
1229
|
if (options === null || options === void 0 ? void 0 : options.autoColorMode) {
|
|
1145
1230
|
this.autoColorMode = options.autoColorMode;
|
|
1146
1231
|
}
|
|
1232
|
+
if (options === null || options === void 0 ? void 0 : options.title) {
|
|
1233
|
+
this.title = options.title;
|
|
1234
|
+
}
|
|
1235
|
+
if (options === null || options === void 0 ? void 0 : options.titleStyle) {
|
|
1236
|
+
this.titleStyle = options.titleStyle;
|
|
1237
|
+
}
|
|
1147
1238
|
};
|
|
1148
1239
|
/**
|
|
1149
1240
|
* @inheritDoc
|
|
@@ -1610,7 +1701,9 @@ var SciChartSubSurface = /** @class */ (function (_super) {
|
|
|
1610
1701
|
/**
|
|
1611
1702
|
* @inheritDoc
|
|
1612
1703
|
*/
|
|
1613
|
-
SciChartSubSurface.prototype.changeViewportSize = function (pixelWidth, pixelHeight) {
|
|
1704
|
+
SciChartSubSurface.prototype.changeViewportSize = function (pixelWidth, pixelHeight) {
|
|
1705
|
+
this.renderSurface.viewportSize = this.parentSurface.renderSurface.viewportSize;
|
|
1706
|
+
};
|
|
1614
1707
|
/**
|
|
1615
1708
|
* Gets the sub-chart container
|
|
1616
1709
|
*/
|
|
@@ -1619,7 +1712,7 @@ var SciChartSubSurface = /** @class */ (function (_super) {
|
|
|
1619
1712
|
};
|
|
1620
1713
|
SciChartSubSurface.prototype.getSubChartRect = function () {
|
|
1621
1714
|
var _a = this.renderSurface.viewportSize, width = _a.width, height = _a.height;
|
|
1622
|
-
var _b = this.
|
|
1715
|
+
var _b = this.adjustedPadding, top = _b.top, left = _b.left, bottom = _b.bottom, right = _b.right;
|
|
1623
1716
|
return new Rect_1.Rect(left, top, width - left - right, height - top - bottom);
|
|
1624
1717
|
};
|
|
1625
1718
|
/**
|
|
@@ -122,7 +122,7 @@ var DpiHelper = /** @class */ (function () {
|
|
|
122
122
|
if (dpiScale === void 0) { dpiScale = DpiHelper.PIXEL_RATIO; }
|
|
123
123
|
var dpiAdjusted = __assign({}, gridLineStyle);
|
|
124
124
|
var roundedStrokeThickness = Math.round(gridLineStyle.strokeThickness * dpiScale);
|
|
125
|
-
dpiAdjusted.strokeDashArray = (_a = gridLineStyle.strokeDashArray) === null || _a === void 0 ? void 0 : _a.map(function (sd) { return sd * dpiScale; });
|
|
125
|
+
dpiAdjusted.strokeDashArray = (_a = gridLineStyle.strokeDashArray) === null || _a === void 0 ? void 0 : _a.map(function (sd) { return Math.round(sd * dpiScale); });
|
|
126
126
|
dpiAdjusted.strokeThickness =
|
|
127
127
|
roundedStrokeThickness > 0 || gridLineStyle.strokeThickness === 0 ? roundedStrokeThickness : 1;
|
|
128
128
|
return dpiAdjusted;
|