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
|
@@ -65,4 +65,4 @@ export declare const getScrtPenFromCache: (penCache: Pen2DCache) => SCRTPen;
|
|
|
65
65
|
* @param strokeDashArray the StrokeDashArray which defines any dash e.g. [2,2] means dash for 2pts, gap for 2pts (or undefined = solid line).
|
|
66
66
|
* @returns the new or existing instance of {@link SCRTPen}}
|
|
67
67
|
*/
|
|
68
|
-
export declare const createPenInCache: (penCache: Pen2DCache, stroke: string, strokeThickness: number, opacity: number, strokeDashArray?: number[]) => SCRTPen;
|
|
68
|
+
export declare const createPenInCache: (penCache: Pen2DCache, stroke: string, strokeThickness: number, opacity: number, strokeDashArray?: number[], antiAliased?: boolean) => SCRTPen;
|
|
@@ -119,13 +119,14 @@ exports.getScrtPenFromCache = getScrtPenFromCache;
|
|
|
119
119
|
* @param strokeDashArray the StrokeDashArray which defines any dash e.g. [2,2] means dash for 2pts, gap for 2pts (or undefined = solid line).
|
|
120
120
|
* @returns the new or existing instance of {@link SCRTPen}}
|
|
121
121
|
*/
|
|
122
|
-
var createPenInCache = function (penCache, stroke, strokeThickness, opacity, strokeDashArray) {
|
|
122
|
+
var createPenInCache = function (penCache, stroke, strokeThickness, opacity, strokeDashArray, antiAliased) {
|
|
123
123
|
Guard_1.Guard.notNull(penCache, "penCache");
|
|
124
124
|
var cachedPen = penCache.create({
|
|
125
125
|
stroke: stroke,
|
|
126
126
|
strokeThickness: strokeThickness,
|
|
127
127
|
opacity: opacity,
|
|
128
|
-
strokeDashArray: strokeDashArray
|
|
128
|
+
strokeDashArray: strokeDashArray,
|
|
129
|
+
antiAliased: antiAliased
|
|
129
130
|
});
|
|
130
131
|
return cachedPen.scrtPen;
|
|
131
132
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Rect } from "../../Core/Rect";
|
|
2
|
+
import { Thickness } from "../../Core/Thickness";
|
|
3
|
+
import { TChartTitleStyle } from "../../types/TextStyle";
|
|
4
|
+
import { WebGlRenderContext2D } from "../Drawing/WebGlRenderContext2D";
|
|
5
|
+
import { IChartTitleRenderer, TitleRendererBase } from "./TitleRenderer";
|
|
6
|
+
/**
|
|
7
|
+
* Draws a chart title
|
|
8
|
+
*/
|
|
9
|
+
export declare class ChartTitleRenderer extends TitleRendererBase<TChartTitleStyle> implements IChartTitleRenderer {
|
|
10
|
+
protected titleOffsetProperty: Thickness;
|
|
11
|
+
/**
|
|
12
|
+
* Defines a padding reserved for space taken by a title
|
|
13
|
+
*/
|
|
14
|
+
get titleOffset(): Thickness;
|
|
15
|
+
/**
|
|
16
|
+
* Calculates {@link ChartTitleRenderer.titleOffset}
|
|
17
|
+
*/
|
|
18
|
+
measure(title: string | string[], originalTextStyle: Required<TChartTitleStyle>, renderContext: WebGlRenderContext2D): void;
|
|
19
|
+
/**
|
|
20
|
+
* Calculates {@link ChartTitleRenderer.viewRect} of the title
|
|
21
|
+
* @param chartViewRect - the container area which is used as an origin for title layout calculation
|
|
22
|
+
*/
|
|
23
|
+
layout(chartViewRect: Rect): void;
|
|
24
|
+
/**
|
|
25
|
+
* Performs rendering of the title
|
|
26
|
+
*/
|
|
27
|
+
draw(renderContext: WebGlRenderContext2D): void;
|
|
28
|
+
protected getTitleTexture(): import("../Visuals/TextureManager/TextureManager").TTextureObject;
|
|
29
|
+
/**
|
|
30
|
+
* Calculates the {@link ChartTitleRenderer.titleOffset}
|
|
31
|
+
*/
|
|
32
|
+
protected getTitleOffset(title: string | string[], textStyle: TChartTitleStyle): Thickness;
|
|
33
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
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);
|
|
8
|
+
};
|
|
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
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ChartTitleRenderer = void 0;
|
|
30
|
+
var Thickness_1 = require("../../Core/Thickness");
|
|
31
|
+
var TextStyle_1 = require("../../types/TextStyle");
|
|
32
|
+
var SciChartSurfaceBase_1 = require("../Visuals/SciChartSurfaceBase");
|
|
33
|
+
var TitleRenderer_1 = require("./TitleRenderer");
|
|
34
|
+
/**
|
|
35
|
+
* Draws a chart title
|
|
36
|
+
*/
|
|
37
|
+
var ChartTitleRenderer = /** @class */ (function (_super) {
|
|
38
|
+
__extends(ChartTitleRenderer, _super);
|
|
39
|
+
function ChartTitleRenderer() {
|
|
40
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
41
|
+
_this.titleOffsetProperty = Thickness_1.Thickness.fromNumber(0);
|
|
42
|
+
return _this;
|
|
43
|
+
}
|
|
44
|
+
Object.defineProperty(ChartTitleRenderer.prototype, "titleOffset", {
|
|
45
|
+
/**
|
|
46
|
+
* Defines a padding reserved for space taken by a title
|
|
47
|
+
*/
|
|
48
|
+
get: function () {
|
|
49
|
+
return this.titleOffsetProperty;
|
|
50
|
+
},
|
|
51
|
+
enumerable: false,
|
|
52
|
+
configurable: true
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* Calculates {@link ChartTitleRenderer.titleOffset}
|
|
56
|
+
*/
|
|
57
|
+
ChartTitleRenderer.prototype.measure = function (title, originalTextStyle, renderContext) {
|
|
58
|
+
var _a;
|
|
59
|
+
var shouldUpdateTextSize = title !== this.text ||
|
|
60
|
+
!(0, TextStyle_1.areEqualTextStyles)(originalTextStyle, this.originalTextStyle) ||
|
|
61
|
+
((_a = this.originalTextStyle) === null || _a === void 0 ? void 0 : _a.position) !== originalTextStyle.position;
|
|
62
|
+
if (title && title.length > 0) {
|
|
63
|
+
if (!this.useCache || (!this.texture && !originalTextStyle.useNativeText) || shouldUpdateTextSize) {
|
|
64
|
+
// recalculate cached text size info or texture
|
|
65
|
+
this.invalidateCache();
|
|
66
|
+
this.text = title;
|
|
67
|
+
this.originalTextStyle = __assign({}, originalTextStyle);
|
|
68
|
+
this.textStyle = (0, TextStyle_1.adjustTextStyle)(originalTextStyle);
|
|
69
|
+
this.useNativeTextProperty = originalTextStyle.useNativeText;
|
|
70
|
+
this.titlePosition = originalTextStyle.position;
|
|
71
|
+
this.getTextSize(title, this.textStyle, renderContext);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
// update text style properties that only affect placement
|
|
75
|
+
this.textStyle.alignment = originalTextStyle.alignment;
|
|
76
|
+
this.textStyle.placeWithinChart = originalTextStyle.placeWithinChart;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
this.titleOffsetProperty = this.getTitleOffset(title, this.textStyle);
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Calculates {@link ChartTitleRenderer.viewRect} of the title
|
|
83
|
+
* @param chartViewRect - the container area which is used as an origin for title layout calculation
|
|
84
|
+
*/
|
|
85
|
+
ChartTitleRenderer.prototype.layout = function (chartViewRect) {
|
|
86
|
+
if (!this.text || this.text.length === 0) {
|
|
87
|
+
this.viewRectProperty = undefined;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
this.viewRectProperty = this.getViewRect(this.text, chartViewRect, this.textStyle.position, this.textStyle.alignment);
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Performs rendering of the title
|
|
94
|
+
*/
|
|
95
|
+
ChartTitleRenderer.prototype.draw = function (renderContext) {
|
|
96
|
+
if (!this.text || this.text.length === 0) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (SciChartSurfaceBase_1.DebugForDpi) {
|
|
100
|
+
console.log("ChartTitleRenderer.draw fontSize: ".concat(this.textStyle.fontSize));
|
|
101
|
+
}
|
|
102
|
+
var _a = this.textStyle, useNativeText = _a.useNativeText, position = _a.position, lineSpacing = _a.lineSpacing;
|
|
103
|
+
this.drawInternal(renderContext, useNativeText, position);
|
|
104
|
+
if (this.drawDebug) {
|
|
105
|
+
this.drawTitleDebugViewRect(renderContext);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
ChartTitleRenderer.prototype.getTitleTexture = function () {
|
|
109
|
+
var position = this.textStyle.position;
|
|
110
|
+
var adjRotation = 0;
|
|
111
|
+
// let adjRotation = this.textStyle.rotation;
|
|
112
|
+
if (position === TextStyle_1.ETitlePosition.Left) {
|
|
113
|
+
adjRotation += -90;
|
|
114
|
+
}
|
|
115
|
+
else if (position === TextStyle_1.ETitlePosition.Right) {
|
|
116
|
+
adjRotation += 90;
|
|
117
|
+
}
|
|
118
|
+
var titleText = Array.isArray(this.text) ? this.text : this.text.split("\n");
|
|
119
|
+
var texture = this.textureManager.createTextTexture(titleText,
|
|
120
|
+
// @ts-ignore mismatch with TTextStyle
|
|
121
|
+
this.textStyle,
|
|
122
|
+
// { ...this.textStyle, padding: new Thickness(0, 0, 0, 0) },
|
|
123
|
+
adjRotation, this.textStyle.lineSpacing);
|
|
124
|
+
return texture;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Calculates the {@link ChartTitleRenderer.titleOffset}
|
|
128
|
+
*/
|
|
129
|
+
ChartTitleRenderer.prototype.getTitleOffset = function (title, textStyle) {
|
|
130
|
+
if (!this.text || this.text.length === 0 || textStyle.placeWithinChart) {
|
|
131
|
+
return Thickness_1.Thickness.fromNumber(0);
|
|
132
|
+
}
|
|
133
|
+
var height = this.textHeight;
|
|
134
|
+
switch (textStyle.position) {
|
|
135
|
+
case TextStyle_1.ETitlePosition.Top:
|
|
136
|
+
return new Thickness_1.Thickness(height, 0, 0, 0);
|
|
137
|
+
case TextStyle_1.ETitlePosition.Bottom:
|
|
138
|
+
return new Thickness_1.Thickness(0, 0, height, 0);
|
|
139
|
+
case TextStyle_1.ETitlePosition.Left:
|
|
140
|
+
return new Thickness_1.Thickness(0, 0, 0, height);
|
|
141
|
+
case TextStyle_1.ETitlePosition.Right:
|
|
142
|
+
return new Thickness_1.Thickness(0, height, 0, 0);
|
|
143
|
+
default:
|
|
144
|
+
return (0, TextStyle_1.handleInvalidChartTitlePosition)(textStyle.position);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
return ChartTitleRenderer;
|
|
148
|
+
}(TitleRenderer_1.TitleRendererBase));
|
|
149
|
+
exports.ChartTitleRenderer = ChartTitleRenderer;
|
|
@@ -41,5 +41,11 @@ export declare class SciChartRenderer {
|
|
|
41
41
|
private tryPerformAutoRangeOn;
|
|
42
42
|
private onParentSurfaceRendered;
|
|
43
43
|
private updateWatermark;
|
|
44
|
-
private
|
|
44
|
+
private getViewportSvgRect;
|
|
45
|
+
private scheduleTitleDraw;
|
|
46
|
+
private measureTitle;
|
|
47
|
+
private layoutTitle;
|
|
48
|
+
private getChartViewRect;
|
|
49
|
+
private getAbsoluteLayer;
|
|
50
|
+
private drawDebugSurfaceRect;
|
|
45
51
|
}
|
|
@@ -20,12 +20,16 @@ var hash_1 = require("../../utils/hash");
|
|
|
20
20
|
var WebGlRenderContext2D_1 = require("../Drawing/WebGlRenderContext2D");
|
|
21
21
|
var ResamplingParams_1 = require("../Numerics/Resamplers/ResamplingParams");
|
|
22
22
|
var IAnnotation_1 = require("../Visuals/Annotations/IAnnotation");
|
|
23
|
+
var SciChartSurface_1 = require("../Visuals/SciChartSurface");
|
|
23
24
|
var SciChartSurfaceBase_1 = require("../Visuals/SciChartSurfaceBase");
|
|
24
25
|
var DpiHelper_1 = require("../Visuals/TextureManager/DpiHelper");
|
|
25
26
|
var RenderPassData_1 = require("./RenderPassData");
|
|
26
27
|
var RenderPassInfo_1 = require("./RenderPassInfo");
|
|
27
28
|
var SvgClippingMode_1 = require("../../types/SvgClippingMode");
|
|
28
29
|
var WatermarkPosition_1 = require("../../types/WatermarkPosition");
|
|
30
|
+
var NativeObject_1 = require("../Visuals/Helpers/NativeObject");
|
|
31
|
+
var createNativeRect_1 = require("../Visuals/Helpers/createNativeRect");
|
|
32
|
+
var parseColor_1 = require("../../utils/parseColor");
|
|
29
33
|
/**
|
|
30
34
|
* A class used internally in SciChart to perform layout, arrangement, data-preparation and rendering on the Cartesian 2D {@link SciChartSurface}
|
|
31
35
|
*/
|
|
@@ -122,23 +126,26 @@ var SciChartRenderer = /** @class */ (function () {
|
|
|
122
126
|
this.sciChartSurface.onAnimate(timeElapsed);
|
|
123
127
|
renderContext.enqueueLayeredDraw(function () {
|
|
124
128
|
_this.sciChartSurface.updateBackground();
|
|
125
|
-
},
|
|
129
|
+
}, this.getAbsoluteLayer(DefaultRenderLayer_1.EDefaultRenderLayer.AxisBandsLayer));
|
|
126
130
|
// Step 2 autorange
|
|
127
131
|
this.sciChartSurface.updateStackedCollectionAccumulatedVectors();
|
|
128
132
|
this.sciChartSurface.xAxes.asArray().forEach(function (axis) { return _this.tryPerformAutoRangeOn(axis, _this.sciChartSurface); });
|
|
129
133
|
this.sciChartSurface.yAxes.asArray().forEach(function (axis) { return _this.tryPerformAutoRangeOn(axis, _this.sciChartSurface); });
|
|
130
134
|
// Step 3 layout
|
|
131
|
-
var
|
|
132
|
-
var
|
|
135
|
+
var titleOffset = this.measureTitle(renderContext);
|
|
136
|
+
var seriesViewRect = this.sciChartSurface.layoutManager.layoutChart(renderContext.viewportSize, titleOffset);
|
|
137
|
+
var viewportSvgRect = this.getViewportSvgRect(renderContext.viewportSize, seriesViewRect);
|
|
133
138
|
this.sciChartSurface.setCoordSvgTranslation(seriesViewRect.x - viewportSvgRect.x, seriesViewRect.y - viewportSvgRect.y);
|
|
134
139
|
this.updateSvgCanvasSize(viewportSvgRect);
|
|
140
|
+
this.layoutTitle(seriesViewRect);
|
|
141
|
+
this.scheduleTitleDraw(renderContext);
|
|
135
142
|
// Step 4 prepare render data
|
|
136
143
|
var _a = this.prepareAxesRenderData(), xAxesById = _a.xAxesById, yAxesById = _a.yAxesById;
|
|
137
144
|
var renderPassInfo = this.prepareSeriesRenderData(seriesViewRect, xAxesById);
|
|
138
145
|
// Draw seriesViewRect border
|
|
139
146
|
renderContext.enqueueLayeredDraw(function () {
|
|
140
147
|
_this.sciChartSurface.drawBorder(renderContext);
|
|
141
|
-
},
|
|
148
|
+
}, this.getAbsoluteLayer(DefaultRenderLayer_1.EDefaultRenderLayer.AxisBandsLayer));
|
|
142
149
|
// Step 5 Draw X, Y axis and gridlines
|
|
143
150
|
if (this.sciChartSurface.debugRendering) {
|
|
144
151
|
this.drawDebugAxes(this.sciChartSurface, renderContext);
|
|
@@ -157,14 +164,14 @@ var SciChartRenderer = /** @class */ (function () {
|
|
|
157
164
|
el.type === IAnnotation_1.EAnnotationType.RenderContextAxisMarkerAnnotation ||
|
|
158
165
|
el.type === IAnnotation_1.EAnnotationType.RenderContextNativeTextAnnotation);
|
|
159
166
|
});
|
|
160
|
-
var annotationsBelowLayer =
|
|
167
|
+
var annotationsBelowLayer = this.getAbsoluteLayer(DefaultRenderLayer_1.EDefaultRenderLayer.AnnotationsBelowSeriesLayer);
|
|
161
168
|
renderContext.enqueueLayeredDraw(function () {
|
|
162
169
|
_this.drawRenderContextAnnotations(renderContextAnnotations, xAxesById, yAxesById, IAnnotation_1.EAnnotationLayer.BelowChart, renderContext, seriesViewRect);
|
|
163
170
|
}, annotationsBelowLayer);
|
|
164
|
-
var seriesLayer =
|
|
171
|
+
var seriesLayer = this.getAbsoluteLayer(DefaultRenderLayer_1.EDefaultRenderLayer.SeriesLayer);
|
|
165
172
|
// Step 7 Draw series. Queue series rendering after grid lines and bands, but before the axes
|
|
166
173
|
renderContext.enqueueLayeredDraw(function () { return _this.drawSeries(_this.sciChartSurface, renderPassInfo, renderContext); }, seriesLayer);
|
|
167
|
-
var annotationsAboveLayer =
|
|
174
|
+
var annotationsAboveLayer = this.getAbsoluteLayer(DefaultRenderLayer_1.EDefaultRenderLayer.AnnotationsAboveSeriesLayer);
|
|
168
175
|
// Step 8 Draw annotations above the series
|
|
169
176
|
renderContext.enqueueLayeredDraw(function () {
|
|
170
177
|
_this.drawRenderContextAnnotations(renderContextAnnotations, xAxesById, yAxesById, IAnnotation_1.EAnnotationLayer.AboveChart, renderContext, seriesViewRect);
|
|
@@ -477,7 +484,7 @@ var SciChartRenderer = /** @class */ (function () {
|
|
|
477
484
|
}
|
|
478
485
|
this.sciChartSurface.updateWatermark(left, bottom);
|
|
479
486
|
};
|
|
480
|
-
SciChartRenderer.prototype.
|
|
487
|
+
SciChartRenderer.prototype.getViewportSvgRect = function (viewportSize, seriesViewRect) {
|
|
481
488
|
switch (this.sciChartSurface.svgClippingMode) {
|
|
482
489
|
case SvgClippingMode_1.ESvgClippingMode.SeriesViewRect:
|
|
483
490
|
return seriesViewRect;
|
|
@@ -494,6 +501,45 @@ var SciChartRenderer = /** @class */ (function () {
|
|
|
494
501
|
return seriesViewRect;
|
|
495
502
|
}
|
|
496
503
|
};
|
|
504
|
+
SciChartRenderer.prototype.scheduleTitleDraw = function (renderContext) {
|
|
505
|
+
var _this = this;
|
|
506
|
+
renderContext.enqueueLayeredDraw(function () {
|
|
507
|
+
_this.sciChartSurface.chartTitleRenderer.draw(renderContext);
|
|
508
|
+
}, this.getAbsoluteLayer(DefaultRenderLayer_1.EDefaultRenderLayer.AnnotationsAboveSeriesLayer));
|
|
509
|
+
};
|
|
510
|
+
SciChartRenderer.prototype.measureTitle = function (renderContext) {
|
|
511
|
+
this.sciChartSurface.chartTitleRenderer.measure(this.sciChartSurface.title, this.sciChartSurface.titleStyle, renderContext);
|
|
512
|
+
return this.sciChartSurface.chartTitleRenderer.titleOffset;
|
|
513
|
+
};
|
|
514
|
+
SciChartRenderer.prototype.layoutTitle = function (seriesViewRect) {
|
|
515
|
+
// current surface area which will contain title
|
|
516
|
+
var chartViewRect = this.sciChartSurface.titleStyle.placeWithinChart
|
|
517
|
+
? seriesViewRect
|
|
518
|
+
: this.getChartViewRect();
|
|
519
|
+
// title position calculation
|
|
520
|
+
this.sciChartSurface.chartTitleRenderer.layout(chartViewRect);
|
|
521
|
+
};
|
|
522
|
+
SciChartRenderer.prototype.getChartViewRect = function () {
|
|
523
|
+
var viewportSize = this.sciChartSurface.renderSurface.viewportSize;
|
|
524
|
+
if (SciChartSurface_1.SciChartSurface.isSubSurface(this.sciChartSurface)) {
|
|
525
|
+
var viewportRect = new Rect_1.Rect(0, 0, viewportSize.width, viewportSize.height);
|
|
526
|
+
var sub = this.sciChartSurface;
|
|
527
|
+
viewportRect = sub.getSubChartRect();
|
|
528
|
+
return viewportRect;
|
|
529
|
+
}
|
|
530
|
+
return new Rect_1.Rect(0, 0, viewportSize.width, viewportSize.height);
|
|
531
|
+
};
|
|
532
|
+
SciChartRenderer.prototype.getAbsoluteLayer = function (relativeRenderLayer) {
|
|
533
|
+
return (0, WebGlRenderContext2D_1.calculateAbsoluteRenderLayer)(this.sciChartSurface.layersOffset, this.sciChartSurface.stepBetweenLayers, relativeRenderLayer);
|
|
534
|
+
};
|
|
535
|
+
SciChartRenderer.prototype.drawDebugSurfaceRect = function (renderContext, viewRect, wasmContext) {
|
|
536
|
+
var vecRects = (0, NativeObject_1.getVectorRectVertex)(wasmContext);
|
|
537
|
+
var brush = new wasmContext.SCRTSolidBrush((0, parseColor_1.parseColorToUIntArgb)("rgba(0,255,0,0.7)"), false);
|
|
538
|
+
var nativeRect = (0, createNativeRect_1.createNativeRect)(wasmContext, 0, 0, viewRect.width, viewRect.height);
|
|
539
|
+
vecRects.push_back(nativeRect);
|
|
540
|
+
renderContext.drawRects(vecRects, brush, viewRect.left, viewRect.top);
|
|
541
|
+
brush.delete();
|
|
542
|
+
};
|
|
497
543
|
return SciChartRenderer;
|
|
498
544
|
}());
|
|
499
545
|
exports.SciChartRenderer = SciChartRenderer;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ICacheable } from "../../Core/ICacheable";
|
|
2
|
+
import { IDeletable } from "../../Core/IDeletable";
|
|
3
|
+
import { Rect } from "../../Core/Rect";
|
|
4
|
+
import { Thickness } from "../../Core/Thickness";
|
|
5
|
+
import { ETextAlignment, ETitlePosition, TChartTitleStyle } from "../../types/TextStyle";
|
|
6
|
+
import { WebGlRenderContext2D } from "../Drawing/WebGlRenderContext2D";
|
|
7
|
+
import { TTextStyle } from "../Visuals/Axis/AxisCore";
|
|
8
|
+
import { TSciChart } from "../Visuals/SciChartSurface";
|
|
9
|
+
import { INotifyOnDpiChanged, TDpiChangedEventArgs } from "../Visuals/TextureManager/DpiHelper";
|
|
10
|
+
import { TextureManager, TTextureObject } from "../Visuals/TextureManager/TextureManager";
|
|
11
|
+
export interface ITitleRenderer extends IDeletable, ICacheable, INotifyOnDpiChanged {
|
|
12
|
+
viewRect: Rect;
|
|
13
|
+
measure(...params: any[]): void;
|
|
14
|
+
draw(...params: any[]): void;
|
|
15
|
+
layout(viewRectOrigin: Rect): void;
|
|
16
|
+
}
|
|
17
|
+
export interface IChartTitleRenderer extends ITitleRenderer {
|
|
18
|
+
titleOffset: Thickness;
|
|
19
|
+
measure(title: string | string[], originalTextStyle: Required<TChartTitleStyle>, renderContext: WebGlRenderContext2D): void;
|
|
20
|
+
}
|
|
21
|
+
export declare class TitleRendererBase<TextStyleType extends TTextStyle | TChartTitleStyle> implements ITitleRenderer {
|
|
22
|
+
/**
|
|
23
|
+
* Defines a bounding {@link Rect} containing the title text
|
|
24
|
+
*/
|
|
25
|
+
get viewRect(): Rect;
|
|
26
|
+
drawDebug: boolean;
|
|
27
|
+
useCache: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Current title
|
|
30
|
+
*/
|
|
31
|
+
protected text: string | string[];
|
|
32
|
+
protected viewRectProperty: Rect;
|
|
33
|
+
protected webAssemblyContext: TSciChart;
|
|
34
|
+
protected textureManager: TextureManager;
|
|
35
|
+
/**
|
|
36
|
+
* Adjusted text style for the title
|
|
37
|
+
*/
|
|
38
|
+
protected textStyle: TextStyleType;
|
|
39
|
+
/**
|
|
40
|
+
* Current not adjusted text style for the title
|
|
41
|
+
*/
|
|
42
|
+
protected originalTextStyle: TextStyleType;
|
|
43
|
+
/**
|
|
44
|
+
* The height taken by the text with normal(horizontal) orientation including padding
|
|
45
|
+
*/
|
|
46
|
+
protected textHeight: number;
|
|
47
|
+
/**
|
|
48
|
+
* The width taken by the text with normal(horizontal) orientation including padding
|
|
49
|
+
*/
|
|
50
|
+
protected textWidth: number;
|
|
51
|
+
/**
|
|
52
|
+
* The height taken by the text considering current orientation orientation including padding
|
|
53
|
+
*/
|
|
54
|
+
protected desiredHeightProperty: number;
|
|
55
|
+
/**
|
|
56
|
+
* The width taken by the text considering current orientation orientation including padding
|
|
57
|
+
*/
|
|
58
|
+
protected desiredWidthProperty: number;
|
|
59
|
+
/**
|
|
60
|
+
* The text texture corresponding to current title and text style.
|
|
61
|
+
* @remarks The texture is created if {@link textStyle.useNativeText} is set to false
|
|
62
|
+
*/
|
|
63
|
+
protected texture: TTextureObject;
|
|
64
|
+
/** The line spacing for native text calculated during measure */
|
|
65
|
+
protected nativeLineSpacing: number;
|
|
66
|
+
/** The height of the first line above baseline for native text, calculated during measure*/
|
|
67
|
+
protected firstLineAscent: number;
|
|
68
|
+
protected useNativeTextProperty: boolean;
|
|
69
|
+
protected titlePosition: ETitlePosition;
|
|
70
|
+
constructor(webAssemblyContext: TSciChart);
|
|
71
|
+
measure(...params: any[]): void;
|
|
72
|
+
layout(originRect: Rect): void;
|
|
73
|
+
draw(...params: any[]): void;
|
|
74
|
+
delete(): void;
|
|
75
|
+
resetCache(): void;
|
|
76
|
+
invalidateCache(): void;
|
|
77
|
+
onDpiChanged(args: TDpiChangedEventArgs): void;
|
|
78
|
+
/**
|
|
79
|
+
* Performs rendering of the title
|
|
80
|
+
*/
|
|
81
|
+
protected drawInternal(renderContext: WebGlRenderContext2D, useNativeText: boolean, titlePosition: ETitlePosition): void;
|
|
82
|
+
protected drawWithNativeText(renderContext: WebGlRenderContext2D, position: ETitlePosition): void;
|
|
83
|
+
protected drawWithTexture(renderContext: WebGlRenderContext2D, titlePosition: ETitlePosition): void;
|
|
84
|
+
/**
|
|
85
|
+
* Calculates width and hight of the title text
|
|
86
|
+
*/
|
|
87
|
+
protected getTextSize(title: string | string[], textStyle: TChartTitleStyle, renderContext: WebGlRenderContext2D): void;
|
|
88
|
+
protected getTitleTexture(): TTextureObject;
|
|
89
|
+
/**
|
|
90
|
+
* Calculates the {@link TitleRenderer.viewRect}
|
|
91
|
+
*/
|
|
92
|
+
protected getViewRect(title: string | string[], originRect: Rect, titlePosition: ETitlePosition, alignment: ETextAlignment): Rect;
|
|
93
|
+
protected drawTitleDebugViewRect(renderContext: WebGlRenderContext2D): void;
|
|
94
|
+
/**
|
|
95
|
+
* Calculates the offset of title text alignment defined by {@link TChartTitleStyle.alignment} or {@link TTextStyle.alignment}
|
|
96
|
+
*/
|
|
97
|
+
private getAlignmentAdjustmentDelta;
|
|
98
|
+
}
|