scichart 3.0.317 → 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 +54 -8
- 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/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.js +2 -2
- 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 +99 -6
- 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 +1 -1
- 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/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
|
@@ -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
|
|
@@ -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;
|
|
@@ -75,12 +75,17 @@ var TextureManager = /** @class */ (function () {
|
|
|
75
75
|
* @returns
|
|
76
76
|
*/
|
|
77
77
|
TextureManager.prototype.createTextTexture = function (text, textStyle, rotation, lineSpacing, backgroundColor, opacity) {
|
|
78
|
+
var _a;
|
|
78
79
|
if (app_1.IS_TEST_ENV) {
|
|
79
80
|
return { bitmapTexture: undefined, textureWidth: 1, textureHeight: 1 };
|
|
80
81
|
}
|
|
81
82
|
var fontStyle = textStyle.fontStyle, fontWeight = textStyle.fontWeight, fontFamily = textStyle.fontFamily, fontSizePx = textStyle.fontSize, padding = textStyle.padding, alignment = textStyle.alignment, color = textStyle.color;
|
|
83
|
+
// Save state
|
|
84
|
+
this.ctx.save();
|
|
82
85
|
this.ctx.globalAlpha = opacity !== null && opacity !== void 0 ? opacity : 1;
|
|
83
|
-
this.ctx.textBaseline = "
|
|
86
|
+
this.ctx.textBaseline = "alphabetic";
|
|
87
|
+
// Switched this back to alphabetic because...reasons
|
|
88
|
+
// https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-textbaseline-alphabetic
|
|
84
89
|
this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
85
90
|
if (backgroundColor) {
|
|
86
91
|
this.ctx.fillStyle = backgroundColor;
|
|
@@ -90,28 +95,36 @@ var TextureManager = /** @class */ (function () {
|
|
|
90
95
|
this.ctx.font = (0, font_1.getFontString)(fontStyle, fontWeight, fontSizePx, fontFamily);
|
|
91
96
|
var textureWidth = 0;
|
|
92
97
|
// const fontSizePt = Math.ceil(fontSizePx * PX_TO_PT);
|
|
93
|
-
var
|
|
94
|
-
var
|
|
95
|
-
var
|
|
98
|
+
var textureHeight = padding.top + padding.bottom;
|
|
99
|
+
var maxLineHeight = 0;
|
|
100
|
+
var firstLineOffset = 0;
|
|
101
|
+
var lineHeights = [];
|
|
96
102
|
for (var index = 0; index < text.length; index++) {
|
|
97
103
|
var line = text[index];
|
|
98
|
-
var
|
|
104
|
+
var textMeasure = this.ctx.measureText(line);
|
|
105
|
+
var lineHeight = Math.round(textMeasure.actualBoundingBoxAscent + textMeasure.actualBoundingBoxDescent);
|
|
106
|
+
lineHeights.push(lineHeight);
|
|
107
|
+
if (lineHeight > maxLineHeight) {
|
|
108
|
+
maxLineHeight = lineHeight;
|
|
109
|
+
}
|
|
110
|
+
if (index === 0) {
|
|
111
|
+
firstLineOffset = textMeasure.actualBoundingBoxAscent;
|
|
112
|
+
}
|
|
113
|
+
var lineWidth = Math.round(textMeasure.width + padding.left + padding.right);
|
|
99
114
|
if (lineWidth > textureWidth) {
|
|
100
115
|
textureWidth = lineWidth;
|
|
101
116
|
}
|
|
102
|
-
|
|
103
|
-
textureHeight += extraLineHeight;
|
|
104
|
-
}
|
|
117
|
+
textureHeight += lineHeight;
|
|
105
118
|
}
|
|
106
|
-
var
|
|
119
|
+
var lineSpacingPixels = Math.round(maxLineHeight * ((lineSpacing !== null && lineSpacing !== void 0 ? lineSpacing : 1.1) - 1));
|
|
120
|
+
textureHeight += (text.length - 1) * lineSpacingPixels;
|
|
121
|
+
var y = padding.top + firstLineOffset;
|
|
107
122
|
var x = padding.left;
|
|
108
123
|
if (!textureWidth || !textureHeight) {
|
|
109
124
|
return { bitmapTexture: undefined, textureWidth: textureWidth, textureHeight: textureHeight };
|
|
110
125
|
}
|
|
111
126
|
var newTextureWidth = textureWidth;
|
|
112
127
|
var newTextureHeight = textureHeight;
|
|
113
|
-
// Save state
|
|
114
|
-
this.ctx.save();
|
|
115
128
|
if (rotation) {
|
|
116
129
|
// convert to radians
|
|
117
130
|
var rotationRad = (rotation * Math.PI) / 180;
|
|
@@ -124,17 +137,19 @@ var TextureManager = /** @class */ (function () {
|
|
|
124
137
|
// translate to the new origin that is located in the left top center of the texture
|
|
125
138
|
this.ctx.translate(-textureWidth / 2, -textureHeight / 2);
|
|
126
139
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
140
|
+
var multilineAlignment = (_a = textStyle.multilineAlignment) !== null && _a !== void 0 ? _a : alignment;
|
|
141
|
+
var maxLineTextWidth = textureWidth - padding.right - padding.left;
|
|
142
|
+
for (var index = 0; index < text.length; index++) {
|
|
143
|
+
var line = text[index];
|
|
144
|
+
if (multilineAlignment === LabelAlignment_1.ELabelAlignment.Center || multilineAlignment === LabelAlignment_1.ELabelAlignment.Right) {
|
|
130
145
|
var lineWidth = (0, exports.measureTextWidth)(this.ctx, line);
|
|
131
146
|
x =
|
|
132
|
-
|
|
147
|
+
multilineAlignment === LabelAlignment_1.ELabelAlignment.Right
|
|
133
148
|
? textureWidth - lineWidth - padding.right
|
|
134
|
-
: (
|
|
149
|
+
: (maxLineTextWidth - lineWidth) / 2 + padding.left;
|
|
135
150
|
}
|
|
136
151
|
this.ctx.fillText(line, Math.round(x), Math.round(y));
|
|
137
|
-
y +=
|
|
152
|
+
y += lineHeights[index] + lineSpacingPixels;
|
|
138
153
|
}
|
|
139
154
|
this.ctx.strokeStyle = color;
|
|
140
155
|
this.ctx.restore();
|
|
@@ -512,7 +512,9 @@ var SciChart3DSurface = /** @class */ (function (_super) {
|
|
|
512
512
|
this.webAssemblyContext3D.SCRT3DSetClearColor(0, 0, 0, 0);
|
|
513
513
|
};
|
|
514
514
|
SciChart3DSurface.prototype.detachSeries = function (renderableSeries) {
|
|
515
|
-
this.rootEntity
|
|
515
|
+
if (this.rootEntity) {
|
|
516
|
+
this.rootEntity.children.remove(renderableSeries.sceneEntity);
|
|
517
|
+
}
|
|
516
518
|
renderableSeries.onDetach();
|
|
517
519
|
this.invalidateElement();
|
|
518
520
|
};
|
|
@@ -521,7 +523,9 @@ var SciChart3DSurface = /** @class */ (function (_super) {
|
|
|
521
523
|
if (!renderableSeries.sceneEntity) {
|
|
522
524
|
throw new Error("IRenderableSeries3D.sceneEntity must be set before attaching to SciChart3DSurface");
|
|
523
525
|
}
|
|
524
|
-
this.rootEntity
|
|
526
|
+
if (this.rootEntity) {
|
|
527
|
+
this.rootEntity.children.add(renderableSeries.sceneEntity);
|
|
528
|
+
}
|
|
525
529
|
this.invalidateElement();
|
|
526
530
|
};
|
|
527
531
|
SciChart3DSurface.prototype.detachAxis = function (axis) {
|
package/Core/BuildStamp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { TSciChart } from "../types/TSciChart";
|
|
2
2
|
import { TSciChart3D } from "../types/TSciChart3D";
|
|
3
|
-
export declare const libraryVersion = "3.
|
|
3
|
+
export declare const libraryVersion = "3.1.329";
|
|
4
4
|
export declare const checkBuildStamp: (wasmContext: TSciChart | TSciChart3D) => boolean;
|
package/Core/BuildStamp.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkBuildStamp = exports.libraryVersion = void 0;
|
|
4
|
-
var buildStamp = "2023-03-
|
|
4
|
+
var buildStamp = "2023-03-31T00:00:00";
|
|
5
5
|
var result;
|
|
6
6
|
// tslint:disable-next-line:no-var-requires
|
|
7
|
-
exports.libraryVersion = "3.
|
|
7
|
+
exports.libraryVersion = "3.1.329";
|
|
8
8
|
var checkBuildStamp = function (wasmContext) {
|
|
9
9
|
if (result !== undefined)
|
|
10
10
|
return result;
|