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
|
@@ -234,6 +234,11 @@ export interface IThemeProvider {
|
|
|
234
234
|
* @remarks Acceptable values include RGB format e.g. ```#FF0000```, RGBA format e.g. ```#FF000077`` and RGBA format e.g. ```rgba(255,0,0,0.5)```
|
|
235
235
|
*/
|
|
236
236
|
axisTitleColor: string;
|
|
237
|
+
/**
|
|
238
|
+
* The default Chart Title color applied as an HTML color code
|
|
239
|
+
* @remarks Acceptable values include RGB format e.g. ```#FF0000```, RGBA format e.g. ```#FF000077`` and RGBA format e.g. ```rgba(255,0,0,0.5)```
|
|
240
|
+
*/
|
|
241
|
+
chartTitleColor: string;
|
|
237
242
|
/**
|
|
238
243
|
* The default shadow effect color applied to drop-shadows
|
|
239
244
|
* @remarks Acceptable values include RGB format e.g. ```#FF0000```, RGBA format e.g. ```#FF000077`` and RGBA format e.g. ```rgba(255,0,0,0.5)```
|
|
@@ -468,6 +473,11 @@ export interface IThemePartial {
|
|
|
468
473
|
* @remarks Acceptable values include RGB format e.g. ```#FF0000```, RGBA format e.g. ```#FF000077`` and RGBA format e.g. ```rgba(255,0,0,0.5)```
|
|
469
474
|
*/
|
|
470
475
|
axisTitleColor?: string;
|
|
476
|
+
/**
|
|
477
|
+
* The default Chart Title color applied as an HTML color code
|
|
478
|
+
* @remarks Acceptable values include RGB format e.g. ```#FF0000```, RGBA format e.g. ```#FF000077`` and RGBA format e.g. ```rgba(255,0,0,0.5)```
|
|
479
|
+
*/
|
|
480
|
+
chartTitleColor?: string;
|
|
471
481
|
/**
|
|
472
482
|
* The default shadow effect color applied to drop-shadows
|
|
473
483
|
* @remarks Acceptable values include RGB format e.g. ```#FF0000```, RGBA format e.g. ```#FF000077`` and RGBA format e.g. ```rgba(255,0,0,0.5)```
|
|
@@ -536,6 +546,7 @@ export declare abstract class ThemeProvider implements IThemeProvider {
|
|
|
536
546
|
abstract impulseFillBrush: string;
|
|
537
547
|
abstract defaultColorMapBrush: TGradientStop[];
|
|
538
548
|
abstract axisTitleColor: string;
|
|
549
|
+
abstract chartTitleColor: string;
|
|
539
550
|
abstract shadowEffectColor: string;
|
|
540
551
|
abstract planeBorderColor: string;
|
|
541
552
|
abstract axisPlaneBackgroundFill: string;
|
|
@@ -745,6 +756,11 @@ export declare abstract class ThemeProvider implements IThemeProvider {
|
|
|
745
756
|
* @remarks Acceptable values include RGB format e.g. ```#FF0000```, RGBA format e.g. ```#FF000077`` and RGBA format e.g. ```rgba(255,0,0,0.5)```
|
|
746
757
|
*/
|
|
747
758
|
axisTitleColor?: string;
|
|
759
|
+
/**
|
|
760
|
+
* The default Chart Title color applied as an HTML color code
|
|
761
|
+
* @remarks Acceptable values include RGB format e.g. ```#FF0000```, RGBA format e.g. ```#FF000077`` and RGBA format e.g. ```rgba(255,0,0,0.5)```
|
|
762
|
+
*/
|
|
763
|
+
chartTitleColor?: string;
|
|
748
764
|
/**
|
|
749
765
|
* The default shadow effect color applied to drop-shadows
|
|
750
766
|
* @remarks Acceptable values include RGB format e.g. ```#FF0000```, RGBA format e.g. ```#FF000077`` and RGBA format e.g. ```rgba(255,0,0,0.5)```
|
|
@@ -122,6 +122,8 @@ export declare class SciChartJSDarkTheme extends ThemeProvider {
|
|
|
122
122
|
/** @inheritDoc */
|
|
123
123
|
axisTitleColor: string;
|
|
124
124
|
/** @inheritDoc */
|
|
125
|
+
chartTitleColor: string;
|
|
126
|
+
/** @inheritDoc */
|
|
125
127
|
shadowEffectColor: string;
|
|
126
128
|
/** @inheritDoc */
|
|
127
129
|
planeBorderColor: string;
|
|
@@ -144,6 +144,8 @@ var SciChartJSDarkTheme = /** @class */ (function (_super) {
|
|
|
144
144
|
/** @inheritDoc */
|
|
145
145
|
_this.axisTitleColor = "#C8C7C3FF";
|
|
146
146
|
/** @inheritDoc */
|
|
147
|
+
_this.chartTitleColor = "#C8C7C3FF";
|
|
148
|
+
/** @inheritDoc */
|
|
147
149
|
_this.shadowEffectColor = "#000000FF";
|
|
148
150
|
/** @inheritDoc */
|
|
149
151
|
_this.planeBorderColor = "#333333FF";
|
|
@@ -126,6 +126,8 @@ export declare class SciChartJSLightTheme extends ThemeProvider {
|
|
|
126
126
|
/** @inheritDoc */
|
|
127
127
|
axisTitleColor: string;
|
|
128
128
|
/** @inheritDoc */
|
|
129
|
+
chartTitleColor: string;
|
|
130
|
+
/** @inheritDoc */
|
|
129
131
|
shadowEffectColor: string;
|
|
130
132
|
/** @inheritDoc */
|
|
131
133
|
planeBorderColor: string;
|
|
@@ -148,6 +148,8 @@ var SciChartJSLightTheme = /** @class */ (function (_super) {
|
|
|
148
148
|
/** @inheritDoc */
|
|
149
149
|
_this.axisTitleColor = "#777777FF";
|
|
150
150
|
/** @inheritDoc */
|
|
151
|
+
_this.chartTitleColor = "#777777FF";
|
|
152
|
+
/** @inheritDoc */
|
|
151
153
|
_this.shadowEffectColor = "#A0AABAFA";
|
|
152
154
|
/** @inheritDoc */
|
|
153
155
|
_this.planeBorderColor = "#EEEEEEFF";
|
|
@@ -360,11 +360,7 @@ var NativeTextAnnotation = /** @class */ (function (_super) {
|
|
|
360
360
|
x1 -= textBounds.m_fWidth;
|
|
361
361
|
}
|
|
362
362
|
if (this.verticalAnchorPointProperty === AnchorPoint_1.EVerticalAnchorPoint.Center) {
|
|
363
|
-
y1
|
|
364
|
-
y1 -=
|
|
365
|
-
((textBounds.GetLineBounds(0).m_fHeight - textBounds.GetLineBounds(0).m_fOffsetY) *
|
|
366
|
-
(textBounds.GetLinesCount() - 1)) /
|
|
367
|
-
2;
|
|
363
|
+
y1 -= textBounds.m_fHeight / 2 - textBounds.GetLineBounds(0).m_fHeight;
|
|
368
364
|
}
|
|
369
365
|
else if (this.verticalAnchorPointProperty === AnchorPoint_1.EVerticalAnchorPoint.Top) {
|
|
370
366
|
y1 += textBounds.GetLineBounds(0).m_fHeight;
|
|
@@ -297,7 +297,8 @@ var SvgAnnotationBase = /** @class */ (function (_super) {
|
|
|
297
297
|
return;
|
|
298
298
|
var borderX1 = this.getX1Coordinate(xCalc, yCalc) + this.xCoordShift;
|
|
299
299
|
var borderY1 = this.getY1Coordinate(xCalc, yCalc) + this.yCoordShift;
|
|
300
|
-
|
|
300
|
+
// @ts-ignore
|
|
301
|
+
this.svgDOMRect = this.svg.getBBox();
|
|
301
302
|
var borderX2 = borderX1 + this.svgDOMRect.width;
|
|
302
303
|
var borderY2 = borderY1 + this.svgDOMRect.height;
|
|
303
304
|
if (this.verticalAnchorPoint === AnchorPoint_1.EVerticalAnchorPoint.Bottom) {
|
|
@@ -114,7 +114,7 @@ var AxisBase2D = /** @class */ (function (_super) {
|
|
|
114
114
|
color: SciChartSurfaceBase_1.SciChartSurfaceBase.DEFAULT_THEME.tickTextBrush,
|
|
115
115
|
fontWeight: "normal",
|
|
116
116
|
fontStyle: "normal",
|
|
117
|
-
padding: Thickness_1.Thickness.fromString("2 4
|
|
117
|
+
padding: Thickness_1.Thickness.fromString("2 4 2 4"),
|
|
118
118
|
alignment: LabelAlignment_1.ELabelAlignment.Auto
|
|
119
119
|
};
|
|
120
120
|
_this.isInnerAxisProperty = false;
|
|
@@ -1226,5 +1226,5 @@ var AxisBase2D = /** @class */ (function (_super) {
|
|
|
1226
1226
|
exports.AxisBase2D = AxisBase2D;
|
|
1227
1227
|
/** @ignore */
|
|
1228
1228
|
var getPenForLines = function (penCache, stroke, strokeThickness, strokeDashArray) {
|
|
1229
|
-
return (0, Pen2DCache_1.createPenInCache)(penCache, stroke, strokeThickness, 1, strokeDashArray);
|
|
1229
|
+
return (0, Pen2DCache_1.createPenInCache)(penCache, stroke, strokeThickness, 1, strokeDashArray, false);
|
|
1230
1230
|
};
|
|
@@ -7,6 +7,7 @@ import { Thickness } from "../../../Core/Thickness";
|
|
|
7
7
|
import { EAutoRange } from "../../../types/AutoRange";
|
|
8
8
|
import { EAxisType } from "../../../types/AxisType";
|
|
9
9
|
import { ELabelAlignment } from "../../../types/LabelAlignment";
|
|
10
|
+
import { EMultiLineAlignment } from "../../../types/TextPosition";
|
|
10
11
|
import { CoordinateCalculatorBase } from "../../Numerics/CoordinateCalculators/CoordinateCalculatorBase";
|
|
11
12
|
import { TickCoordinatesProvider } from "../../Numerics/TickCoordinateProviders/TickCoordinatesProvider";
|
|
12
13
|
import { TickProvider } from "../../Numerics/TickProviders/TickProvider";
|
|
@@ -58,8 +59,15 @@ export declare type TTextStyle = {
|
|
|
58
59
|
* If you are using text labels rather than just numbers, or when using native text, you may want to increase the bottom padding.
|
|
59
60
|
*/
|
|
60
61
|
padding?: Thickness;
|
|
61
|
-
/**
|
|
62
|
+
/**
|
|
63
|
+
* Horizontal label alignment for vertical axes. Default Auto.
|
|
64
|
+
* @privateRemarks This property should only be used for axis labels.
|
|
65
|
+
* So the current type definition should be changed in future versions, specifically this property may be renamed or removed.
|
|
66
|
+
* In other cases, e.g. for multiline text alignment use TTextStyle.multilineAlignment
|
|
67
|
+
*/
|
|
62
68
|
alignment?: ELabelAlignment;
|
|
69
|
+
/** Horizontal text alignment for multiline text. */
|
|
70
|
+
multilineAlignment?: EMultiLineAlignment;
|
|
63
71
|
};
|
|
64
72
|
/**
|
|
65
73
|
* Interface to minimal set of parameters which define an {@link AxisCore | Axis} in SciChart
|
|
@@ -262,7 +262,7 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
262
262
|
try {
|
|
263
263
|
if (nativeFont) {
|
|
264
264
|
var tx = xCoord + viewRect.left + padding.left;
|
|
265
|
-
var ty = yCoord + viewRect.top + lineHeight
|
|
265
|
+
var ty = yCoord + viewRect.top + lineHeight + padding.top;
|
|
266
266
|
var rx = tx;
|
|
267
267
|
var ry = ty - lineHeight;
|
|
268
268
|
if (rotationRad !== 0) {
|
|
@@ -323,7 +323,7 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
323
323
|
try {
|
|
324
324
|
if (nativeFont) {
|
|
325
325
|
var tx = xCoord + viewRect.left + padding.left;
|
|
326
|
-
var ty = yCoord + viewRect.top + lineHeight
|
|
326
|
+
var ty = yCoord + viewRect.top + lineHeight + padding.top;
|
|
327
327
|
nativeFont.DrawStringAdvanced(labelText !== null && labelText !== void 0 ? labelText : "", textColor, Math.round(tx), Math.round(ty), (0, NativeObject_1.getVector4)(this.webAssemblyContext, tx, ty, rotationRad, 0), multiLineAlignment, nativeLineSpacing);
|
|
328
328
|
}
|
|
329
329
|
else {
|
|
@@ -2,15 +2,20 @@ import { Rect } from "../../../Core/Rect";
|
|
|
2
2
|
import { EAxisAlignment } from "../../../types/AxisAlignment";
|
|
3
3
|
import { TSciChart } from "../../../types/TSciChart";
|
|
4
4
|
import { WebGlRenderContext2D } from "../../Drawing/WebGlRenderContext2D";
|
|
5
|
-
import { TextureManager } from "../TextureManager/TextureManager";
|
|
5
|
+
import { TextureManager, TTextureObject } from "../TextureManager/TextureManager";
|
|
6
6
|
import { TTextStyle } from "./AxisCore";
|
|
7
7
|
/**
|
|
8
8
|
* Draws an axis title using our WebGL Rendering engine
|
|
9
9
|
*/
|
|
10
10
|
export declare class AxisTitleRenderer {
|
|
11
|
+
useCache: boolean;
|
|
11
12
|
viewRect: Rect;
|
|
12
13
|
text: string | string[];
|
|
13
14
|
lineSpacing: number;
|
|
15
|
+
private previousText;
|
|
16
|
+
private textStyle;
|
|
17
|
+
private previousLineSpacing;
|
|
18
|
+
private texture;
|
|
14
19
|
private webAssemblyContext;
|
|
15
20
|
private desiredHeightProperty;
|
|
16
21
|
private desiredWidthProperty;
|
|
@@ -22,6 +27,6 @@ export declare class AxisTitleRenderer {
|
|
|
22
27
|
get desiredWidth(): number;
|
|
23
28
|
set desiredWidth(value: number);
|
|
24
29
|
layout(rect: Rect): void;
|
|
25
|
-
getTitleTexture(text: string | string[], textStyle: TTextStyle, textureManager: TextureManager):
|
|
30
|
+
getTitleTexture(text: string | string[], textStyle: TTextStyle, textureManager: TextureManager): TTextureObject;
|
|
26
31
|
draw(renderContext: WebGlRenderContext2D, textStyle: TTextStyle, axisAlignment: EAxisAlignment, debugRendering: boolean): void;
|
|
27
32
|
}
|
|
@@ -12,6 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.AxisTitleRenderer = void 0;
|
|
15
|
+
var Deleter_1 = require("../../../Core/Deleter");
|
|
15
16
|
var Rect_1 = require("../../../Core/Rect");
|
|
16
17
|
var Thickness_1 = require("../../../Core/Thickness");
|
|
17
18
|
var AxisAlignment_1 = require("../../../types/AxisAlignment");
|
|
@@ -29,6 +30,7 @@ var PADDING = {
|
|
|
29
30
|
*/
|
|
30
31
|
var AxisTitleRenderer = /** @class */ (function () {
|
|
31
32
|
function AxisTitleRenderer(webAssemblyContext) {
|
|
33
|
+
this.useCache = true;
|
|
32
34
|
this.viewRect = Rect_1.Rect.createZero();
|
|
33
35
|
this.text = "";
|
|
34
36
|
this.lineSpacing = 1.1;
|
|
@@ -80,8 +82,20 @@ var AxisTitleRenderer = /** @class */ (function () {
|
|
|
80
82
|
this.viewRect = rect;
|
|
81
83
|
};
|
|
82
84
|
AxisTitleRenderer.prototype.getTitleTexture = function (text, textStyle, textureManager) {
|
|
85
|
+
if (this.useCache &&
|
|
86
|
+
this.texture &&
|
|
87
|
+
text === this.previousText &&
|
|
88
|
+
this.lineSpacing === this.previousLineSpacing &&
|
|
89
|
+
checkAreEqualTextStyles(textStyle, this.textStyle)) {
|
|
90
|
+
return this.texture;
|
|
91
|
+
}
|
|
92
|
+
this.previousLineSpacing = this.lineSpacing;
|
|
93
|
+
this.previousText = text;
|
|
94
|
+
this.textStyle = textStyle;
|
|
83
95
|
var lines = Array.isArray(text) ? text : [text];
|
|
84
|
-
|
|
96
|
+
var texture = textureManager.createTextTexture(lines, __assign(__assign({}, textStyle), { padding: new Thickness_1.Thickness(0, 0, 0, 0) }), 0, this.lineSpacing);
|
|
97
|
+
this.texture = texture;
|
|
98
|
+
return texture;
|
|
85
99
|
};
|
|
86
100
|
AxisTitleRenderer.prototype.draw = function (renderContext, textStyle, axisAlignment, debugRendering) {
|
|
87
101
|
if (!this.text)
|
|
@@ -121,8 +135,20 @@ var AxisTitleRenderer = /** @class */ (function () {
|
|
|
121
135
|
nativeContext.DrawTexture(bitmapTexture, 0, 0, textureWidth, textureHeight);
|
|
122
136
|
nativeContext.PopMatrix();
|
|
123
137
|
}
|
|
124
|
-
|
|
138
|
+
if (!this.useCache) {
|
|
139
|
+
(0, Deleter_1.deleteSafe)(bitmapTexture);
|
|
140
|
+
this.texture = undefined;
|
|
141
|
+
}
|
|
125
142
|
};
|
|
126
143
|
return AxisTitleRenderer;
|
|
127
144
|
}());
|
|
128
145
|
exports.AxisTitleRenderer = AxisTitleRenderer;
|
|
146
|
+
var checkAreEqualTextStyles = function (style1, style2) {
|
|
147
|
+
return (style1.color === style2.color &&
|
|
148
|
+
style1.fontFamily === style2.fontFamily &&
|
|
149
|
+
style1.fontSize === style2.fontSize &&
|
|
150
|
+
style1.fontStyle === style2.fontStyle &&
|
|
151
|
+
style1.fontWeight === style2.fontWeight &&
|
|
152
|
+
style1.multilineAlignment === style2.multilineAlignment &&
|
|
153
|
+
((style1.padding === undefined && style2.padding === undefined) || style1.padding.equals(style2.padding)));
|
|
154
|
+
};
|
|
@@ -13,17 +13,12 @@ export declare class LabelInfo {
|
|
|
13
13
|
textureHeight: number;
|
|
14
14
|
textureWidth: number;
|
|
15
15
|
lastUsed: number;
|
|
16
|
-
private subs;
|
|
17
16
|
constructor(tick: number, text: string, bitmapTexture: TSRTexture, textureHeight: number, textureWidth: number);
|
|
18
|
-
registerNotifier(callback: () => void): void;
|
|
19
|
-
textureUpdated(): void;
|
|
20
17
|
}
|
|
21
18
|
export interface ILabel2DOptions extends ILabelOptions {
|
|
22
19
|
rotation?: number;
|
|
23
20
|
/**
|
|
24
|
-
*
|
|
25
|
-
* Can be set globally using SciChartDefaults.asyncLabels = true;
|
|
26
|
-
* When false getLabelTexture is used. When true, getLabelTextureAsync is used.
|
|
21
|
+
* @deprecated This functionality has been removed. useNativeText: true provides much greater performance benefit.
|
|
27
22
|
*/
|
|
28
23
|
asyncLabels?: boolean;
|
|
29
24
|
/**
|
|
@@ -53,8 +48,7 @@ export declare abstract class LabelProviderBase2D extends LabelProvider implemen
|
|
|
53
48
|
*/
|
|
54
49
|
useSharedCache: boolean;
|
|
55
50
|
/**
|
|
56
|
-
*
|
|
57
|
-
* Can be set globally using SciChartDefaults. Currently default false.
|
|
51
|
+
* @deprecated This functionality has been removed. useNativeText: true provides much greater performance benefit.
|
|
58
52
|
*/
|
|
59
53
|
asyncLabels: boolean;
|
|
60
54
|
/**
|
|
@@ -132,13 +126,12 @@ export declare abstract class LabelProviderBase2D extends LabelProvider implemen
|
|
|
132
126
|
*/
|
|
133
127
|
getCachedLabelTexture(labelText: string, textureManager: TextureManager, labelStyle: TTextStyle): TTextureObject;
|
|
134
128
|
/**
|
|
135
|
-
*
|
|
136
|
-
* If
|
|
137
|
-
* otherwise other axes using the same style and text may see your custom texture. Alternatively you can override getCachedStyle or set styleId directly
|
|
129
|
+
* @deprecated AsyncLabels have been removed. useNativeText: true provides much greater performance benefit.
|
|
130
|
+
* If using texture labels override getLabelTexture instead
|
|
138
131
|
*/
|
|
139
132
|
getLabelTextureAsync(labelText: string, textureManager: TextureManager, labelStyle: TTextStyle): Promise<TTextureObject>;
|
|
140
133
|
/**
|
|
141
|
-
* Create a texture for the given label text. This method is called if
|
|
134
|
+
* Create a texture for the given label text. This method is called if useNativeText is false.
|
|
142
135
|
* If overriding this method with useSharedCache = true, consider setting it false for this LabelProvider,
|
|
143
136
|
* otherwise other axes using the same style and text may see your custom texture. Alternatively you can override getCachedStyle or set styleId directly
|
|
144
137
|
*/
|
|
@@ -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
|
/**
|