scichart 2.1.2301 → 2.2.2389
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/Builder/buildAxis.d.ts +7 -0
- package/Builder/buildAxis.js +6 -0
- package/Builder/buildDataSeries.d.ts +19 -1
- package/Builder/buildDataSeries.js +22 -1
- package/Builder/buildModifiers.d.ts +2 -1
- package/Builder/buildSeries.d.ts +7 -2
- package/Builder/buildSeries.js +5 -1
- package/Charting/ChartModifiers/CursorModifier.d.ts +5 -0
- package/Charting/ChartModifiers/CursorModifier.js +15 -10
- package/Charting/ChartModifiers/LegendModifier.d.ts +31 -0
- package/Charting/ChartModifiers/LegendModifier.js +22 -0
- package/Charting/ChartModifiers/ModifierMouseArgs.d.ts +2 -2
- package/Charting/ChartModifiers/ModifierMouseArgs.js +4 -2
- package/Charting/ChartModifiers/RolloverModifier.d.ts +10 -0
- package/Charting/ChartModifiers/RolloverModifier.js +76 -19
- package/Charting/Drawing/WebGlRenderContext2D.js +26 -42
- package/Charting/LayoutManager/LayoutManager.js +6 -1
- package/Charting/Model/BaseHeatmapDataSeries.d.ts +1 -0
- package/Charting/Model/BaseHeatmapDataSeries.js +5 -2
- package/Charting/Model/ChartData/HlcSeriesInfo.d.ts +12 -0
- package/Charting/Model/ChartData/HlcSeriesInfo.js +52 -0
- package/Charting/Model/Filters/HlcCustomFilter.d.ts +41 -0
- package/Charting/Model/Filters/HlcCustomFilter.js +119 -0
- package/Charting/Model/Filters/HlcFilterBase.d.ts +30 -0
- package/Charting/Model/Filters/HlcFilterBase.js +141 -0
- package/Charting/Model/Filters/HlcScaleOffsetFilter.d.ts +18 -0
- package/Charting/Model/Filters/HlcScaleOffsetFilter.js +86 -0
- package/Charting/Model/Filters/XyFilterBase.d.ts +2 -0
- package/Charting/Model/Filters/XyFilterBase.js +6 -0
- package/Charting/Model/Filters/XyyFilterBase.js +9 -0
- package/Charting/Model/Filters/XyzFilterBase.js +12 -3
- package/Charting/Model/HlcDataSeries.d.ts +189 -0
- package/Charting/Model/HlcDataSeries.js +557 -0
- package/Charting/Model/IDataSeries.d.ts +5 -1
- package/Charting/Model/IDataSeries.js +4 -0
- package/Charting/Model/PointSeries/BasePointSeriesWrapped.d.ts +1 -1
- package/Charting/Model/PointSeries/BasePointSeriesWrapped.js +2 -2
- package/Charting/Model/PointSeries/HlcPointSeriesWrapped.d.ts +10 -0
- package/Charting/Model/PointSeries/HlcPointSeriesWrapped.js +31 -0
- package/Charting/Model/PointSeries/IPointSeries.d.ts +5 -0
- package/Charting/Model/PointSeries/XyyPointSeriesWrapped.d.ts +1 -1
- package/Charting/Model/PointSeries/XyyPointSeriesWrapped.js +3 -3
- package/Charting/Numerics/CoordinateCalculators/LogarithmicCoordinateCalculator.d.ts +2 -2
- package/Charting/Numerics/CoordinateCalculators/LogarithmicCoordinateCalculator.js +15 -6
- package/Charting/Services/SciChartRenderer.d.ts +1 -0
- package/Charting/Services/SciChartRenderer.js +6 -0
- package/Charting/Visuals/Annotations/AnnotationBase.d.ts +6 -1
- package/Charting/Visuals/Annotations/AnnotationBase.js +23 -2
- package/Charting/Visuals/Annotations/CursorTooltipSvgAnnotation.d.ts +6 -0
- package/Charting/Visuals/Annotations/CursorTooltipSvgAnnotation.js +46 -5
- package/Charting/Visuals/Annotations/CustomAnnotation.d.ts +3 -1
- package/Charting/Visuals/Annotations/CustomAnnotation.js +14 -3
- package/Charting/Visuals/Annotations/HorizontalLineAnnotation.d.ts +4 -0
- package/Charting/Visuals/Annotations/HorizontalLineAnnotation.js +3 -2
- package/Charting/Visuals/Annotations/RolloverLegendSvgAnnotation.d.ts +1 -1
- package/Charting/Visuals/Annotations/RolloverLegendSvgAnnotation.js +13 -3
- package/Charting/Visuals/Annotations/RolloverTooltipSvgAnnotation.d.ts +13 -0
- package/Charting/Visuals/Annotations/RolloverTooltipSvgAnnotation.js +71 -14
- package/Charting/Visuals/Annotations/VerticalLineAnnotation.d.ts +2 -0
- package/Charting/Visuals/Annotations/VerticalLineAnnotation.js +3 -2
- package/Charting/Visuals/Annotations/constants.d.ts +2 -1
- package/Charting/Visuals/Annotations/constants.js +1 -0
- package/Charting/Visuals/Axis/AxisBase2D.d.ts +11 -1
- package/Charting/Visuals/Axis/AxisBase2D.js +75 -17
- package/Charting/Visuals/Axis/AxisCore.d.ts +4 -0
- package/Charting/Visuals/Axis/AxisCore.js +6 -0
- package/Charting/Visuals/Axis/AxisRenderer.js +6 -10
- package/Charting/Visuals/Axis/DateTimeNumericAxis.d.ts +11 -0
- package/Charting/Visuals/Axis/DateTimeNumericAxis.js +36 -0
- package/Charting/Visuals/Axis/DeltaCalculator/DateTimeDeltaCalculator.d.ts +28 -0
- package/Charting/Visuals/Axis/DeltaCalculator/DateTimeDeltaCalculator.js +125 -0
- package/Charting/Visuals/Axis/LabelProvider/PieLabelProvider.d.ts +34 -0
- package/Charting/Visuals/Axis/LabelProvider/PieLabelProvider.js +82 -0
- package/Charting/Visuals/Axis/LabelProvider/SmartDateLabelProvider.d.ts +2 -2
- package/Charting/Visuals/Axis/LabelProvider/SmartDateLabelProvider.js +39 -6
- package/Charting/Visuals/Axis/LogarithmicAxis.d.ts +1 -0
- package/Charting/Visuals/Axis/LogarithmicAxis.js +5 -3
- package/Charting/Visuals/Helpers/NativeObject.d.ts +13 -0
- package/Charting/Visuals/Helpers/NativeObject.js +101 -0
- package/Charting/Visuals/Helpers/createNativeRect.d.ts +2 -2
- package/Charting/Visuals/Helpers/createNativeRect.js +3 -1
- package/Charting/Visuals/Helpers/drawBorder.js +2 -2
- package/Charting/Visuals/Helpers/drawLabel.d.ts +3 -3
- package/Charting/Visuals/Helpers/drawLabel.js +38 -18
- package/Charting/Visuals/I2DSurfaceOptions.d.ts +6 -0
- package/Charting/Visuals/Legend/SciChartLegend.d.ts +4 -0
- package/Charting/Visuals/Legend/SciChartLegend.js +8 -2
- package/Charting/Visuals/Legend/SciChartLegendBase.d.ts +1 -0
- package/Charting/Visuals/Legend/SciChartLegendBase.js +4 -2
- package/Charting/Visuals/Legend/SciChartPieLegend.js +1 -1
- package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.d.ts +24 -8
- package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.js +109 -31
- package/Charting/Visuals/RenderableSeries/BaseStackedCollection.d.ts +3 -0
- package/Charting/Visuals/RenderableSeries/BaseStackedCollection.js +8 -0
- package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.d.ts +17 -166
- package/Charting/Visuals/RenderableSeries/BaseStackedRenderableSeries.js +35 -328
- package/Charting/Visuals/RenderableSeries/DrawingProviders/BandSeriesDrawingProvider.d.ts +5 -2
- package/Charting/Visuals/RenderableSeries/DrawingProviders/BandSeriesDrawingProvider.js +5 -3
- package/Charting/Visuals/RenderableSeries/DrawingProviders/BaseSeriesDrawingProvider.js +14 -11
- package/Charting/Visuals/RenderableSeries/DrawingProviders/ErrorSeriesDrawingProvider.d.ts +46 -0
- package/Charting/Visuals/RenderableSeries/DrawingProviders/ErrorSeriesDrawingProvider.js +252 -0
- package/Charting/Visuals/RenderableSeries/FastErrorBarsRenderableSeries.d.ts +188 -0
- package/Charting/Visuals/RenderableSeries/FastErrorBarsRenderableSeries.js +357 -0
- package/Charting/Visuals/RenderableSeries/FastImpulseRenderableSeries.js +3 -10
- package/Charting/Visuals/RenderableSeries/HitTest/ErrorSeriesHitTestProvider.d.ts +20 -0
- package/Charting/Visuals/RenderableSeries/HitTest/ErrorSeriesHitTestProvider.js +120 -0
- package/Charting/Visuals/RenderableSeries/HitTest/hitTestHelpers.d.ts +6 -0
- package/Charting/Visuals/RenderableSeries/HitTest/hitTestHelpers.js +36 -0
- package/Charting/Visuals/RenderableSeries/IBaseRenderableSeriesOptions.d.ts +8 -0
- package/Charting/Visuals/RenderableSeries/IRenderableSeries.d.ts +6 -0
- package/Charting/Visuals/RenderableSeries/SeriesVisibleChangedArgs.d.ts +6 -0
- package/Charting/Visuals/RenderableSeries/SeriesVisibleChangedArgs.js +11 -0
- package/Charting/Visuals/RenderableSeries/StackedColumnCollection.js +1 -2
- package/Charting/Visuals/RenderableSeries/StackedColumnRenderableSeries.d.ts +22 -0
- package/Charting/Visuals/RenderableSeries/StackedColumnRenderableSeries.js +38 -1
- package/Charting/Visuals/RenderableSeries/StackedMountainCollection.d.ts +2 -2
- package/Charting/Visuals/RenderableSeries/StackedMountainCollection.js +26 -45
- package/Charting/Visuals/RenderableSeries/StackedMountainRenderableSeries.d.ts +77 -18
- package/Charting/Visuals/RenderableSeries/StackedMountainRenderableSeries.js +139 -42
- package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.d.ts +5 -0
- package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.js +21 -1
- package/Charting/Visuals/RenderableSeries/constants.d.ts +7 -0
- package/Charting/Visuals/RenderableSeries/constants.js +7 -0
- package/Charting/Visuals/SciChartPieSurface/IPieSurfaceOptions.d.ts +25 -2
- package/Charting/Visuals/SciChartPieSurface/PieSegment/IPieSegment.d.ts +9 -1
- package/Charting/Visuals/SciChartPieSurface/PieSegment/PieSegment.d.ts +128 -2
- package/Charting/Visuals/SciChartPieSurface/PieSegment/PieSegment.js +202 -21
- package/Charting/Visuals/SciChartPieSurface/PieSegment/constants.d.ts +6 -1
- package/Charting/Visuals/SciChartPieSurface/PieSegment/constants.js +5 -0
- package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.d.ts +77 -3
- package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.js +373 -81
- package/Charting/Visuals/SciChartPieSurface/constants.d.ts +7 -1
- package/Charting/Visuals/SciChartPieSurface/constants.js +6 -0
- package/Charting/Visuals/SciChartSurface.d.ts +13 -2
- package/Charting/Visuals/SciChartSurface.js +39 -3
- package/Charting/Visuals/createMaster.js +17 -13
- package/Charting/Visuals/createSingle.js +5 -3
- package/Charting/Visuals/licenseManager2D.d.ts +6 -0
- package/Charting/Visuals/licenseManager2D.js +98 -9
- package/Charting/Visuals/licenseManager2dState.d.ts +11 -0
- package/Charting/Visuals/licenseManager2dState.js +37 -1
- package/Charting/Visuals/loader.js +4 -1
- package/Charting/Visuals/sciChartInitCommon.d.ts +2 -2
- package/Charting/Visuals/sciChartInitCommon.js +13 -9
- package/Charting3D/Visuals/Primitives/ScatterPointsSceneEntity.js +6 -2
- package/Charting3D/Visuals/SciChart3DRenderer.js +1 -1
- package/Charting3D/Visuals/SciChart3DSurface.d.ts +8 -3
- package/Charting3D/Visuals/SciChart3DSurface.js +12 -3
- package/Charting3D/Visuals/createMaster3d.js +20 -14
- package/Charting3D/Visuals/createSingle3d.js +3 -4
- package/Charting3D/Visuals/licenseManager3D.js +3 -1
- package/Core/BuildStamp.d.ts +1 -1
- package/Core/BuildStamp.js +2 -2
- package/Core/Telemetry.d.ts +7 -0
- package/Core/Telemetry.js +109 -0
- package/Core/storage/localStorageApi.d.ts +4 -0
- package/Core/storage/localStorageApi.js +12 -0
- package/README.md +49 -13
- package/_wasm/scichart.browser.js +1 -1
- package/_wasm/scichart2d.js +95 -95
- package/_wasm/scichart2d.wasm +0 -0
- package/_wasm/scichart3d.js +97 -97
- package/_wasm/scichart3d.wasm +0 -0
- package/package.json +1 -1
- package/types/AxisType.d.ts +5 -1
- package/types/AxisType.js +4 -0
- package/types/Color.d.ts +1 -0
- package/types/Color.js +1 -0
- package/types/DataFilterType.d.ts +1 -0
- package/types/DataFilterType.js +1 -0
- package/types/DataPointWidthMode.d.ts +13 -0
- package/types/DataPointWidthMode.js +17 -0
- package/types/ErrorDirection.d.ts +13 -0
- package/types/ErrorDirection.js +17 -0
- package/types/ErrorMode.d.ts +17 -0
- package/types/ErrorMode.js +21 -0
- package/types/LabelPlacement.d.ts +8 -0
- package/types/LabelPlacement.js +11 -1
- package/types/LabelProviderType.d.ts +5 -1
- package/types/LabelProviderType.js +4 -0
- package/types/SeriesType.d.ts +3 -1
- package/types/SeriesType.js +2 -0
- package/types/TSciChart.d.ts +8 -2
- package/types/TSciChart3D.d.ts +5 -2
- package/types/TSciChartSurfaceCanvases.d.ts +1 -0
- package/utils/date.d.ts +1 -0
- package/utils/date.js +15 -1
- package/utils/guid.d.ts +6 -0
- package/utils/guid.js +17 -1
|
@@ -0,0 +1,82 @@
|
|
|
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.PieLabelProvider = void 0;
|
|
30
|
+
var LabelProviderType_1 = require("../../../../types/LabelProviderType");
|
|
31
|
+
var NumericFormat_1 = require("../../../../types/NumericFormat");
|
|
32
|
+
var number_1 = require("../../../../utils/number");
|
|
33
|
+
var SciChartPieSurface_1 = require("../../SciChartPieSurface/SciChartPieSurface");
|
|
34
|
+
var LabelProvider_1 = require("./LabelProvider");
|
|
35
|
+
/**
|
|
36
|
+
* @summary A Label Provider for use with Pie Charts to allow customizing of segment labels
|
|
37
|
+
* To completely customise the label output, override {@link getSegmentText}
|
|
38
|
+
* To just adjust the numeric formatting of the label, use numericformat, precision, prefix, postfix, or override {@link formatLabel}
|
|
39
|
+
*/
|
|
40
|
+
var PieLabelProvider = /** @class */ (function (_super) {
|
|
41
|
+
__extends(PieLabelProvider, _super);
|
|
42
|
+
function PieLabelProvider(options) {
|
|
43
|
+
var _a, _b;
|
|
44
|
+
var _this = _super.call(this, __assign({ labelFormat: (_a = options === null || options === void 0 ? void 0 : options.labelFormat) !== null && _a !== void 0 ? _a : NumericFormat_1.ENumericFormat.Decimal, labelPrecision: (_b = options === null || options === void 0 ? void 0 : options.labelPrecision) !== null && _b !== void 0 ? _b : 2 }, options)) || this;
|
|
45
|
+
_this.type = LabelProviderType_1.ELabelProviderType.Pie;
|
|
46
|
+
_this.formatLabelProperty = function (dataValue) {
|
|
47
|
+
return _this.applyFormat((0, number_1.formatNumber)(dataValue, _this.numericFormat, _this.precision)) +
|
|
48
|
+
(_this.parentSurface.valueMode === SciChartPieSurface_1.EPieValueMode.Percentage ? " %" : "");
|
|
49
|
+
};
|
|
50
|
+
return _this;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Get the text to be used as the segmet label. This picks the raw value, or percentage depending on the chart's valueMode
|
|
54
|
+
* then formats it using the {@link formatLabel} function.
|
|
55
|
+
* @param segment The PieSegment to get a label for
|
|
56
|
+
* @param total Total of all pieSegment values
|
|
57
|
+
*/
|
|
58
|
+
PieLabelProvider.prototype.getSegmentText = function (segment, total) {
|
|
59
|
+
var labelValue = this.parentSurface.valueMode === SciChartPieSurface_1.EPieValueMode.Percentage ? segment.getPercentage(total) : segment.value;
|
|
60
|
+
return this.formatLabel(labelValue);
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Called when the {@link LabelProvider} is attached to an {@link SciChartPieSurface }
|
|
64
|
+
* @param pieSurface The SciPieSurface we are attached to.
|
|
65
|
+
*/
|
|
66
|
+
PieLabelProvider.prototype.attachedToSurface = function (pieSurface) {
|
|
67
|
+
this.parentSurface = pieSurface;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* @inheritDoc
|
|
71
|
+
*/
|
|
72
|
+
PieLabelProvider.prototype.onBeginAxisDraw = function () {
|
|
73
|
+
// TODO: user can override here if they want
|
|
74
|
+
};
|
|
75
|
+
PieLabelProvider.prototype.invalidateParent = function () {
|
|
76
|
+
if (this.parentSurface && this.parentSurface.invalidateElement) {
|
|
77
|
+
this.parentSurface.invalidateElement();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
return PieLabelProvider;
|
|
81
|
+
}(LabelProvider_1.LabelProvider));
|
|
82
|
+
exports.PieLabelProvider = PieLabelProvider;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ELabelProviderType } from "../../../../types/LabelProviderType";
|
|
2
2
|
import { ENumericFormat } from "../../../../types/NumericFormat";
|
|
3
|
-
import { LabelProviderBase2D } from "./LabelProviderBase2D";
|
|
3
|
+
import { LabelProviderBase2D, ILabel2DOptions } from "./LabelProviderBase2D";
|
|
4
4
|
/**
|
|
5
5
|
* The {@link SmartDateLabelProvider} formats Axis Labels and Cursor / Tooltips for {@link NumericAxis} types
|
|
6
6
|
*/
|
|
@@ -9,7 +9,7 @@ export declare class SmartDateLabelProvider extends LabelProviderBase2D {
|
|
|
9
9
|
/**
|
|
10
10
|
* Creates an instance of {@link SmartDateLabelProvider}
|
|
11
11
|
*/
|
|
12
|
-
constructor();
|
|
12
|
+
constructor(options?: ILabel2DOptions);
|
|
13
13
|
/**
|
|
14
14
|
* @inheritDoc
|
|
15
15
|
*/
|
|
@@ -14,6 +14,17 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
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
|
+
};
|
|
17
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
29
|
exports.SmartDateLabelProvider = void 0;
|
|
19
30
|
var LabelProviderType_1 = require("../../../../types/LabelProviderType");
|
|
@@ -24,6 +35,8 @@ var LabelCache_1 = require("./LabelCache");
|
|
|
24
35
|
var LabelProviderBase2D_1 = require("./LabelProviderBase2D");
|
|
25
36
|
var ETradeChartLabelFormat;
|
|
26
37
|
(function (ETradeChartLabelFormat) {
|
|
38
|
+
// Apr 25 ... 04:01:45 ... 02:02:30
|
|
39
|
+
ETradeChartLabelFormat["Seconds"] = "Seconds";
|
|
27
40
|
// Apr 25 ... 01:34 ... 02:24
|
|
28
41
|
ETradeChartLabelFormat["Minutes"] = "Minutes";
|
|
29
42
|
// Apr ... 08 ... 13
|
|
@@ -31,6 +44,7 @@ var ETradeChartLabelFormat;
|
|
|
31
44
|
// 2020 ... Jan ... Feb
|
|
32
45
|
ETradeChartLabelFormat["Months"] = "Months";
|
|
33
46
|
})(ETradeChartLabelFormat || (ETradeChartLabelFormat = {}));
|
|
47
|
+
var ONE_HOUR = 60 * 60;
|
|
34
48
|
var FIVE_DAYS = 60 * 60 * 24 * 5;
|
|
35
49
|
var FIFTY_DAYS = 60 * 60 * 24 * 50;
|
|
36
50
|
/**
|
|
@@ -41,11 +55,17 @@ var SmartDateLabelProvider = /** @class */ (function (_super) {
|
|
|
41
55
|
/**
|
|
42
56
|
* Creates an instance of {@link SmartDateLabelProvider}
|
|
43
57
|
*/
|
|
44
|
-
function SmartDateLabelProvider() {
|
|
45
|
-
var
|
|
58
|
+
function SmartDateLabelProvider(options) {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
var _this = _super.call(this, __assign({ labelFormat: (_a = options === null || options === void 0 ? void 0 : options.labelFormat) !== null && _a !== void 0 ? _a : NumericFormat_1.ENumericFormat.Date_DDMMYYYY, cursorLabelFormat: (_b = options === null || options === void 0 ? void 0 : options.cursorLabelFormat) !== null && _b !== void 0 ? _b : NumericFormat_1.ENumericFormat.Date_DDMMYYYY }, options)) || this;
|
|
46
61
|
_this.type = LabelProviderType_1.ELabelProviderType.SmartDate;
|
|
47
|
-
_this.formatLabelProperty = function (dataValue) {
|
|
48
|
-
|
|
62
|
+
_this.formatLabelProperty = function (dataValue) {
|
|
63
|
+
return _this.applyFormat((0, number_1.formatNumber)(dataValue, _this.numericFormat, _this.precision));
|
|
64
|
+
};
|
|
65
|
+
_this.formatCursorLabelProperty = function (dataValue) {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
return _this.applyFormat((0, number_1.formatNumber)(dataValue, (_a = _this.cursorNumericFormat) !== null && _a !== void 0 ? _a : _this.numericFormat, (_b = _this.cursorPrecision) !== null && _b !== void 0 ? _b : _this.precision));
|
|
68
|
+
};
|
|
49
69
|
return _this;
|
|
50
70
|
}
|
|
51
71
|
/**
|
|
@@ -105,7 +125,10 @@ var SmartDateLabelProvider = /** @class */ (function (_super) {
|
|
|
105
125
|
configurable: true
|
|
106
126
|
});
|
|
107
127
|
SmartDateLabelProvider.prototype.getTradeChartLabelFormat = function (timeRange, ticksNumber) {
|
|
108
|
-
if (timeRange <=
|
|
128
|
+
if (timeRange <= ONE_HOUR) {
|
|
129
|
+
return ETradeChartLabelFormat.Seconds;
|
|
130
|
+
}
|
|
131
|
+
else if (timeRange <= FIVE_DAYS) {
|
|
109
132
|
return ETradeChartLabelFormat.Minutes;
|
|
110
133
|
}
|
|
111
134
|
else if (timeRange <= FIFTY_DAYS) {
|
|
@@ -116,7 +139,17 @@ var SmartDateLabelProvider = /** @class */ (function (_super) {
|
|
|
116
139
|
}
|
|
117
140
|
};
|
|
118
141
|
SmartDateLabelProvider.prototype.formatTradeChartLabel = function (tradeChartLabelFormat, value, prevValue, prevPrevValue) {
|
|
119
|
-
if (tradeChartLabelFormat === ETradeChartLabelFormat.
|
|
142
|
+
if (tradeChartLabelFormat === ETradeChartLabelFormat.Seconds) {
|
|
143
|
+
var newDate = prevValue === undefined ||
|
|
144
|
+
(0, date_1.formatUnixDateToHumanStringMMMDD)(value) !== (0, date_1.formatUnixDateToHumanStringMMMDD)(prevValue);
|
|
145
|
+
if (newDate) {
|
|
146
|
+
return (0, date_1.formatUnixDateToHumanStringMMMDD)(value);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
return (0, date_1.formatUnixDateToHumanStringHHMMSS)(value);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else if (tradeChartLabelFormat === ETradeChartLabelFormat.Minutes) {
|
|
120
153
|
var newDate = prevValue === undefined ||
|
|
121
154
|
(0, date_1.formatUnixDateToHumanStringMMMDD)(value) !== (0, date_1.formatUnixDateToHumanStringMMMDD)(prevValue);
|
|
122
155
|
if (newDate) {
|
|
@@ -10,6 +10,7 @@ import { AxisBase2D } from "./AxisBase2D";
|
|
|
10
10
|
import { DeltaCalculator } from "./DeltaCalculator/DeltaCalculator";
|
|
11
11
|
import { LabelProviderBase2D } from "./LabelProvider/LabelProviderBase2D";
|
|
12
12
|
import { INumericAxisOptions } from "./NumericAxis";
|
|
13
|
+
export declare const MIN_LOG_AXIS_VALUE = 1e-10;
|
|
13
14
|
export interface ILogarithmicAxisOptions extends INumericAxisOptions {
|
|
14
15
|
/**
|
|
15
16
|
* The Logarithmic Base for the axis. Defaults to 10
|
|
@@ -15,7 +15,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.LogarithmicAxis = void 0;
|
|
18
|
+
exports.LogarithmicAxis = exports.MIN_LOG_AXIS_VALUE = void 0;
|
|
19
19
|
var EasingFunctions_1 = require("../../../Core/Animations/EasingFunctions");
|
|
20
20
|
var NumberRangeAnimator_1 = require("../../../Core/Animations/NumberRangeAnimator");
|
|
21
21
|
var NumberRange_1 = require("../../../Core/NumberRange");
|
|
@@ -27,6 +27,8 @@ var AxisBase2D_1 = require("./AxisBase2D");
|
|
|
27
27
|
var constants_1 = require("./constants");
|
|
28
28
|
var LogarithmicDeltaCalculator_1 = require("./DeltaCalculator/LogarithmicDeltaCalculator");
|
|
29
29
|
var LogarithmicLabelProvider_1 = require("./LabelProvider/LogarithmicLabelProvider");
|
|
30
|
+
// TODO probably find better value, e.g. check if it works with Number.MIN_VALUE
|
|
31
|
+
exports.MIN_LOG_AXIS_VALUE = 0.0000000001;
|
|
30
32
|
/**
|
|
31
33
|
* Creates an instance of a {@link LogarithmicAxis}
|
|
32
34
|
* @param webAssemblyContext The {@link TSciChart | SciChart 2D WebAssembly Context} containing native methods and
|
|
@@ -55,10 +57,10 @@ var LogarithmicAxis = /** @class */ (function (_super) {
|
|
|
55
57
|
else {
|
|
56
58
|
// Log axis can be positive or negative, but not both.
|
|
57
59
|
if (_this.isNegativeProperty) {
|
|
58
|
-
_this.visibleRangeLimit = new NumberRange_1.NumberRange(-Infinity, -
|
|
60
|
+
_this.visibleRangeLimit = new NumberRange_1.NumberRange(-Infinity, -exports.MIN_LOG_AXIS_VALUE);
|
|
59
61
|
}
|
|
60
62
|
else {
|
|
61
|
-
_this.visibleRangeLimit = new NumberRange_1.NumberRange(
|
|
63
|
+
_this.visibleRangeLimit = new NumberRange_1.NumberRange(exports.MIN_LOG_AXIS_VALUE, Infinity);
|
|
62
64
|
}
|
|
63
65
|
}
|
|
64
66
|
return _this;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IDeletable } from "../../../Core/IDeletable";
|
|
2
|
+
import { SCRTColorVertex, SCRTRectVertex, TSciChart, VectorColorVertex, VectorRectVertex } from "../../../types/TSciChart";
|
|
3
|
+
export declare const freeCache: (wasmContext: TSciChart) => IDeletable;
|
|
4
|
+
/**
|
|
5
|
+
* Returns an empty vector of Rectangles
|
|
6
|
+
* @param wasmContext
|
|
7
|
+
* @param maxSize
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare const getVectorRectVertex: (wasmContext: TSciChart, maxSize?: number) => VectorRectVertex;
|
|
11
|
+
export declare const getVectorColorVertex: (wasmContext: TSciChart, maxSize?: number) => VectorColorVertex;
|
|
12
|
+
export declare const getVertex: (wasmContext: TSciChart, x: number, y: number) => SCRTColorVertex;
|
|
13
|
+
export declare const getNativeRect: (wasmContext: TSciChart, xTopLeft: number, yTopLeft: number, xBottomRight: number, yBottomRight: number) => SCRTRectVertex;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNativeRect = exports.getVertex = exports.getVectorColorVertex = exports.getVectorRectVertex = exports.freeCache = void 0;
|
|
4
|
+
var Deleter_1 = require("../../../Core/Deleter");
|
|
5
|
+
var objectCache = new Map();
|
|
6
|
+
var getCache = function (wasmContext) {
|
|
7
|
+
if (!wasmContext.canvas)
|
|
8
|
+
return undefined;
|
|
9
|
+
var canvasId = wasmContext.canvas.id;
|
|
10
|
+
if (!objectCache.has(canvasId)) {
|
|
11
|
+
objectCache.set(canvasId, {
|
|
12
|
+
vecRects: undefined,
|
|
13
|
+
vecColorVertex: undefined,
|
|
14
|
+
vertex: undefined,
|
|
15
|
+
rect: undefined
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return objectCache.get(canvasId);
|
|
19
|
+
};
|
|
20
|
+
var freeCache = function (wasmContext) {
|
|
21
|
+
return {
|
|
22
|
+
delete: function () {
|
|
23
|
+
if (!wasmContext.canvas)
|
|
24
|
+
return;
|
|
25
|
+
var canvasId = wasmContext.canvas.id;
|
|
26
|
+
var cache = objectCache.get(canvasId);
|
|
27
|
+
if (cache) {
|
|
28
|
+
(0, Deleter_1.deleteSafe)(cache.vecRects);
|
|
29
|
+
(0, Deleter_1.deleteSafe)(cache.vecColorVertex);
|
|
30
|
+
(0, Deleter_1.deleteSafe)(cache.vertex);
|
|
31
|
+
(0, Deleter_1.deleteSafe)(cache.rect);
|
|
32
|
+
}
|
|
33
|
+
objectCache.delete(canvasId);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
exports.freeCache = freeCache;
|
|
38
|
+
/**
|
|
39
|
+
* Returns an empty vector of Rectangles
|
|
40
|
+
* @param wasmContext
|
|
41
|
+
* @param maxSize
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
var getVectorRectVertex = function (wasmContext, maxSize) {
|
|
45
|
+
if (maxSize === void 0) { maxSize = 100; }
|
|
46
|
+
var cache = getCache(wasmContext);
|
|
47
|
+
if (!cache)
|
|
48
|
+
return undefined;
|
|
49
|
+
var vecRects = cache.vecRects;
|
|
50
|
+
if (!vecRects) {
|
|
51
|
+
vecRects = new wasmContext.VectorRectVertex();
|
|
52
|
+
vecRects.reserve(maxSize);
|
|
53
|
+
cache.vecRects = vecRects;
|
|
54
|
+
}
|
|
55
|
+
vecRects.clear();
|
|
56
|
+
return vecRects;
|
|
57
|
+
};
|
|
58
|
+
exports.getVectorRectVertex = getVectorRectVertex;
|
|
59
|
+
var getVectorColorVertex = function (wasmContext, maxSize) {
|
|
60
|
+
if (maxSize === void 0) { maxSize = 100; }
|
|
61
|
+
var cache = getCache(wasmContext);
|
|
62
|
+
if (!cache)
|
|
63
|
+
return undefined;
|
|
64
|
+
var vecColorVertex = cache.vecColorVertex;
|
|
65
|
+
if (!vecColorVertex) {
|
|
66
|
+
vecColorVertex = new wasmContext.VectorColorVertex();
|
|
67
|
+
vecColorVertex.reserve(maxSize);
|
|
68
|
+
cache.vecColorVertex = vecColorVertex;
|
|
69
|
+
}
|
|
70
|
+
vecColorVertex.clear();
|
|
71
|
+
return vecColorVertex;
|
|
72
|
+
};
|
|
73
|
+
exports.getVectorColorVertex = getVectorColorVertex;
|
|
74
|
+
var getVertex = function (wasmContext, x, y) {
|
|
75
|
+
var cache = getCache(wasmContext);
|
|
76
|
+
if (!cache)
|
|
77
|
+
return undefined;
|
|
78
|
+
var vertex = cache.vertex;
|
|
79
|
+
if (!vertex) {
|
|
80
|
+
vertex = new wasmContext.SCRTColorVertex(x, y);
|
|
81
|
+
cache.vertex = vertex;
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
vertex.SetPosition(x, y);
|
|
85
|
+
}
|
|
86
|
+
return vertex;
|
|
87
|
+
};
|
|
88
|
+
exports.getVertex = getVertex;
|
|
89
|
+
var getNativeRect = function (wasmContext, xTopLeft, yTopLeft, xBottomRight, yBottomRight) {
|
|
90
|
+
var cache = getCache(wasmContext);
|
|
91
|
+
var rect = cache.rect;
|
|
92
|
+
if (!rect) {
|
|
93
|
+
rect = new wasmContext.SCRTRectVertex(xTopLeft, yTopLeft, xBottomRight - xTopLeft, yBottomRight - yTopLeft);
|
|
94
|
+
cache.rect = rect;
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
rect.Assign(xTopLeft, yTopLeft, xBottomRight - xTopLeft, yBottomRight - yTopLeft);
|
|
98
|
+
}
|
|
99
|
+
return rect;
|
|
100
|
+
};
|
|
101
|
+
exports.getNativeRect = getNativeRect;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TSciChart } from "../../../types/TSciChart";
|
|
1
|
+
import { SCRTRectVertex, TSciChart } from "../../../types/TSciChart";
|
|
2
2
|
/**
|
|
3
3
|
* Helper function to create a {@link SCRTRectVertex} native rectangle vertex
|
|
4
4
|
* @param webAssemblyContext The {@link TSciChart | SciChart 2D WebAssembly Context} containing native methods and
|
|
@@ -8,4 +8,4 @@ import { TSciChart } from "../../../types/TSciChart";
|
|
|
8
8
|
* @param xBottomRight
|
|
9
9
|
* @param yBottomRight
|
|
10
10
|
*/
|
|
11
|
-
export declare const createNativeRect: (webAssemblyContext: TSciChart, xTopLeft: number, yTopLeft: number, xBottomRight: number, yBottomRight: number) =>
|
|
11
|
+
export declare const createNativeRect: (webAssemblyContext: TSciChart, xTopLeft: number, yTopLeft: number, xBottomRight: number, yBottomRight: number) => SCRTRectVertex;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNativeRect = void 0;
|
|
4
|
+
var NativeObject_1 = require("./NativeObject");
|
|
5
|
+
var rect;
|
|
4
6
|
/**
|
|
5
7
|
* Helper function to create a {@link SCRTRectVertex} native rectangle vertex
|
|
6
8
|
* @param webAssemblyContext The {@link TSciChart | SciChart 2D WebAssembly Context} containing native methods and
|
|
@@ -11,6 +13,6 @@ exports.createNativeRect = void 0;
|
|
|
11
13
|
* @param yBottomRight
|
|
12
14
|
*/
|
|
13
15
|
var createNativeRect = function (webAssemblyContext, xTopLeft, yTopLeft, xBottomRight, yBottomRight) {
|
|
14
|
-
return
|
|
16
|
+
return (0, NativeObject_1.getNativeRect)(webAssemblyContext, xTopLeft, yTopLeft, xBottomRight, yBottomRight);
|
|
15
17
|
};
|
|
16
18
|
exports.createNativeRect = createNativeRect;
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.drawBorder = void 0;
|
|
4
4
|
var createNativeRect_1 = require("./createNativeRect");
|
|
5
|
+
var NativeObject_1 = require("./NativeObject");
|
|
5
6
|
var drawBorder = function (renderContext, webAssemblyContext2D, solidBrushCacheBorder, borderRect, leftBorder, topBorder, rightBorder, bottomBorder, color) {
|
|
6
7
|
if (bottomBorder === 0 && topBorder === 0 && leftBorder === 0 && rightBorder === 0) {
|
|
7
8
|
return;
|
|
8
9
|
}
|
|
9
10
|
var solidBrush = solidBrushCacheBorder.newBrush(color, true);
|
|
10
|
-
var vecRects =
|
|
11
|
+
var vecRects = (0, NativeObject_1.getVectorRectVertex)(webAssemblyContext2D);
|
|
11
12
|
vecRects.push_back((0, createNativeRect_1.createNativeRect)(webAssemblyContext2D, borderRect.x, borderRect.y - topBorder, borderRect.x + borderRect.width + rightBorder, borderRect.y));
|
|
12
13
|
vecRects.push_back((0, createNativeRect_1.createNativeRect)(webAssemblyContext2D, borderRect.x + borderRect.width, borderRect.y, borderRect.x + borderRect.width + rightBorder, borderRect.y + borderRect.height + bottomBorder));
|
|
13
14
|
vecRects.push_back((0, createNativeRect_1.createNativeRect)(webAssemblyContext2D, borderRect.x - leftBorder, borderRect.y + borderRect.height, borderRect.x + borderRect.width, borderRect.y + borderRect.height + bottomBorder));
|
|
14
15
|
vecRects.push_back((0, createNativeRect_1.createNativeRect)(webAssemblyContext2D, borderRect.x - leftBorder, borderRect.y - topBorder, borderRect.x, borderRect.y + borderRect.height));
|
|
15
16
|
renderContext.drawRects(vecRects, solidBrush, 0, 0);
|
|
16
|
-
vecRects.delete();
|
|
17
17
|
};
|
|
18
18
|
exports.drawBorder = drawBorder;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Rect } from "../../../Core/Rect";
|
|
2
|
-
import { ELabelPlacement } from "../../../types/LabelPlacement";
|
|
2
|
+
import { EHorizontalAlignment, ELabelPlacement, EVerticalAlignment } from "../../../types/LabelPlacement";
|
|
3
3
|
import { IPen2D } from "../../Drawing/IPen2D";
|
|
4
4
|
import { WebGlRenderContext2D } from "../../Drawing/WebGlRenderContext2D";
|
|
5
5
|
import { AxisBase2D } from "../Axis/AxisBase2D";
|
|
@@ -8,7 +8,7 @@ export declare const drawModifiersAxisLabel: (currentAxis: AxisBase2D, renderCon
|
|
|
8
8
|
/**
|
|
9
9
|
* Function to draw Vertical or Horizontal Line annotations with labels
|
|
10
10
|
*/
|
|
11
|
-
export declare const drawLineAnnotation: (currentAxis: AxisBase2D, renderContext: WebGlRenderContext2D, labelPlacement: ELabelPlacement, displayValue: string, x1Coord: number, x2Coord: number, y1Coord: number, y2Coord: number, textStyle: TTextStyle, fill: string, strokePen: IPen2D, viewRect: Rect, showLabel: boolean, opacity: number) => Rect;
|
|
11
|
+
export declare const drawLineAnnotation: (currentAxis: AxisBase2D, renderContext: WebGlRenderContext2D, labelPlacement: ELabelPlacement, displayValue: string, x1Coord: number, x2Coord: number, y1Coord: number, y2Coord: number, textStyle: TTextStyle, fill: string, strokePen: IPen2D, viewRect: Rect, showLabel: boolean, opacity: number, horizontalAlignment?: EHorizontalAlignment, verticalAlignment?: EVerticalAlignment) => Rect;
|
|
12
12
|
export declare const drawAxisMarkerAnnotation: (currentAxis: AxisBase2D, renderContext: WebGlRenderContext2D, displayValue: string, markerCoordinate: number, x1Coord: number, y1Coord: number, textStyle: TTextStyle, fill: string, opacity: number, image: HTMLImageElement, imageWidth: number, imageHeight: number) => {
|
|
13
13
|
xPosition: number;
|
|
14
14
|
yPosition: number;
|
|
@@ -19,7 +19,7 @@ export declare const drawAxisMarkerAnnotation: (currentAxis: AxisBase2D, renderC
|
|
|
19
19
|
* Calculates coordinates of the annotation label.
|
|
20
20
|
* The coordinates are defined as an absolute position on the whole SciChartSurface.
|
|
21
21
|
*/
|
|
22
|
-
export declare const getLabelCoordinates: (currentAxis: AxisBase2D, labelPlacement: ELabelPlacement, x1Coord: number, x2Coord: number, y1Coord: number, y2Coord: number, textureHeight: number, textureWidth: number) => {
|
|
22
|
+
export declare const getLabelCoordinates: (currentAxis: AxisBase2D, labelPlacement: ELabelPlacement, x1Coord: number, x2Coord: number, y1Coord: number, y2Coord: number, textureHeight: number, textureWidth: number, horizontalAlignment?: EHorizontalAlignment, verticalAlignment?: EVerticalAlignment) => {
|
|
23
23
|
xPosition: number;
|
|
24
24
|
yPosition: number;
|
|
25
25
|
};
|
|
@@ -27,7 +27,7 @@ exports.drawModifiersAxisLabel = drawModifiersAxisLabel;
|
|
|
27
27
|
/**
|
|
28
28
|
* Function to draw Vertical or Horizontal Line annotations with labels
|
|
29
29
|
*/
|
|
30
|
-
var drawLineAnnotation = function (currentAxis, renderContext, labelPlacement, displayValue, x1Coord, x2Coord, y1Coord, y2Coord, textStyle, fill, strokePen, viewRect, showLabel, opacity) {
|
|
30
|
+
var drawLineAnnotation = function (currentAxis, renderContext, labelPlacement, displayValue, x1Coord, x2Coord, y1Coord, y2Coord, textStyle, fill, strokePen, viewRect, showLabel, opacity, horizontalAlignment, verticalAlignment) {
|
|
31
31
|
var nativeContext = renderContext.getNativeContext();
|
|
32
32
|
var axisAlignment = currentAxis.axisAlignment;
|
|
33
33
|
var displayVertically = (axisAlignment === AxisAlignment_1.EAxisAlignment.Top || axisAlignment === AxisAlignment_1.EAxisAlignment.Bottom) &&
|
|
@@ -41,17 +41,17 @@ var drawLineAnnotation = function (currentAxis, renderContext, labelPlacement, d
|
|
|
41
41
|
var labelHeight = 0;
|
|
42
42
|
var labelWidth = 0;
|
|
43
43
|
var labelRect;
|
|
44
|
+
var _a = getLineCoordinates(x1Coord, y1Coord, x2Coord, y2Coord, labelHeight, labelWidth, labelPlacement, currentAxis), x1LineCoord = _a.x1LineCoord, y1LineCoord = _a.y1LineCoord, x2LineCoord = _a.x2LineCoord, y2LineCoord = _a.y2LineCoord;
|
|
45
|
+
renderContext.drawLine(x1LineCoord, y1LineCoord, x2LineCoord, y2LineCoord, strokePen, viewRect);
|
|
44
46
|
if (showLabel) {
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
+
var _b = currentAxis.axisRenderer.createAnnotationLabelTexture(text, labelTextStyle, labelBackgroundColor, displayVertically, displayMirrored, opacity), bitmapTexture = _b.bitmapTexture, textureHeight = _b.textureHeight, textureWidth = _b.textureWidth;
|
|
48
|
+
var _c = (0, exports.getLabelCoordinates)(currentAxis, labelPlacement, x1Coord, x2Coord, y1Coord, y2Coord, textureHeight, textureWidth, horizontalAlignment, verticalAlignment), xPosition = _c.xPosition, yPosition = _c.yPosition;
|
|
47
49
|
labelHeight = textureHeight;
|
|
48
50
|
labelWidth = textureWidth;
|
|
49
51
|
labelRect = new Rect_1.Rect(xPosition, yPosition, textureWidth, textureHeight);
|
|
50
52
|
nativeContext.DrawTexture(bitmapTexture, Math.round(xPosition), Math.round(yPosition), textureWidth, textureHeight);
|
|
51
53
|
bitmapTexture.delete();
|
|
52
54
|
}
|
|
53
|
-
var _c = getLineCoordinates(x1Coord, y1Coord, x2Coord, y2Coord, labelHeight, labelWidth, labelPlacement, currentAxis), x1LineCoord = _c.x1LineCoord, y1LineCoord = _c.y1LineCoord, x2LineCoord = _c.x2LineCoord, y2LineCoord = _c.y2LineCoord;
|
|
54
|
-
renderContext.drawLine(x1LineCoord, y1LineCoord, x2LineCoord, y2LineCoord, strokePen, viewRect);
|
|
55
55
|
return labelRect;
|
|
56
56
|
};
|
|
57
57
|
exports.drawLineAnnotation = drawLineAnnotation;
|
|
@@ -74,7 +74,7 @@ exports.drawAxisMarkerAnnotation = drawAxisMarkerAnnotation;
|
|
|
74
74
|
* Calculates coordinates of the annotation label.
|
|
75
75
|
* The coordinates are defined as an absolute position on the whole SciChartSurface.
|
|
76
76
|
*/
|
|
77
|
-
var getLabelCoordinates = function (currentAxis, labelPlacement, x1Coord, x2Coord, y1Coord, y2Coord, textureHeight, textureWidth) {
|
|
77
|
+
var getLabelCoordinates = function (currentAxis, labelPlacement, x1Coord, x2Coord, y1Coord, y2Coord, textureHeight, textureWidth, horizontalAlignment, verticalAlignment) {
|
|
78
78
|
var axisAlignment = currentAxis.axisAlignment, seriesViewRect = currentAxis.parentSurface.seriesViewRect, axisViewRect = currentAxis.viewRect;
|
|
79
79
|
var xPosition = 0;
|
|
80
80
|
var yPosition = 0;
|
|
@@ -166,26 +166,46 @@ var getLabelCoordinates = function (currentAxis, labelPlacement, x1Coord, x2Coor
|
|
|
166
166
|
switch (axisAlignment) {
|
|
167
167
|
case AxisAlignment_1.EAxisAlignment.Right:
|
|
168
168
|
centerVertically();
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
if (horizontalAlignment === LabelPlacement_1.EHorizontalAlignment.Left) {
|
|
170
|
+
xPosition = seriesViewRect.left;
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
xPosition =
|
|
174
|
+
axisViewRect.width < textureWidth
|
|
175
|
+
? (xPosition = axisViewRect.right - textureWidth)
|
|
176
|
+
: axisViewRect.left;
|
|
177
|
+
}
|
|
173
178
|
break;
|
|
174
179
|
case AxisAlignment_1.EAxisAlignment.Left:
|
|
175
180
|
centerVertically();
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
181
|
+
if (horizontalAlignment === LabelPlacement_1.EHorizontalAlignment.Right) {
|
|
182
|
+
xPosition = seriesViewRect.left + seriesViewRect.width - textureWidth;
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
xPosition =
|
|
186
|
+
axisViewRect.width < textureWidth
|
|
187
|
+
? (xPosition = axisViewRect.left)
|
|
188
|
+
: axisViewRect.right - textureWidth;
|
|
189
|
+
}
|
|
180
190
|
break;
|
|
181
191
|
case AxisAlignment_1.EAxisAlignment.Top:
|
|
182
|
-
|
|
183
|
-
|
|
192
|
+
if (verticalAlignment === LabelPlacement_1.EVerticalAlignment.Bottom) {
|
|
193
|
+
yPosition = seriesViewRect.top + seriesViewRect.height - textureHeight;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
yPosition =
|
|
197
|
+
axisViewRect.height < textureHeight ? axisViewRect.top : axisViewRect.bottom - textureHeight;
|
|
198
|
+
}
|
|
184
199
|
centerHorizontally();
|
|
185
200
|
break;
|
|
186
201
|
case AxisAlignment_1.EAxisAlignment.Bottom:
|
|
187
|
-
|
|
188
|
-
|
|
202
|
+
if (verticalAlignment === LabelPlacement_1.EVerticalAlignment.Top) {
|
|
203
|
+
yPosition = seriesViewRect.top;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
yPosition =
|
|
207
|
+
axisViewRect.height < textureHeight ? axisViewRect.bottom - textureHeight : axisViewRect.top;
|
|
208
|
+
}
|
|
189
209
|
centerHorizontally();
|
|
190
210
|
break;
|
|
191
211
|
}
|
|
@@ -16,6 +16,11 @@ export interface I2DSurfaceOptions extends ISurfaceOptionsBase {
|
|
|
16
16
|
* However if height of the div is not provided it will use width/height aspect ratio to calculate the height. The default ratio is 3/2.
|
|
17
17
|
*/
|
|
18
18
|
heightAspect?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Optional - the option of disabling / enabling scaling of the {@link SciChartSurface}.
|
|
21
|
+
* If false - the {@link SciChartSurface} will take the height and width of parent div without scaling.
|
|
22
|
+
*/
|
|
23
|
+
disableAspect?: boolean;
|
|
19
24
|
/**
|
|
20
25
|
* Optional - Prove a layoutManager to customise the axis layout. Use CentralAxesLayoutManager for an easy way to configure central axes.
|
|
21
26
|
*/
|
|
@@ -32,4 +37,5 @@ export interface I2DSurfaceOptions extends ISurfaceOptionsBase {
|
|
|
32
37
|
* Optional - Properties of the canvas border
|
|
33
38
|
*/
|
|
34
39
|
canvasBorder?: TBorder;
|
|
40
|
+
drawSeriesBehindAxis?: boolean;
|
|
35
41
|
}
|
|
@@ -5,6 +5,10 @@ import { ELegendType, SciChartLegendBase } from "./SciChartLegendBase";
|
|
|
5
5
|
*/
|
|
6
6
|
export declare class SciChartLegend extends SciChartLegendBase {
|
|
7
7
|
readonly type = ELegendType.SciChartLegend;
|
|
8
|
+
/**
|
|
9
|
+
* Checked changed callback - when a legend item row checkbox is checked or unchecked. Set by parent {@link LegendModifier}
|
|
10
|
+
*/
|
|
11
|
+
legendItemCheckedChangedCallback: (series: IRenderableSeries, isChecked: boolean) => void;
|
|
8
12
|
private renderableSeriesArray;
|
|
9
13
|
private showCheckboxesProperty;
|
|
10
14
|
private showSeriesMarkersProperty;
|
|
@@ -91,9 +91,15 @@ var SciChartLegend = /** @class */ (function (_super) {
|
|
|
91
91
|
* adds event listeners to a specific {@link IRenderableSeries} series
|
|
92
92
|
*/
|
|
93
93
|
SciChartLegend.prototype.addEventListenerToSeries = function (rs) {
|
|
94
|
-
var
|
|
94
|
+
var _this = this;
|
|
95
|
+
var el = this.parentDiv.querySelector("[id='".concat(rs.id, "']"));
|
|
95
96
|
if (el) {
|
|
96
|
-
var onChangeEventListener_1 = function (e) {
|
|
97
|
+
var onChangeEventListener_1 = function (e) {
|
|
98
|
+
rs.isVisible = e.target.checked;
|
|
99
|
+
if (_this.legendItemCheckedChangedCallback) {
|
|
100
|
+
_this.legendItemCheckedChangedCallback(rs, rs.isVisible);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
97
103
|
el.addEventListener("change", onChangeEventListener_1);
|
|
98
104
|
var eventSubscriptionItem = {
|
|
99
105
|
element: el,
|
|
@@ -44,6 +44,7 @@ export declare enum ELegendType {
|
|
|
44
44
|
export declare abstract class SciChartLegendBase implements IDeletable {
|
|
45
45
|
abstract readonly type: ELegendType;
|
|
46
46
|
protected rootDiv: HTMLDivElement;
|
|
47
|
+
protected parentDiv: HTMLDivElement;
|
|
47
48
|
protected div: HTMLDivElement;
|
|
48
49
|
protected seriesViewRect: Rect;
|
|
49
50
|
protected invalidateParentSurface: () => void;
|
|
@@ -190,8 +190,9 @@ var SciChartLegendBase = /** @class */ (function () {
|
|
|
190
190
|
var _a;
|
|
191
191
|
if (this.div) {
|
|
192
192
|
this.removeEventListeners();
|
|
193
|
-
(_a = this.
|
|
193
|
+
(_a = this.parentDiv) === null || _a === void 0 ? void 0 : _a.removeChild(this.div);
|
|
194
194
|
this.div = undefined;
|
|
195
|
+
this.parentDiv = undefined;
|
|
195
196
|
}
|
|
196
197
|
};
|
|
197
198
|
/**
|
|
@@ -244,7 +245,8 @@ var SciChartLegendBase = /** @class */ (function () {
|
|
|
244
245
|
var innerHtml = this.getInnerHTML();
|
|
245
246
|
if (innerHtml) {
|
|
246
247
|
var div = (0, html_1.htmlToElement)(innerHtml);
|
|
247
|
-
this.getParentDiv()
|
|
248
|
+
this.parentDiv = this.getParentDiv();
|
|
249
|
+
this.parentDiv.appendChild(div);
|
|
248
250
|
this.div = div;
|
|
249
251
|
if (!app_1.IS_TEST_ENV) {
|
|
250
252
|
this.addEventListeners();
|
|
@@ -95,7 +95,7 @@ var SciChartPieLegend = /** @class */ (function (_super) {
|
|
|
95
95
|
SciChartPieLegend.prototype.addEventListeners = function () {
|
|
96
96
|
var _this = this;
|
|
97
97
|
this.pieSegmentArray.forEach(function (ps) {
|
|
98
|
-
var el = _this.
|
|
98
|
+
var el = _this.parentDiv.querySelector("#".concat(getCheckboxId(ps.id)));
|
|
99
99
|
if (!el) {
|
|
100
100
|
return;
|
|
101
101
|
}
|