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
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TitleRendererBase = void 0;
|
|
4
|
+
var app_1 = require("../../constants/app");
|
|
5
|
+
var Deleter_1 = require("../../Core/Deleter");
|
|
6
|
+
var Rect_1 = require("../../Core/Rect");
|
|
7
|
+
var TextPosition_1 = require("../../types/TextPosition");
|
|
8
|
+
var TextStyle_1 = require("../../types/TextStyle");
|
|
9
|
+
var parseColor_1 = require("../../utils/parseColor");
|
|
10
|
+
var text_1 = require("../../utils/text");
|
|
11
|
+
var createNativeRect_1 = require("../Visuals/Helpers/createNativeRect");
|
|
12
|
+
var NativeObject_1 = require("../Visuals/Helpers/NativeObject");
|
|
13
|
+
var DpiHelper_1 = require("../Visuals/TextureManager/DpiHelper");
|
|
14
|
+
var TextureManager_1 = require("../Visuals/TextureManager/TextureManager");
|
|
15
|
+
var TitleRendererBase = /** @class */ (function () {
|
|
16
|
+
function TitleRendererBase(webAssemblyContext) {
|
|
17
|
+
this.drawDebug = false;
|
|
18
|
+
this.useCache = true;
|
|
19
|
+
this.viewRectProperty = Rect_1.Rect.createZero();
|
|
20
|
+
/**
|
|
21
|
+
* The height taken by the text with normal(horizontal) orientation including padding
|
|
22
|
+
*/
|
|
23
|
+
this.textHeight = 0;
|
|
24
|
+
/**
|
|
25
|
+
* The width taken by the text with normal(horizontal) orientation including padding
|
|
26
|
+
*/
|
|
27
|
+
this.textWidth = 0;
|
|
28
|
+
/**
|
|
29
|
+
* The height taken by the text considering current orientation orientation including padding
|
|
30
|
+
*/
|
|
31
|
+
this.desiredHeightProperty = 0;
|
|
32
|
+
/**
|
|
33
|
+
* The width taken by the text considering current orientation orientation including padding
|
|
34
|
+
*/
|
|
35
|
+
this.desiredWidthProperty = 0;
|
|
36
|
+
this.useNativeTextProperty = false;
|
|
37
|
+
this.webAssemblyContext = webAssemblyContext;
|
|
38
|
+
this.textureManager = new TextureManager_1.TextureManager(webAssemblyContext);
|
|
39
|
+
this.onDpiChanged = this.onDpiChanged.bind(this);
|
|
40
|
+
DpiHelper_1.DpiHelper.dpiChanged.subscribe(this.onDpiChanged);
|
|
41
|
+
}
|
|
42
|
+
Object.defineProperty(TitleRendererBase.prototype, "viewRect", {
|
|
43
|
+
/**
|
|
44
|
+
* Defines a bounding {@link Rect} containing the title text
|
|
45
|
+
*/
|
|
46
|
+
get: function () {
|
|
47
|
+
return this.viewRectProperty;
|
|
48
|
+
},
|
|
49
|
+
enumerable: false,
|
|
50
|
+
configurable: true
|
|
51
|
+
});
|
|
52
|
+
// TODO consider if this class should be abstract
|
|
53
|
+
TitleRendererBase.prototype.measure = function () {
|
|
54
|
+
var params = [];
|
|
55
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
56
|
+
params[_i] = arguments[_i];
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
TitleRendererBase.prototype.layout = function (originRect) { };
|
|
60
|
+
TitleRendererBase.prototype.draw = function () {
|
|
61
|
+
var params = [];
|
|
62
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
63
|
+
params[_i] = arguments[_i];
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
TitleRendererBase.prototype.delete = function () {
|
|
67
|
+
this.resetCache();
|
|
68
|
+
DpiHelper_1.DpiHelper.dpiChanged.unsubscribe(this.onDpiChanged);
|
|
69
|
+
};
|
|
70
|
+
TitleRendererBase.prototype.resetCache = function () {
|
|
71
|
+
this.invalidateCache();
|
|
72
|
+
this.textStyle = undefined;
|
|
73
|
+
this.originalTextStyle = undefined;
|
|
74
|
+
};
|
|
75
|
+
TitleRendererBase.prototype.invalidateCache = function () {
|
|
76
|
+
var _a;
|
|
77
|
+
(0, Deleter_1.deleteSafe)((_a = this.texture) === null || _a === void 0 ? void 0 : _a.bitmapTexture);
|
|
78
|
+
this.texture = undefined;
|
|
79
|
+
};
|
|
80
|
+
TitleRendererBase.prototype.onDpiChanged = function (args) {
|
|
81
|
+
this.resetCache();
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Performs rendering of the title
|
|
85
|
+
*/
|
|
86
|
+
TitleRendererBase.prototype.drawInternal = function (renderContext, useNativeText, titlePosition) {
|
|
87
|
+
if (!this.text || this.text.length === 0) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (useNativeText) {
|
|
91
|
+
this.drawWithNativeText(renderContext, titlePosition);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
this.drawWithTexture(renderContext, titlePosition);
|
|
95
|
+
}
|
|
96
|
+
// if (this.drawDebug) {
|
|
97
|
+
// this.drawTitleDebugViewRect(renderContext);
|
|
98
|
+
// }
|
|
99
|
+
};
|
|
100
|
+
TitleRendererBase.prototype.drawWithNativeText = function (renderContext, position) {
|
|
101
|
+
var titleText = Array.isArray(this.text) ? this.text.join("\n") : this.text;
|
|
102
|
+
// @ts-ignore mismatch with TTextStyle
|
|
103
|
+
var nativeFont = renderContext.getFont(this.textStyle, true);
|
|
104
|
+
// calculate start coordinates for native text drawing;
|
|
105
|
+
// the start point is the beginning of alphabetic text baseline
|
|
106
|
+
var tx = this.viewRect.left + this.textStyle.padding.left;
|
|
107
|
+
var ty = this.viewRect.top + this.textStyle.padding.top + this.firstLineAscent;
|
|
108
|
+
var adjRotation = 0;
|
|
109
|
+
// let adjRotation = this.textStyle.rotation;
|
|
110
|
+
if (position === TextStyle_1.ETitlePosition.Left) {
|
|
111
|
+
adjRotation += -90;
|
|
112
|
+
tx = this.viewRect.left + this.textStyle.padding.top + this.firstLineAscent;
|
|
113
|
+
ty = this.viewRect.bottom - this.textStyle.padding.left;
|
|
114
|
+
}
|
|
115
|
+
else if (position === TextStyle_1.ETitlePosition.Right) {
|
|
116
|
+
adjRotation += 90;
|
|
117
|
+
tx = this.viewRect.right - this.textStyle.padding.top - this.firstLineAscent;
|
|
118
|
+
ty = this.viewRect.top + this.textStyle.padding.left;
|
|
119
|
+
}
|
|
120
|
+
var rotationRad = -(adjRotation * Math.PI) / 180;
|
|
121
|
+
var nativeMultilineAlignment = (0, TextPosition_1.convertMultiLineAlignment)(this.textStyle.multilineAlignment, this.webAssemblyContext);
|
|
122
|
+
var textColor = (0, parseColor_1.parseColorToUIntArgb)(this.textStyle.color);
|
|
123
|
+
nativeFont.DrawStringAdvanced(titleText, textColor, Math.round(tx), Math.round(ty), (0, NativeObject_1.getVector4)(this.webAssemblyContext, tx, ty, rotationRad, 0), nativeMultilineAlignment, this.nativeLineSpacing);
|
|
124
|
+
};
|
|
125
|
+
TitleRendererBase.prototype.drawWithTexture = function (renderContext, titlePosition) {
|
|
126
|
+
var _a = this.texture, bitmapTexture = _a.bitmapTexture, textureHeight = _a.textureHeight, textureWidth = _a.textureWidth;
|
|
127
|
+
if (bitmapTexture) {
|
|
128
|
+
try {
|
|
129
|
+
var nativeContext = renderContext.getNativeContext();
|
|
130
|
+
nativeContext.DrawTexture(bitmapTexture, Math.round(this.viewRect.left), Math.round(this.viewRect.top), textureWidth, textureHeight);
|
|
131
|
+
if (!this.useCache) {
|
|
132
|
+
bitmapTexture.delete();
|
|
133
|
+
this.texture = undefined;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
console.error("Error while drawing title: ", err);
|
|
138
|
+
// webgl context probably lost. Clear the cache
|
|
139
|
+
this.resetCache();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* Calculates width and hight of the title text
|
|
145
|
+
*/
|
|
146
|
+
TitleRendererBase.prototype.getTextSize = function (title, textStyle, renderContext) {
|
|
147
|
+
if (title === void 0) { title = ""; }
|
|
148
|
+
if (!title || title.length === 0) {
|
|
149
|
+
this.desiredHeightProperty = 0;
|
|
150
|
+
this.desiredWidthProperty = 0;
|
|
151
|
+
this.textHeight = 0;
|
|
152
|
+
this.textWidth = 0;
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
var hasHorizontalPlacement = (0, TextStyle_1.getIsHorizontalPlacement)(this.titlePosition);
|
|
156
|
+
if (this.useNativeTextProperty) {
|
|
157
|
+
// @ts-ignore mismatch with TTextStyle
|
|
158
|
+
var nativeFont = renderContext.getFont(textStyle, !hasHorizontalPlacement);
|
|
159
|
+
var titleString = Array.isArray(title) ? title.join("\n") : title;
|
|
160
|
+
var _a = (0, text_1.getNativeTextSize)(titleString, nativeFont, textStyle, this.webAssemblyContext), textHeight = _a.textHeight, textWidth = _a.textWidth, nativeLineSpacing = _a.nativeLineSpacing, firstLineAscent = _a.firstLineAscent;
|
|
161
|
+
this.textHeight = textHeight;
|
|
162
|
+
this.textWidth = textWidth;
|
|
163
|
+
this.nativeLineSpacing = nativeLineSpacing;
|
|
164
|
+
this.firstLineAscent = firstLineAscent;
|
|
165
|
+
this.desiredHeightProperty = hasHorizontalPlacement ? this.textHeight : this.textWidth;
|
|
166
|
+
this.desiredWidthProperty = hasHorizontalPlacement ? this.textWidth : this.textHeight;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
// current title texture doesn't include paddings, so they should be added here
|
|
170
|
+
var texture = this.getTitleTexture();
|
|
171
|
+
this.texture = texture;
|
|
172
|
+
this.desiredHeightProperty = texture.textureHeight;
|
|
173
|
+
this.desiredWidthProperty = texture.textureWidth;
|
|
174
|
+
this.textHeight = hasHorizontalPlacement ? this.desiredHeightProperty : this.desiredWidthProperty;
|
|
175
|
+
this.textWidth = hasHorizontalPlacement ? this.desiredWidthProperty : this.desiredHeightProperty;
|
|
176
|
+
}
|
|
177
|
+
if (app_1.IS_TEST_ENV) {
|
|
178
|
+
if (hasHorizontalPlacement) {
|
|
179
|
+
this.desiredHeightProperty =
|
|
180
|
+
(0, TextureManager_1.measureTextHeight)(textStyle.fontSize) + this.textStyle.padding.top + this.textStyle.padding.bottom;
|
|
181
|
+
this.desiredWidthProperty = 0;
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
this.desiredHeightProperty = 0;
|
|
185
|
+
this.desiredWidthProperty =
|
|
186
|
+
(0, TextureManager_1.measureTextHeight)(textStyle.fontSize) + this.textStyle.padding.top + this.textStyle.padding.bottom;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
TitleRendererBase.prototype.getTitleTexture = function () {
|
|
191
|
+
// TODO this is not used at the moment; consider unifying logic for Chart Title Renderer and Axis Title Renderer
|
|
192
|
+
var titleText = Array.isArray(this.text) ? this.text : this.text.split("\n");
|
|
193
|
+
var texture = this.textureManager.createTextTexture(titleText,
|
|
194
|
+
// @ts-ignore mismatch with TTextStyle
|
|
195
|
+
this.textStyle
|
|
196
|
+
// { ...this.textStyle, padding: new Thickness(0, 0, 0, 0) },
|
|
197
|
+
);
|
|
198
|
+
return texture;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Calculates the {@link TitleRenderer.viewRect}
|
|
202
|
+
*/
|
|
203
|
+
TitleRendererBase.prototype.getViewRect = function (title, originRect, titlePosition, alignment) {
|
|
204
|
+
if (title === void 0) { title = ""; }
|
|
205
|
+
if (!title || title.length === 0) {
|
|
206
|
+
return Rect_1.Rect.createZero();
|
|
207
|
+
}
|
|
208
|
+
var hasHorizontalPlacement = (0, TextStyle_1.getIsHorizontalPlacement)(titlePosition);
|
|
209
|
+
var alignmentDelta = this.getAlignmentAdjustmentDelta(hasHorizontalPlacement ? originRect.width : originRect.height, titlePosition, alignment);
|
|
210
|
+
switch (titlePosition) {
|
|
211
|
+
case TextStyle_1.ETitlePosition.Top:
|
|
212
|
+
return new Rect_1.Rect(originRect.x + alignmentDelta, originRect.y, this.textWidth, this.textHeight);
|
|
213
|
+
case TextStyle_1.ETitlePosition.Bottom:
|
|
214
|
+
return new Rect_1.Rect(originRect.x + alignmentDelta, originRect.bottom - this.textHeight, this.textWidth, this.textHeight);
|
|
215
|
+
case TextStyle_1.ETitlePosition.Left:
|
|
216
|
+
return new Rect_1.Rect(originRect.x, originRect.y + alignmentDelta, this.textHeight, this.textWidth);
|
|
217
|
+
case TextStyle_1.ETitlePosition.Right:
|
|
218
|
+
return new Rect_1.Rect(originRect.right - this.textHeight, originRect.y + alignmentDelta, this.textHeight, this.textWidth);
|
|
219
|
+
default:
|
|
220
|
+
return (0, TextStyle_1.handleInvalidChartTitlePosition)(titlePosition);
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
TitleRendererBase.prototype.drawTitleDebugViewRect = function (renderContext) {
|
|
224
|
+
var viewRect = this.viewRect;
|
|
225
|
+
var vecRects = (0, NativeObject_1.getVectorRectVertex)(this.webAssemblyContext);
|
|
226
|
+
var brush = new this.webAssemblyContext.SCRTSolidBrush((0, parseColor_1.parseColorToUIntArgb)("rgba(0,255,0,0.7)"), false);
|
|
227
|
+
var nativeRect = (0, createNativeRect_1.createNativeRect)(this.webAssemblyContext, 0, 0, viewRect.width, viewRect.height);
|
|
228
|
+
vecRects.push_back(nativeRect);
|
|
229
|
+
renderContext.drawRects(vecRects, brush, viewRect.left, viewRect.top);
|
|
230
|
+
brush.delete();
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* Calculates the offset of title text alignment defined by {@link TChartTitleStyle.alignment} or {@link TTextStyle.alignment}
|
|
234
|
+
*/
|
|
235
|
+
TitleRendererBase.prototype.getAlignmentAdjustmentDelta = function (availableSpace, position, alignment) {
|
|
236
|
+
switch (alignment) {
|
|
237
|
+
case TextStyle_1.ETextAlignment.Center:
|
|
238
|
+
return availableSpace / 2 - this.textWidth / 2;
|
|
239
|
+
case TextStyle_1.ETextAlignment.Left:
|
|
240
|
+
return position === TextStyle_1.ETitlePosition.Left ? availableSpace - this.textWidth : 0;
|
|
241
|
+
case TextStyle_1.ETextAlignment.Right:
|
|
242
|
+
return position === TextStyle_1.ETitlePosition.Left ? 0 : availableSpace - this.textWidth;
|
|
243
|
+
default:
|
|
244
|
+
return (0, TextStyle_1.handleInvalidTextAlignment)(alignment);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
return TitleRendererBase;
|
|
248
|
+
}());
|
|
249
|
+
exports.TitleRendererBase = TitleRendererBase;
|
|
@@ -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;
|
|
@@ -569,6 +569,7 @@ var AxisBase2D = /** @class */ (function (_super) {
|
|
|
569
569
|
*/
|
|
570
570
|
AxisBase2D.prototype.onAttach = function (parentSurface, isXAxis, isPrimaryAxis) {
|
|
571
571
|
this.parentSurface = parentSurface;
|
|
572
|
+
this.axisTitleRenderer.parentSurface = parentSurface;
|
|
572
573
|
this.setIsXAxis(isXAxis);
|
|
573
574
|
this.isPrimaryAxisProperty = isPrimaryAxis;
|
|
574
575
|
};
|
|
@@ -585,7 +586,7 @@ var AxisBase2D = /** @class */ (function (_super) {
|
|
|
585
586
|
console.log("Measure. fontSize: ".concat(this.labelStyle.fontSize, ", dpiAdjusted: ").concat(this.dpiAdjustedLabelStyle.fontSize));
|
|
586
587
|
}
|
|
587
588
|
this.axisRenderer.measure(this.isHorizontalAxis, this.dpiAdjustedLabelStyle, majorTickLabels, this.getTicksMaxSize(), this.labelProvider, this.drawLabels, drawTicks);
|
|
588
|
-
this.axisTitleRenderer.measure(this.dpiAdjustedAxisTitleStyle, this.
|
|
589
|
+
this.axisTitleRenderer.measure(this.axisTitle, this.dpiAdjustedAxisTitleStyle, this.axisAlignment);
|
|
589
590
|
}
|
|
590
591
|
else {
|
|
591
592
|
this.axisRenderer.desiredHeight = 0;
|
|
@@ -648,7 +649,6 @@ var AxisBase2D = /** @class */ (function (_super) {
|
|
|
648
649
|
var viewTitleRect = _this.axisTitleRenderer.viewRect;
|
|
649
650
|
var brush = _this.solidBrushCacheAxisBackground.newBrush(_this.backgroundColorProperty, false);
|
|
650
651
|
var nativeAxisRect = void 0;
|
|
651
|
-
var nativeTitleRect = void 0;
|
|
652
652
|
// Empty space covering for axis coloring
|
|
653
653
|
// let shift: number = 0;
|
|
654
654
|
// let additionalSize: number = 0;
|
|
@@ -675,17 +675,11 @@ var AxisBase2D = /** @class */ (function (_super) {
|
|
|
675
675
|
// nativeAxisRect = createNativeRect(this.webAssemblyContext2D, 0, 0 - shift, viewAxisRect.width, viewAxisRect.height + additionalSize);
|
|
676
676
|
// nativeTitleRect = createNativeRect(this.webAssemblyContext2D, 0, 0 - shift, viewTitleRect.width, viewTitleRect.height + additionalSize);
|
|
677
677
|
// }
|
|
678
|
-
nativeAxisRect = (0, createNativeRect_1.createNativeRect)(_this.webAssemblyContext2D, 0, 0,
|
|
678
|
+
nativeAxisRect = (0, createNativeRect_1.createNativeRect)(_this.webAssemblyContext2D, 0, 0, _this.viewRect.width, _this.viewRect.height);
|
|
679
679
|
if (nativeAxisRect) {
|
|
680
680
|
var vecRects = (0, NativeObject_1.getVectorRectVertex)(_this.webAssemblyContext2D);
|
|
681
681
|
vecRects.push_back(nativeAxisRect);
|
|
682
|
-
renderContext.drawRects(vecRects, brush,
|
|
683
|
-
}
|
|
684
|
-
nativeTitleRect = (0, createNativeRect_1.createNativeRect)(_this.webAssemblyContext2D, 0, 0, viewTitleRect.width, viewTitleRect.height);
|
|
685
|
-
if (nativeTitleRect) {
|
|
686
|
-
var vecRects = (0, NativeObject_1.getVectorRectVertex)(_this.webAssemblyContext2D);
|
|
687
|
-
vecRects.push_back(nativeTitleRect);
|
|
688
|
-
renderContext.drawRects(vecRects, brush, viewTitleRect.left, viewTitleRect.top);
|
|
682
|
+
renderContext.drawRects(vecRects, brush, _this.viewRect.x, _this.viewRect.y);
|
|
689
683
|
}
|
|
690
684
|
}
|
|
691
685
|
// Draw axis labels
|
|
@@ -703,7 +697,7 @@ var AxisBase2D = /** @class */ (function (_super) {
|
|
|
703
697
|
_this.axisRenderer.drawTicks(renderContext, _this.axisAlignment, _this.isInnerAxis, tickObject.majorTickCoords, _this.offset, penForMajorTickLines, majorTickStyle);
|
|
704
698
|
}
|
|
705
699
|
// Draw axis title
|
|
706
|
-
_this.axisTitleRenderer.draw(renderContext
|
|
700
|
+
_this.axisTitleRenderer.draw(renderContext);
|
|
707
701
|
if (_this.labelProvider.useNativeText && _this.parentSurface.renderNativeAxisLabelsImmediately) {
|
|
708
702
|
renderContext.endFonts(true);
|
|
709
703
|
}
|
|
@@ -1105,9 +1099,6 @@ var AxisBase2D = /** @class */ (function (_super) {
|
|
|
1105
1099
|
* @inheritDoc
|
|
1106
1100
|
*/
|
|
1107
1101
|
AxisBase2D.prototype.notifyPropertyChanged = function (propertyName) {
|
|
1108
|
-
if (propertyName === constants_1.PROPERTY.AXIS_TITLE && this.axisTitleRenderer) {
|
|
1109
|
-
this.axisTitleRenderer.text = this.axisTitle;
|
|
1110
|
-
}
|
|
1111
1102
|
if (propertyName === constants_1.PROPERTY.IS_XAXIS) {
|
|
1112
1103
|
if (this.axisAlignmentProperty === undefined) {
|
|
1113
1104
|
this.axisAlignmentProperty = this.isXAxisProperty ? AxisAlignment_1.EAxisAlignment.Bottom : AxisAlignment_1.EAxisAlignment.Right;
|
|
@@ -1226,5 +1217,5 @@ var AxisBase2D = /** @class */ (function (_super) {
|
|
|
1226
1217
|
exports.AxisBase2D = AxisBase2D;
|
|
1227
1218
|
/** @ignore */
|
|
1228
1219
|
var getPenForLines = function (penCache, stroke, strokeThickness, strokeDashArray) {
|
|
1229
|
-
return (0, Pen2DCache_1.createPenInCache)(penCache, stroke, strokeThickness, 1, strokeDashArray);
|
|
1220
|
+
return (0, Pen2DCache_1.createPenInCache)(penCache, stroke, strokeThickness, 1, strokeDashArray, false);
|
|
1230
1221
|
};
|
|
@@ -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 {
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { Rect } from "../../../Core/Rect";
|
|
2
2
|
import { EAxisAlignment } from "../../../types/AxisAlignment";
|
|
3
|
-
import { TSciChart } from "../../../types/TSciChart";
|
|
4
3
|
import { WebGlRenderContext2D } from "../../Drawing/WebGlRenderContext2D";
|
|
5
|
-
import {
|
|
4
|
+
import { TitleRendererBase } from "../../Services/TitleRenderer";
|
|
5
|
+
import { SciChartSurface } from "../SciChartSurface";
|
|
6
6
|
import { TTextStyle } from "./AxisCore";
|
|
7
7
|
/**
|
|
8
8
|
* Draws an axis title using our WebGL Rendering engine
|
|
9
9
|
*/
|
|
10
|
-
export declare class AxisTitleRenderer {
|
|
11
|
-
viewRect: Rect;
|
|
12
|
-
text: string | string[];
|
|
10
|
+
export declare class AxisTitleRenderer extends TitleRendererBase<TTextStyle> {
|
|
13
11
|
lineSpacing: number;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
/** For internal use */
|
|
13
|
+
parentSurface: SciChartSurface;
|
|
14
|
+
private previousText;
|
|
15
|
+
private previousLineSpacing;
|
|
16
|
+
private previousNativeTextMode;
|
|
17
|
+
private previousAxisAlignment;
|
|
18
|
+
measure(text: string | string[], textStyle: TTextStyle, axisAlignment: EAxisAlignment): void;
|
|
19
|
+
get useNativeText(): boolean;
|
|
20
|
+
set useNativeText(value: boolean);
|
|
20
21
|
get desiredHeight(): number;
|
|
21
22
|
set desiredHeight(value: number);
|
|
22
23
|
get desiredWidth(): number;
|
|
23
24
|
set desiredWidth(value: number);
|
|
24
25
|
layout(rect: Rect): void;
|
|
25
|
-
getTitleTexture(
|
|
26
|
-
draw(renderContext: WebGlRenderContext2D
|
|
26
|
+
protected getTitleTexture(): import("../TextureManager/TextureManager").TTextureObject;
|
|
27
|
+
draw(renderContext: WebGlRenderContext2D): void;
|
|
27
28
|
}
|