scichart 3.0.317 → 3.1.333
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 +33 -0
- package/Charting/Services/ChartTitleRenderer.js +149 -0
- package/Charting/Services/SciChartRenderer.d.ts +7 -1
- package/Charting/Services/SciChartRenderer.js +54 -8
- package/Charting/Services/TitleRenderer.d.ts +98 -0
- package/Charting/Services/TitleRenderer.js +249 -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 +7 -16
- package/Charting/Visuals/Axis/AxisCore.d.ts +9 -1
- package/Charting/Visuals/Axis/AxisRenderer.js +2 -2
- package/Charting/Visuals/Axis/AxisTitleRenderer.d.ts +14 -13
- package/Charting/Visuals/Axis/AxisTitleRenderer.js +102 -90
- package/Charting/Visuals/Axis/LabelProvider/LabelCache.js +1 -0
- 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 +31 -0
- package/Charting/Visuals/SciChartSurface.js +108 -6
- package/Charting/Visuals/TextureManager/DpiHelper.js +1 -1
- package/Charting/Visuals/TextureManager/TextureManager.js +34 -19
- 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 +1 -1
- package/_wasm/scichart2d.wasm +0 -0
- package/_wasm/scichart3d.js +7 -7
- package/_wasm/scichart3d.wasm +0 -0
- package/constants/app.js +2 -1
- 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
|
@@ -1,61 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
for (var p in
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
10
8
|
};
|
|
11
|
-
return
|
|
12
|
-
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
13
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
18
|
exports.AxisTitleRenderer = void 0;
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var parseColor_1 = require("../../../utils/parseColor");
|
|
19
|
-
var WebGlPen_1 = require("../../Drawing/WebGlPen");
|
|
20
|
-
var TextureManager_1 = require("../TextureManager/TextureManager");
|
|
21
|
-
/** @ignore */
|
|
22
|
-
var PADDING = {
|
|
23
|
-
// TOP: 13,
|
|
24
|
-
// BOTTOM: 8,
|
|
25
|
-
NO_TITLE: 0
|
|
26
|
-
};
|
|
19
|
+
var LabelAlignment_1 = require("../../../types/LabelAlignment");
|
|
20
|
+
var TextStyle_1 = require("../../../types/TextStyle");
|
|
21
|
+
var TitleRenderer_1 = require("../../Services/TitleRenderer");
|
|
27
22
|
/**
|
|
28
23
|
* Draws an axis title using our WebGL Rendering engine
|
|
29
24
|
*/
|
|
30
|
-
var AxisTitleRenderer = /** @class */ (function () {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
this.desiredWidthProperty = 0;
|
|
37
|
-
this.webAssemblyContext = webAssemblyContext;
|
|
38
|
-
this.textureManager = new TextureManager_1.TextureManager(webAssemblyContext);
|
|
25
|
+
var AxisTitleRenderer = /** @class */ (function (_super) {
|
|
26
|
+
__extends(AxisTitleRenderer, _super);
|
|
27
|
+
function AxisTitleRenderer() {
|
|
28
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
29
|
+
_this.lineSpacing = 1.1;
|
|
30
|
+
return _this;
|
|
39
31
|
}
|
|
40
|
-
AxisTitleRenderer.prototype.measure = function (textStyle,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
this.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
32
|
+
AxisTitleRenderer.prototype.measure = function (text, textStyle, axisAlignment) {
|
|
33
|
+
if (text === void 0) { text = ""; }
|
|
34
|
+
this.text = text;
|
|
35
|
+
var shouldUpdateTextSize = !this.useCache ||
|
|
36
|
+
(!this.texture && !this.useNativeText) ||
|
|
37
|
+
this.text !== this.previousText ||
|
|
38
|
+
this.lineSpacing !== this.previousLineSpacing ||
|
|
39
|
+
axisAlignment !== this.previousAxisAlignment ||
|
|
40
|
+
this.previousNativeTextMode !== this.useNativeText ||
|
|
41
|
+
!checkAreEqualTextStyles(textStyle, this.textStyle);
|
|
42
|
+
if (shouldUpdateTextSize) {
|
|
43
|
+
this.invalidateCache();
|
|
44
|
+
this.previousLineSpacing = this.lineSpacing;
|
|
45
|
+
this.previousNativeTextMode = this.useNativeText;
|
|
46
|
+
this.previousAxisAlignment = axisAlignment;
|
|
47
|
+
this.previousText = text;
|
|
48
|
+
this.textStyle = textStyle;
|
|
49
|
+
this.titlePosition = TextStyle_1.ETitlePosition[axisAlignment];
|
|
50
|
+
this.textStyle = textStyle;
|
|
51
|
+
// @ts-ignore mismatch with TTextStyle
|
|
52
|
+
this.textStyle.lineSpacing = this.lineSpacing;
|
|
53
|
+
var renderContext = this.parentSurface.currentWebGlRenderContext;
|
|
54
|
+
// @ts-ignore mismatch with TTextStyle
|
|
55
|
+
this.getTextSize(text, this.textStyle, renderContext);
|
|
57
56
|
}
|
|
58
57
|
};
|
|
58
|
+
Object.defineProperty(AxisTitleRenderer.prototype, "useNativeText", {
|
|
59
|
+
get: function () {
|
|
60
|
+
return this.useNativeTextProperty;
|
|
61
|
+
},
|
|
62
|
+
set: function (value) {
|
|
63
|
+
this.useNativeTextProperty = value;
|
|
64
|
+
},
|
|
65
|
+
enumerable: false,
|
|
66
|
+
configurable: true
|
|
67
|
+
});
|
|
59
68
|
Object.defineProperty(AxisTitleRenderer.prototype, "desiredHeight", {
|
|
60
69
|
get: function () {
|
|
61
70
|
return this.desiredHeightProperty;
|
|
@@ -77,52 +86,55 @@ var AxisTitleRenderer = /** @class */ (function () {
|
|
|
77
86
|
configurable: true
|
|
78
87
|
});
|
|
79
88
|
AxisTitleRenderer.prototype.layout = function (rect) {
|
|
80
|
-
this.
|
|
81
|
-
|
|
82
|
-
AxisTitleRenderer.prototype.getTitleTexture = function (text, textStyle, textureManager) {
|
|
83
|
-
var lines = Array.isArray(text) ? text : [text];
|
|
84
|
-
return textureManager.createTextTexture(lines, __assign(__assign({}, textStyle), { padding: new Thickness_1.Thickness(0, 0, 0, 0) }), 0, this.lineSpacing);
|
|
85
|
-
};
|
|
86
|
-
AxisTitleRenderer.prototype.draw = function (renderContext, textStyle, axisAlignment, debugRendering) {
|
|
87
|
-
if (!this.text)
|
|
89
|
+
if (!this.text) {
|
|
90
|
+
this.viewRectProperty = rect;
|
|
88
91
|
return;
|
|
89
|
-
var nativeContext = renderContext.getNativeContext();
|
|
90
|
-
var _a = this.getTitleTexture(this.text, textStyle, this.textureManager), bitmapTexture = _a.bitmapTexture, textureHeight = _a.textureHeight, textureWidth = _a.textureWidth;
|
|
91
|
-
var padding = textStyle.padding;
|
|
92
|
-
if (axisAlignment === AxisAlignment_1.EAxisAlignment.Top || axisAlignment === AxisAlignment_1.EAxisAlignment.Bottom) {
|
|
93
|
-
var deltaToCenter = (this.viewRect.width - textureWidth) / 2;
|
|
94
|
-
var xPositionCenter = this.viewRect.x + deltaToCenter;
|
|
95
|
-
var yPosition = this.viewRect.y + (padding === null || padding === void 0 ? void 0 : padding.top);
|
|
96
|
-
// (axisAlignment === EAxisAlignment.Bottom ? padding?.top : padding?.bottom);
|
|
97
|
-
nativeContext.DrawTexture(bitmapTexture, Math.round(xPositionCenter), Math.round(yPosition), textureWidth, textureHeight);
|
|
98
|
-
// for debugging width and height measure
|
|
99
|
-
if (debugRendering) {
|
|
100
|
-
var pen = new WebGlPen_1.WebGlPen(new this.webAssemblyContext.SCRTPen((0, parseColor_1.parseColorToUIntArgb)("Red"), 1, true));
|
|
101
|
-
renderContext.drawRect(new Rect_1.Rect(xPositionCenter, yPosition, textureWidth, textureHeight), Rect_1.Rect.create(0, 0, 999, 999), pen);
|
|
102
|
-
pen.delete();
|
|
103
|
-
}
|
|
104
|
-
// End debug
|
|
105
92
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
93
|
+
var alignment = convertLabelAlignmentToTextAlignment(this.textStyle.alignment);
|
|
94
|
+
this.viewRectProperty = this.getViewRect(this.text, rect, this.titlePosition, alignment);
|
|
95
|
+
};
|
|
96
|
+
AxisTitleRenderer.prototype.getTitleTexture = function () {
|
|
97
|
+
var position = this.titlePosition;
|
|
98
|
+
var adjRotation = 0;
|
|
99
|
+
// let adjRotation = this.textStyle.rotation;
|
|
100
|
+
if (position === TextStyle_1.ETitlePosition.Left) {
|
|
101
|
+
adjRotation += -90;
|
|
114
102
|
}
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
nativeContext.Rotate(90);
|
|
118
|
-
var deltaToCenter = (this.viewRect.height - textureWidth) / 2;
|
|
119
|
-
var xPositionCenter = this.viewRect.y + deltaToCenter;
|
|
120
|
-
nativeContext.Translate(Math.round(xPositionCenter), Math.round(-(this.viewRect.x + this.viewRect.width) + (padding === null || padding === void 0 ? void 0 : padding.right)));
|
|
121
|
-
nativeContext.DrawTexture(bitmapTexture, 0, 0, textureWidth, textureHeight);
|
|
122
|
-
nativeContext.PopMatrix();
|
|
103
|
+
else if (position === TextStyle_1.ETitlePosition.Right) {
|
|
104
|
+
adjRotation += 90;
|
|
123
105
|
}
|
|
124
|
-
|
|
106
|
+
var titleText = Array.isArray(this.text) ? this.text : this.text.split("\n");
|
|
107
|
+
var texture = this.textureManager.createTextTexture(titleText,
|
|
108
|
+
// @ts-ignore mismatch with TTextStyle
|
|
109
|
+
this.textStyle,
|
|
110
|
+
// { ...this.textStyle, padding: new Thickness(0, 0, 0, 0) },
|
|
111
|
+
adjRotation, this.lineSpacing);
|
|
112
|
+
return texture;
|
|
113
|
+
};
|
|
114
|
+
AxisTitleRenderer.prototype.draw = function (renderContext) {
|
|
115
|
+
return this.drawInternal(renderContext, this.useNativeText, this.titlePosition);
|
|
125
116
|
};
|
|
126
117
|
return AxisTitleRenderer;
|
|
127
|
-
}());
|
|
118
|
+
}(TitleRenderer_1.TitleRendererBase));
|
|
128
119
|
exports.AxisTitleRenderer = AxisTitleRenderer;
|
|
120
|
+
var checkAreEqualTextStyles = function (style1, style2) {
|
|
121
|
+
if (!style1 || !style2) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return (style1.color === style2.color &&
|
|
125
|
+
style1.fontFamily === style2.fontFamily &&
|
|
126
|
+
style1.fontSize === style2.fontSize &&
|
|
127
|
+
style1.fontStyle === style2.fontStyle &&
|
|
128
|
+
style1.fontWeight === style2.fontWeight &&
|
|
129
|
+
style1.alignment === style2.alignment &&
|
|
130
|
+
style1.multilineAlignment === style2.multilineAlignment &&
|
|
131
|
+
((style1.padding === undefined && style2.padding === undefined) || style1.padding.equals(style2.padding)));
|
|
132
|
+
};
|
|
133
|
+
// TODO consider refactoring
|
|
134
|
+
// helper function used to unify title renderer types & interfaces
|
|
135
|
+
var convertLabelAlignmentToTextAlignment = function (alignment) {
|
|
136
|
+
if (alignment === LabelAlignment_1.ELabelAlignment.Auto) {
|
|
137
|
+
return TextStyle_1.ETextAlignment.Center;
|
|
138
|
+
}
|
|
139
|
+
return TextStyle_1.ETextAlignment[alignment];
|
|
140
|
+
};
|
|
@@ -113,6 +113,7 @@ var pruneCache = function () {
|
|
|
113
113
|
};
|
|
114
114
|
var checkTextStyleEqual = function (style1, style2) {
|
|
115
115
|
return (style1.alignment === style2.alignment &&
|
|
116
|
+
style1.multilineAlignment === style2.multilineAlignment &&
|
|
116
117
|
style1.color === style2.color &&
|
|
117
118
|
style1.fontFamily === style2.fontFamily &&
|
|
118
119
|
style1.fontSize === style2.fontSize &&
|
|
@@ -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
|
/**
|