scichart 2.2.2351 → 2.2.2393
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/buildSeries.d.ts +7 -2
- package/Builder/buildSeries.js +5 -1
- package/Charting/ChartModifiers/ModifierMouseArgs.d.ts +2 -2
- package/Charting/ChartModifiers/ModifierMouseArgs.js +4 -2
- package/Charting/Drawing/WebGlRenderContext2D.js +26 -42
- package/Charting/Model/BaseHeatmapDataSeries.js +1 -1
- 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/HlcPointSeriesWrapped.d.ts +10 -0
- package/Charting/Model/PointSeries/HlcPointSeriesWrapped.js +31 -0
- package/Charting/Model/PointSeries/IPointSeries.d.ts +5 -0
- 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/RolloverTooltipSvgAnnotation.js +8 -0
- package/Charting/Visuals/Axis/AxisBase2D.d.ts +1 -1
- package/Charting/Visuals/Axis/AxisBase2D.js +9 -22
- 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 +7 -2
- package/Charting/Visuals/Axis/LabelProvider/PieLabelProvider.js +9 -4
- package/Charting/Visuals/Axis/LabelProvider/SmartDateLabelProvider.js +18 -2
- 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/Legend/SciChartLegend.js +1 -1
- 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 +9 -2
- package/Charting/Visuals/RenderableSeries/BaseRenderableSeries.js +74 -22
- 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/StackedColumnCollection.js +1 -2
- package/Charting/Visuals/RenderableSeries/constants.d.ts +5 -0
- package/Charting/Visuals/RenderableSeries/constants.js +5 -0
- package/Charting/Visuals/SciChartPieSurface/IPieSurfaceOptions.d.ts +2 -1
- package/Charting/Visuals/SciChartPieSurface/PieSegment/IPieSegment.d.ts +5 -0
- package/Charting/Visuals/SciChartPieSurface/PieSegment/PieSegment.d.ts +116 -1
- package/Charting/Visuals/SciChartPieSurface/PieSegment/PieSegment.js +139 -4
- package/Charting/Visuals/SciChartPieSurface/PieSegment/constants.d.ts +4 -1
- package/Charting/Visuals/SciChartPieSurface/PieSegment/constants.js +3 -0
- package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.d.ts +13 -3
- package/Charting/Visuals/SciChartPieSurface/SciChartPieSurface.js +114 -74
- package/Charting/Visuals/SciChartPieSurface/constants.d.ts +2 -1
- package/Charting/Visuals/SciChartPieSurface/constants.js +1 -0
- package/Charting/Visuals/createMaster.js +15 -11
- package/Charting/Visuals/createSingle.js +3 -1
- 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/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 +22 -16
- package/Charting3D/Visuals/createSingle3d.js +5 -6
- 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 +10 -10
- 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/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/NumericFormat.d.ts +4 -0
- package/types/NumericFormat.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/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
- package/utils/number.js +15 -2
|
@@ -16,9 +16,9 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
})();
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.LogarithmicCoordinateCalculator = void 0;
|
|
19
|
-
var CoordinateCalculatorBase_1 = require("./CoordinateCalculatorBase");
|
|
20
|
-
var XyDirection_1 = require("../../../types/XyDirection");
|
|
21
19
|
var NumberRange_1 = require("../../../Core/NumberRange");
|
|
20
|
+
var XyDirection_1 = require("../../../types/XyDirection");
|
|
21
|
+
var CoordinateCalculatorBase_1 = require("./CoordinateCalculatorBase");
|
|
22
22
|
/**
|
|
23
23
|
* Provides an implementation of Numeric {@link CoordinateCalculatorBase | Coordinate Calculator} which transforms
|
|
24
24
|
* numeric data-values to pixel coordinates using logarithmic scaling and vice versa.
|
|
@@ -73,18 +73,27 @@ var LogarithmicCoordinateCalculator = /** @class */ (function (_super) {
|
|
|
73
73
|
configurable: true
|
|
74
74
|
});
|
|
75
75
|
LogarithmicCoordinateCalculator.prototype.translateBy = function (pixels, range) {
|
|
76
|
+
if (pixels === 0) {
|
|
77
|
+
return range;
|
|
78
|
+
}
|
|
76
79
|
var zeroPoint = Math.abs(this.nativeCalculator.GetDataValue(0));
|
|
77
80
|
var toScrollPoint = Math.abs(this.nativeCalculator.GetDataValue(pixels));
|
|
78
81
|
var numberUtil = this.webAssemblyContext.NumberUtil;
|
|
82
|
+
var isNegative = range.min < 0;
|
|
83
|
+
if (isNegative) {
|
|
84
|
+
range = new NumberRange_1.NumberRange(Math.abs(range.max), Math.abs(range.min));
|
|
85
|
+
}
|
|
79
86
|
var expDelta = numberUtil.Log(toScrollPoint, this.logBase) - numberUtil.Log(zeroPoint, this.logBase);
|
|
80
87
|
if (this.hasFlippedCoordinates)
|
|
81
88
|
expDelta = -expDelta;
|
|
82
89
|
var expMin = numberUtil.Log(range.min, this.logBase);
|
|
83
90
|
var expMax = numberUtil.Log(range.max, this.logBase);
|
|
84
|
-
var
|
|
85
|
-
var
|
|
86
|
-
|
|
87
|
-
|
|
91
|
+
var newMin = Math.pow(this.logBase, expMin + expDelta);
|
|
92
|
+
var newMax = Math.pow(this.logBase, expMax + expDelta);
|
|
93
|
+
if (isNegative)
|
|
94
|
+
return new NumberRange_1.NumberRange(-newMax, -newMin);
|
|
95
|
+
else
|
|
96
|
+
return new NumberRange_1.NumberRange(newMin, newMax);
|
|
88
97
|
};
|
|
89
98
|
LogarithmicCoordinateCalculator.prototype.zoomTranslateBy = function (minFraction, maxFraction, inputRange) {
|
|
90
99
|
return inputRange.growByLog(new NumberRange_1.NumberRange(minFraction, maxFraction), this.logBase);
|
|
@@ -223,6 +223,12 @@ var SciChartRenderer = /** @class */ (function () {
|
|
|
223
223
|
// Convert seriesViewRect back to device pixels
|
|
224
224
|
// e.g. at Retina display canvas size may be 400x300 but seriesViewRect size would be 800x600
|
|
225
225
|
var viewRectInDevicePixels = new Rect_1.Rect(seriesViewRect.x / DpiHelper_1.DpiHelper.PIXEL_RATIO, seriesViewRect.y / DpiHelper_1.DpiHelper.PIXEL_RATIO, seriesViewRect.width / DpiHelper_1.DpiHelper.PIXEL_RATIO, seriesViewRect.height / DpiHelper_1.DpiHelper.PIXEL_RATIO);
|
|
226
|
+
if (!this.prevRect) {
|
|
227
|
+
this.prevRect = viewRectInDevicePixels;
|
|
228
|
+
}
|
|
229
|
+
else if (Rect_1.Rect.isEqual(this.prevRect, viewRectInDevicePixels)) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
226
232
|
var svgRootElement = this.sciChartSurface.domSvgContainer;
|
|
227
233
|
if (svgRootElement) {
|
|
228
234
|
svgRootElement.style.marginLeft = "".concat(viewRectInDevicePixels.x, "px");
|
|
@@ -193,6 +193,14 @@ var defaultTooltipDataTemplate = function (seriesInfo, tooltipTitle, tooltipLabe
|
|
|
193
193
|
valuesWithLabels.push("Lowest: ".concat(ohlcSeriesInfo.formattedLowValue));
|
|
194
194
|
valuesWithLabels.push("Close: ".concat(ohlcSeriesInfo.formattedCloseValue));
|
|
195
195
|
}
|
|
196
|
+
else if (seriesInfo.dataSeriesType === IDataSeries_1.EDataSeriesType.Hlc) {
|
|
197
|
+
var hlcSeriesInfo = seriesInfo;
|
|
198
|
+
if (tooltipLabelX) {
|
|
199
|
+
valuesWithLabels.push("".concat(tooltipLabelX, ": ").concat(hlcSeriesInfo.formattedXValue));
|
|
200
|
+
}
|
|
201
|
+
valuesWithLabels.push("High: ".concat(hlcSeriesInfo.formattedHighValue));
|
|
202
|
+
valuesWithLabels.push("Low: ".concat(hlcSeriesInfo.formattedLowValue));
|
|
203
|
+
}
|
|
196
204
|
else if (seriesInfo.dataSeriesType === IDataSeries_1.EDataSeriesType.Xyy) {
|
|
197
205
|
// Band Series
|
|
198
206
|
var xyySeriesInfo = seriesInfo;
|
|
@@ -308,7 +308,7 @@ export declare abstract class AxisBase2D extends AxisCore implements IThemeable
|
|
|
308
308
|
* Gets or sets a {@link IAutoRangeAnimationOptions} object that controls if and how the visible range is animated during autoRanging
|
|
309
309
|
*/
|
|
310
310
|
set autoRangeAnimation(autoRangeAnimation: IAutoRangeAnimationOptions);
|
|
311
|
-
abstract type: EAxisType.CategoryAxis | EAxisType.LogarithmicAxis | EAxisType.NumericAxis;
|
|
311
|
+
abstract type: EAxisType.CategoryAxis | EAxisType.LogarithmicAxis | EAxisType.NumericAxis | EAxisType.DateTimeNumericAxis;
|
|
312
312
|
/**
|
|
313
313
|
* Gets the parent {@link SciChartSurface} that this axis is attached to
|
|
314
314
|
*/
|
|
@@ -45,6 +45,7 @@ var WebGlRenderContext2D_1 = require("../../Drawing/WebGlRenderContext2D");
|
|
|
45
45
|
var DefaultTickCoordinatesProvider_1 = require("../../Numerics/TickCoordinateProviders/DefaultTickCoordinatesProvider");
|
|
46
46
|
var createNativeRect_1 = require("../Helpers/createNativeRect");
|
|
47
47
|
var drawBorder_1 = require("../Helpers/drawBorder");
|
|
48
|
+
var NativeObject_1 = require("../Helpers/NativeObject");
|
|
48
49
|
var SciChartSurfaceBase_1 = require("../SciChartSurfaceBase");
|
|
49
50
|
var DpiHelper_1 = require("../TextureManager/DpiHelper");
|
|
50
51
|
var AxisCore_1 = require("./AxisCore");
|
|
@@ -646,18 +647,14 @@ var AxisBase2D = /** @class */ (function (_super) {
|
|
|
646
647
|
nativeAxisRect = (0, createNativeRect_1.createNativeRect)(_this.webAssemblyContext2D, 0, 0, viewAxisRect.width, viewAxisRect.height);
|
|
647
648
|
nativeTitleRect = (0, createNativeRect_1.createNativeRect)(_this.webAssemblyContext2D, 0, 0, viewTitleRect.width, viewTitleRect.height);
|
|
648
649
|
if (nativeAxisRect) {
|
|
649
|
-
var vecRects =
|
|
650
|
+
var vecRects = (0, NativeObject_1.getVectorRectVertex)(_this.webAssemblyContext2D);
|
|
650
651
|
vecRects.push_back(nativeAxisRect);
|
|
651
652
|
renderContext.drawRects(vecRects, brush, viewAxisRect.left, viewAxisRect.top);
|
|
652
|
-
nativeAxisRect.delete();
|
|
653
|
-
vecRects.delete();
|
|
654
653
|
}
|
|
655
654
|
if (nativeTitleRect) {
|
|
656
|
-
var vecRects =
|
|
655
|
+
var vecRects = (0, NativeObject_1.getVectorRectVertex)(_this.webAssemblyContext2D);
|
|
657
656
|
vecRects.push_back(nativeTitleRect);
|
|
658
657
|
renderContext.drawRects(vecRects, brush, viewTitleRect.left, viewTitleRect.top);
|
|
659
|
-
nativeTitleRect === null || nativeTitleRect === void 0 ? void 0 : nativeTitleRect.delete();
|
|
660
|
-
vecRects.delete();
|
|
661
658
|
}
|
|
662
659
|
brush.delete();
|
|
663
660
|
}
|
|
@@ -688,26 +685,22 @@ var AxisBase2D = /** @class */ (function (_super) {
|
|
|
688
685
|
this.axisRenderer.drawDebug = true;
|
|
689
686
|
var drawTickViewRects = function () {
|
|
690
687
|
var viewRect = _this.axisRenderer.viewRect;
|
|
691
|
-
var vecRects =
|
|
688
|
+
var vecRects = (0, NativeObject_1.getVectorRectVertex)(_this.webAssemblyContext2D);
|
|
692
689
|
var brush = new _this.webAssemblyContext2D.SCRTSolidBrush((0, parseColor_1.parseColorToUIntArgb)("rgba(255,0,0,0.7)"), false);
|
|
693
690
|
var nativeRect = (0, createNativeRect_1.createNativeRect)(_this.webAssemblyContext2D, 0, 0, viewRect.width, viewRect.height);
|
|
694
691
|
vecRects.push_back(nativeRect);
|
|
695
692
|
renderContext.drawRects(vecRects, brush, viewRect.left, viewRect.top);
|
|
696
|
-
nativeRect.delete();
|
|
697
693
|
brush.delete();
|
|
698
|
-
vecRects.delete();
|
|
699
694
|
};
|
|
700
695
|
drawTickViewRects();
|
|
701
696
|
var drawTitleViewRects = function () {
|
|
702
697
|
var viewRect = _this.axisTitleRenderer.viewRect;
|
|
703
|
-
var vecRects =
|
|
698
|
+
var vecRects = (0, NativeObject_1.getVectorRectVertex)(_this.webAssemblyContext2D);
|
|
704
699
|
var brush = new _this.webAssemblyContext2D.SCRTSolidBrush((0, parseColor_1.parseColorToUIntArgb)("rgba(0,255,0,0.7)"), false);
|
|
705
700
|
var nativeRect = (0, createNativeRect_1.createNativeRect)(_this.webAssemblyContext2D, 0, 0, viewRect.width, viewRect.height);
|
|
706
701
|
vecRects.push_back(nativeRect);
|
|
707
702
|
renderContext.drawRects(vecRects, brush, viewRect.left, viewRect.top);
|
|
708
|
-
nativeRect.delete();
|
|
709
703
|
brush.delete();
|
|
710
|
-
vecRects.delete();
|
|
711
704
|
};
|
|
712
705
|
drawTitleViewRects();
|
|
713
706
|
};
|
|
@@ -1000,14 +993,13 @@ var AxisBase2D = /** @class */ (function (_super) {
|
|
|
1000
993
|
// Even/Odd calculation helps preserve order of bands as you scroll
|
|
1001
994
|
var firstTickIndex = this.getMajorTickIndex(ticks[0]);
|
|
1002
995
|
var isEven = firstTickIndex % 2 === 0;
|
|
1003
|
-
var vecRects =
|
|
996
|
+
var vecRects = (0, NativeObject_1.getVectorRectVertex)(this.webAssemblyContext2D);
|
|
1004
997
|
var drawBand = function (coord0, coord1, isThisBandEven) {
|
|
1005
998
|
if (!isThisBandEven) {
|
|
1006
999
|
return;
|
|
1007
1000
|
}
|
|
1008
1001
|
var nativeRect = (0, createNativeRect_1.createNativeRect)(_this.webAssemblyContext2D, direction === XyDirection_1.EXyDirection.YDirection ? 0 : coord0, direction === XyDirection_1.EXyDirection.YDirection ? coord0 : 0, direction === XyDirection_1.EXyDirection.YDirection ? seriesViewRect.width : coord1, direction === XyDirection_1.EXyDirection.YDirection ? coord1 : seriesViewRect.height);
|
|
1009
1002
|
vecRects.push_back(nativeRect);
|
|
1010
|
-
nativeRect.delete();
|
|
1011
1003
|
};
|
|
1012
1004
|
ticks.forEach(function (mt, index) {
|
|
1013
1005
|
var coord0 = index === 0 ? min : tickCoords[index - 1];
|
|
@@ -1018,7 +1010,6 @@ var AxisBase2D = /** @class */ (function (_super) {
|
|
|
1018
1010
|
// Draw the last band to the edge of the screen
|
|
1019
1011
|
drawBand(max, tickCoords[ticks.length - 1], isEven);
|
|
1020
1012
|
renderContext.drawRects(vecRects, brush, seriesViewRect.left, seriesViewRect.top);
|
|
1021
|
-
vecRects.delete();
|
|
1022
1013
|
};
|
|
1023
1014
|
/**
|
|
1024
1015
|
* Called internally - draws the Axis Grid Lines
|
|
@@ -1031,22 +1022,18 @@ var AxisBase2D = /** @class */ (function (_super) {
|
|
|
1031
1022
|
if (!tickCoords || tickCoords.length === 0)
|
|
1032
1023
|
return;
|
|
1033
1024
|
var seriesViewRect = this.parentSurface.seriesViewRect;
|
|
1034
|
-
var vertices =
|
|
1025
|
+
var vertices = (0, NativeObject_1.getVectorColorVertex)(this.webAssemblyContext2D);
|
|
1035
1026
|
tickCoords.forEach(function (tc) {
|
|
1036
1027
|
var x1 = _this.isHorizontalAxis ? tc : 0;
|
|
1037
1028
|
var x2 = _this.isHorizontalAxis ? tc : seriesViewRect.width;
|
|
1038
1029
|
var y1 = _this.isHorizontalAxis ? 0 : tc;
|
|
1039
1030
|
var y2 = _this.isHorizontalAxis ? seriesViewRect.height : tc;
|
|
1040
|
-
var vertex =
|
|
1031
|
+
var vertex = (0, NativeObject_1.getVertex)(_this.webAssemblyContext2D, x1, y1);
|
|
1041
1032
|
vertices.push_back(vertex);
|
|
1042
|
-
|
|
1043
|
-
var vertex2 = new _this.webAssemblyContext2D.SCRTColorVertex(x2, y2);
|
|
1033
|
+
var vertex2 = (0, NativeObject_1.getVertex)(_this.webAssemblyContext2D, x2, y2);
|
|
1044
1034
|
vertices.push_back(vertex2);
|
|
1045
|
-
vertex2.delete();
|
|
1046
1035
|
});
|
|
1047
1036
|
renderContext.drawLinesNative(vertices, linesPen, WebGlRenderContext2D_1.ELineDrawMode.DiscontinuousLine, seriesViewRect.left, seriesViewRect.top);
|
|
1048
|
-
vertices.clear();
|
|
1049
|
-
vertices.delete();
|
|
1050
1037
|
};
|
|
1051
1038
|
AxisBase2D.prototype.getXVisibleRange = function (xAxisId) {
|
|
1052
1039
|
return this.parentSurface.getXAxisById(xAxisId).visibleRange;
|
|
@@ -741,6 +741,10 @@ export declare abstract class AxisCore implements IAxisParams, IDeletable {
|
|
|
741
741
|
* allows you to transform between pixel and data coordinates (and vice versa)
|
|
742
742
|
*/
|
|
743
743
|
getCurrentCoordinateCalculator(forceRecreate?: boolean): CoordinateCalculatorBase;
|
|
744
|
+
/** Force the recreation of the coordinate calculator the next time it is requested
|
|
745
|
+
* Required if the dataSeries has changed on a category axis
|
|
746
|
+
*/
|
|
747
|
+
clearCoordCalcCache(): void;
|
|
744
748
|
/**
|
|
745
749
|
* Gets a default value to apply to {@link AxisCore.visibleRange} if none provided, and no auto-range operation
|
|
746
750
|
*/
|
|
@@ -970,6 +970,12 @@ var AxisCore = /** @class */ (function () {
|
|
|
970
970
|
}
|
|
971
971
|
return this.coordCalcCache;
|
|
972
972
|
};
|
|
973
|
+
/** Force the recreation of the coordinate calculator the next time it is requested
|
|
974
|
+
* Required if the dataSeries has changed on a category axis
|
|
975
|
+
*/
|
|
976
|
+
AxisCore.prototype.clearCoordCalcCache = function () {
|
|
977
|
+
this.coordCalcCache = (0, Deleter_1.deleteSafe)(this.coordCalcCache);
|
|
978
|
+
};
|
|
973
979
|
/**
|
|
974
980
|
* @inheritDoc
|
|
975
981
|
*/
|
|
@@ -21,6 +21,7 @@ var LabelAlignment_1 = require("../../../types/LabelAlignment");
|
|
|
21
21
|
var parseColor_1 = require("../../../utils/parseColor");
|
|
22
22
|
var WebGlRenderContext2D_1 = require("../../Drawing/WebGlRenderContext2D");
|
|
23
23
|
var createNativeRect_1 = require("../Helpers/createNativeRect");
|
|
24
|
+
var NativeObject_1 = require("../Helpers/NativeObject");
|
|
24
25
|
var SciChartSurfaceBase_1 = require("../SciChartSurfaceBase");
|
|
25
26
|
var DpiHelper_1 = require("../TextureManager/DpiHelper");
|
|
26
27
|
var TextureManager_1 = require("../TextureManager/TextureManager");
|
|
@@ -45,7 +46,7 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
45
46
|
this.hideOverlappingLabelsProperty = true;
|
|
46
47
|
this.webAssemblyContext = webAssemblyContext;
|
|
47
48
|
this.textureManager = new TextureManager_1.TextureManager(webAssemblyContext);
|
|
48
|
-
this.vertices =
|
|
49
|
+
this.vertices = (0, NativeObject_1.getVectorColorVertex)(webAssemblyContext);
|
|
49
50
|
if (!app_1.IS_TEST_ENV) {
|
|
50
51
|
this.measureTextCanvas = document.createElement("canvas");
|
|
51
52
|
this.measureTextCanvas.width = 1;
|
|
@@ -56,7 +57,6 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
56
57
|
AxisRenderer.prototype.delete = function () {
|
|
57
58
|
this.measureTextCanvas = undefined;
|
|
58
59
|
this.textureManager = (0, Deleter_1.deleteSafe)(this.textureManager);
|
|
59
|
-
this.vertices = (0, Deleter_1.deleteSafe)(this.vertices);
|
|
60
60
|
};
|
|
61
61
|
/**
|
|
62
62
|
* Called when the {@link AxisRenderer} is attached to an {@link AxisBase2D | Axis}
|
|
@@ -313,6 +313,7 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
313
313
|
return;
|
|
314
314
|
var viewRect = this.viewRect;
|
|
315
315
|
var tickSize = tickStyle.tickSize;
|
|
316
|
+
this.vertices.clear();
|
|
316
317
|
var isHorizontal = (0, AxisAlignment_1.getIsHorizontal)(axisAlignment);
|
|
317
318
|
if (isHorizontal === undefined) {
|
|
318
319
|
return;
|
|
@@ -347,17 +348,14 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
347
348
|
y2 = tc;
|
|
348
349
|
}
|
|
349
350
|
}
|
|
350
|
-
var vertex =
|
|
351
|
+
var vertex = (0, NativeObject_1.getVertex)(_this.webAssemblyContext, x1, y1);
|
|
351
352
|
_this.vertices.push_back(vertex);
|
|
352
|
-
|
|
353
|
-
var vertex2 = new _this.webAssemblyContext.SCRTColorVertex(x2, y2);
|
|
353
|
+
var vertex2 = (0, NativeObject_1.getVertex)(_this.webAssemblyContext, x2, y2);
|
|
354
354
|
_this.vertices.push_back(vertex2);
|
|
355
|
-
vertex2.delete();
|
|
356
355
|
});
|
|
357
356
|
var leftOffset = viewRect.left - (isHorizontal ? axisOffset : 0);
|
|
358
357
|
var topOffset = viewRect.top - (isHorizontal ? 0 : axisOffset);
|
|
359
358
|
renderContext.drawLinesNative(this.vertices, pen, WebGlRenderContext2D_1.ELineDrawMode.DiscontinuousLine, leftOffset, topOffset);
|
|
360
|
-
this.vertices.clear();
|
|
361
359
|
};
|
|
362
360
|
/**
|
|
363
361
|
* Called internally - draws axis labels when needed, for example for line annotations
|
|
@@ -440,17 +438,15 @@ var AxisRenderer = /** @class */ (function () {
|
|
|
440
438
|
}
|
|
441
439
|
};
|
|
442
440
|
AxisRenderer.prototype.drawLabelViewRects = function (renderContext, axisRect, rects) {
|
|
443
|
-
var vecRects =
|
|
441
|
+
var vecRects = (0, NativeObject_1.getVectorRectVertex)(this.webAssemblyContext);
|
|
444
442
|
var brush = new this.webAssemblyContext.SCRTSolidBrush((0, parseColor_1.parseColorToUIntArgb)("rgba(30,30,255,0.3)"), false);
|
|
445
443
|
for (var _i = 0, rects_1 = rects; _i < rects_1.length; _i++) {
|
|
446
444
|
var rect = rects_1[_i];
|
|
447
445
|
var nativeRect = (0, createNativeRect_1.createNativeRect)(this.webAssemblyContext, rect.left, rect.top, rect.right, rect.bottom);
|
|
448
446
|
vecRects.push_back(nativeRect);
|
|
449
|
-
nativeRect.delete();
|
|
450
447
|
}
|
|
451
448
|
renderContext.drawRects(vecRects, brush, this.viewRect.left, this.viewRect.top);
|
|
452
449
|
brush.delete();
|
|
453
|
-
vecRects.delete();
|
|
454
450
|
};
|
|
455
451
|
return AxisRenderer;
|
|
456
452
|
}());
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TSciChart } from "../../../types/TSciChart";
|
|
2
|
+
import { IAxisBase2dOptions } from "./AxisBase2D";
|
|
3
|
+
import { ILabel2DOptions } from "./LabelProvider/LabelProviderBase2D";
|
|
4
|
+
import { NumericAxis } from "./NumericAxis";
|
|
5
|
+
export interface IDateTimeNumericAxisOptions extends IAxisBase2dOptions, ILabel2DOptions {
|
|
6
|
+
possibleDeltas?: number[];
|
|
7
|
+
minTicks?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class DateTimeNumericAxis extends NumericAxis {
|
|
10
|
+
constructor(webAssemblyContext: TSciChart, options?: IDateTimeNumericAxisOptions);
|
|
11
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.DateTimeNumericAxis = void 0;
|
|
19
|
+
var DateTimeDeltaCalculator_1 = require("./DeltaCalculator/DateTimeDeltaCalculator");
|
|
20
|
+
var SmartDateLabelProvider_1 = require("./LabelProvider/SmartDateLabelProvider");
|
|
21
|
+
var NumericAxis_1 = require("./NumericAxis");
|
|
22
|
+
var DateTimeNumericAxis = /** @class */ (function (_super) {
|
|
23
|
+
__extends(DateTimeNumericAxis, _super);
|
|
24
|
+
function DateTimeNumericAxis(webAssemblyContext, options) {
|
|
25
|
+
var _a;
|
|
26
|
+
var _this = _super.call(this, webAssemblyContext, options) || this;
|
|
27
|
+
_this.labelProvider = (_a = options === null || options === void 0 ? void 0 : options.labelProvider) !== null && _a !== void 0 ? _a : new SmartDateLabelProvider_1.SmartDateLabelProvider();
|
|
28
|
+
_this.deltaCalculator = new DateTimeDeltaCalculator_1.DateTimeDeltaCalculator({
|
|
29
|
+
possibleDeltas: options === null || options === void 0 ? void 0 : options.possibleDeltas,
|
|
30
|
+
minTicks: options === null || options === void 0 ? void 0 : options.minTicks
|
|
31
|
+
});
|
|
32
|
+
return _this;
|
|
33
|
+
}
|
|
34
|
+
return DateTimeNumericAxis;
|
|
35
|
+
}(NumericAxis_1.NumericAxis));
|
|
36
|
+
exports.DateTimeNumericAxis = DateTimeNumericAxis;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { NumberRange } from "../../../../Core/NumberRange";
|
|
2
|
+
import { DeltaCalculator } from "./DeltaCalculator";
|
|
3
|
+
export interface IDeltaCalculatorOptions {
|
|
4
|
+
possibleDeltas?: number[];
|
|
5
|
+
minTicks?: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The DateTimeDeltaCalculator is respinsible for calculating {@link AxisCore.minorDelta} and {@link AxisCore.majorDelta} on
|
|
9
|
+
* {@link NumericAxis} types.
|
|
10
|
+
*/
|
|
11
|
+
export declare class DateTimeDeltaCalculator extends DeltaCalculator {
|
|
12
|
+
private possibleDeltasProperty;
|
|
13
|
+
private minTicksProperty;
|
|
14
|
+
private prevIndex;
|
|
15
|
+
private currIndex;
|
|
16
|
+
constructor(options?: IDeltaCalculatorOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Gets or sets deltas array
|
|
19
|
+
*/
|
|
20
|
+
get possibleDeltas(): number[];
|
|
21
|
+
set possibleDeltas(value: number[]);
|
|
22
|
+
get minTicks(): number;
|
|
23
|
+
set minTicks(value: number);
|
|
24
|
+
/**
|
|
25
|
+
* @inheritDoc
|
|
26
|
+
*/
|
|
27
|
+
getDeltaFromRange(min: number, max: number, minorsPerMajor: number, maxTicks: number): NumberRange;
|
|
28
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.DateTimeDeltaCalculator = void 0;
|
|
19
|
+
var NumberRange_1 = require("../../../../Core/NumberRange");
|
|
20
|
+
var DeltaCalculator_1 = require("./DeltaCalculator");
|
|
21
|
+
/**
|
|
22
|
+
* The DateTimeDeltaCalculator is respinsible for calculating {@link AxisCore.minorDelta} and {@link AxisCore.majorDelta} on
|
|
23
|
+
* {@link NumericAxis} types.
|
|
24
|
+
*/
|
|
25
|
+
var DateTimeDeltaCalculator = /** @class */ (function (_super) {
|
|
26
|
+
__extends(DateTimeDeltaCalculator, _super);
|
|
27
|
+
function DateTimeDeltaCalculator(options) {
|
|
28
|
+
var _a;
|
|
29
|
+
var _this = _super.call(this) || this;
|
|
30
|
+
_this.possibleDeltasProperty = [
|
|
31
|
+
1,
|
|
32
|
+
2,
|
|
33
|
+
5,
|
|
34
|
+
10,
|
|
35
|
+
15,
|
|
36
|
+
30,
|
|
37
|
+
60,
|
|
38
|
+
2 * 60,
|
|
39
|
+
5 * 60,
|
|
40
|
+
10 * 60,
|
|
41
|
+
15 * 60,
|
|
42
|
+
30 * 60,
|
|
43
|
+
60 * 60,
|
|
44
|
+
3 * 60 * 60,
|
|
45
|
+
6 * 60 * 60,
|
|
46
|
+
12 * 60 * 60,
|
|
47
|
+
24 * 60 * 60,
|
|
48
|
+
3 * 24 * 60 * 60,
|
|
49
|
+
5 * 24 * 60 * 60,
|
|
50
|
+
10 * 24 * 60 * 60,
|
|
51
|
+
15 * 24 * 60 * 60,
|
|
52
|
+
20 * 24 * 60 * 60,
|
|
53
|
+
30 * 24 * 60 * 60,
|
|
54
|
+
// TODO these month deltas really need special handling
|
|
55
|
+
2 * 30 * 24 * 60 * 60,
|
|
56
|
+
4 * 30 * 24 * 60 * 60,
|
|
57
|
+
6 * 30 * 24 * 60 * 60,
|
|
58
|
+
12 * 30 * 24 * 60 * 60
|
|
59
|
+
];
|
|
60
|
+
_this.currIndex = 12;
|
|
61
|
+
_this.possibleDeltasProperty = (_a = options === null || options === void 0 ? void 0 : options.possibleDeltas) !== null && _a !== void 0 ? _a : _this.possibleDeltasProperty;
|
|
62
|
+
_this.minTicks = options === null || options === void 0 ? void 0 : options.minTicks;
|
|
63
|
+
return _this;
|
|
64
|
+
}
|
|
65
|
+
Object.defineProperty(DateTimeDeltaCalculator.prototype, "possibleDeltas", {
|
|
66
|
+
/**
|
|
67
|
+
* Gets or sets deltas array
|
|
68
|
+
*/
|
|
69
|
+
get: function () {
|
|
70
|
+
return this.possibleDeltasProperty;
|
|
71
|
+
},
|
|
72
|
+
set: function (value) {
|
|
73
|
+
if (this.possibleDeltasProperty !== value) {
|
|
74
|
+
this.possibleDeltasProperty = value;
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
enumerable: false,
|
|
78
|
+
configurable: true
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(DateTimeDeltaCalculator.prototype, "minTicks", {
|
|
81
|
+
get: function () {
|
|
82
|
+
return this.minTicksProperty;
|
|
83
|
+
},
|
|
84
|
+
set: function (value) {
|
|
85
|
+
if (this.minTicksProperty !== value) {
|
|
86
|
+
this.minTicksProperty = value;
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
enumerable: false,
|
|
90
|
+
configurable: true
|
|
91
|
+
});
|
|
92
|
+
/**
|
|
93
|
+
* @inheritDoc
|
|
94
|
+
*/
|
|
95
|
+
DateTimeDeltaCalculator.prototype.getDeltaFromRange = function (min, max, minorsPerMajor, maxTicks) {
|
|
96
|
+
var _this = this;
|
|
97
|
+
var diff = max - min;
|
|
98
|
+
this.prevIndex = undefined;
|
|
99
|
+
var calculateDelta = function (deltas, index) {
|
|
100
|
+
var _a;
|
|
101
|
+
var delta = deltas[index];
|
|
102
|
+
var ticksCount = Math.floor(diff / delta);
|
|
103
|
+
if (ticksCount < ((_a = _this.minTicks) !== null && _a !== void 0 ? _a : maxTicks / 3) && index > 0 && index !== _this.prevIndex) {
|
|
104
|
+
if (!_this.prevIndex)
|
|
105
|
+
_this.prevIndex = index;
|
|
106
|
+
return calculateDelta(deltas, index - 1);
|
|
107
|
+
}
|
|
108
|
+
if (ticksCount > maxTicks && index < deltas.length && index !== _this.prevIndex) {
|
|
109
|
+
if (!_this.prevIndex)
|
|
110
|
+
_this.prevIndex = index;
|
|
111
|
+
return calculateDelta(deltas, index + 1);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
if (_this.currIndex !== index) {
|
|
115
|
+
_this.currIndex = index;
|
|
116
|
+
}
|
|
117
|
+
return delta;
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
var delta = calculateDelta(this.possibleDeltasProperty, this.currIndex);
|
|
121
|
+
return new NumberRange_1.NumberRange(delta / minorsPerMajor, delta);
|
|
122
|
+
};
|
|
123
|
+
return DateTimeDeltaCalculator;
|
|
124
|
+
}(DeltaCalculator_1.DeltaCalculator));
|
|
125
|
+
exports.DateTimeDeltaCalculator = DateTimeDeltaCalculator;
|
|
@@ -4,6 +4,8 @@ import { SciChartPieSurface } from "../../SciChartPieSurface/SciChartPieSurface"
|
|
|
4
4
|
import { ILabelOptions, LabelProvider } from "./LabelProvider";
|
|
5
5
|
/**
|
|
6
6
|
* @summary A Label Provider for use with Pie Charts to allow customizing of segment labels
|
|
7
|
+
* To completely customise the label output, override {@link getSegmentText}
|
|
8
|
+
* To just adjust the numeric formatting of the label, use numericformat, precision, prefix, postfix, or override {@link formatLabel}
|
|
7
9
|
*/
|
|
8
10
|
export declare class PieLabelProvider extends LabelProvider {
|
|
9
11
|
readonly type = ELabelProviderType.Pie;
|
|
@@ -11,10 +13,13 @@ export declare class PieLabelProvider extends LabelProvider {
|
|
|
11
13
|
* The parent {@link SciChartPieSurface}. This will be set once {@link attachedToSurface} is called
|
|
12
14
|
*/
|
|
13
15
|
protected parentSurface: SciChartPieSurface;
|
|
16
|
+
constructor(options?: ILabelOptions);
|
|
14
17
|
/**
|
|
15
|
-
*
|
|
18
|
+
* Get the text to be used as the segmet label. This picks the raw value, or percentage depending on the chart's valueMode
|
|
19
|
+
* then formats it using the {@link formatLabel} function.
|
|
20
|
+
* @param segment The PieSegment to get a label for
|
|
21
|
+
* @param total Total of all pieSegment values
|
|
16
22
|
*/
|
|
17
|
-
constructor(options?: ILabelOptions);
|
|
18
23
|
getSegmentText(segment: IPieSegment, total: number): string;
|
|
19
24
|
/**
|
|
20
25
|
* Called when the {@link LabelProvider} is attached to an {@link SciChartPieSurface }
|
|
@@ -34,22 +34,27 @@ var SciChartPieSurface_1 = require("../../SciChartPieSurface/SciChartPieSurface"
|
|
|
34
34
|
var LabelProvider_1 = require("./LabelProvider");
|
|
35
35
|
/**
|
|
36
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}
|
|
37
39
|
*/
|
|
38
40
|
var PieLabelProvider = /** @class */ (function (_super) {
|
|
39
41
|
__extends(PieLabelProvider, _super);
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
42
|
function PieLabelProvider(options) {
|
|
44
43
|
var _a, _b;
|
|
45
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;
|
|
46
45
|
_this.type = LabelProviderType_1.ELabelProviderType.Pie;
|
|
47
46
|
_this.formatLabelProperty = function (dataValue) {
|
|
48
47
|
return _this.applyFormat((0, number_1.formatNumber)(dataValue, _this.numericFormat, _this.precision)) +
|
|
49
|
-
(_this.parentSurface.valueMode === SciChartPieSurface_1.EPieValueMode.Percentage ? "%" : "");
|
|
48
|
+
(_this.parentSurface.valueMode === SciChartPieSurface_1.EPieValueMode.Percentage ? " %" : "");
|
|
50
49
|
};
|
|
51
50
|
return _this;
|
|
52
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
|
+
*/
|
|
53
58
|
PieLabelProvider.prototype.getSegmentText = function (segment, total) {
|
|
54
59
|
var labelValue = this.parentSurface.valueMode === SciChartPieSurface_1.EPieValueMode.Percentage ? segment.getPercentage(total) : segment.value;
|
|
55
60
|
return this.formatLabel(labelValue);
|
|
@@ -35,6 +35,8 @@ var LabelCache_1 = require("./LabelCache");
|
|
|
35
35
|
var LabelProviderBase2D_1 = require("./LabelProviderBase2D");
|
|
36
36
|
var ETradeChartLabelFormat;
|
|
37
37
|
(function (ETradeChartLabelFormat) {
|
|
38
|
+
// Apr 25 ... 04:01:45 ... 02:02:30
|
|
39
|
+
ETradeChartLabelFormat["Seconds"] = "Seconds";
|
|
38
40
|
// Apr 25 ... 01:34 ... 02:24
|
|
39
41
|
ETradeChartLabelFormat["Minutes"] = "Minutes";
|
|
40
42
|
// Apr ... 08 ... 13
|
|
@@ -42,6 +44,7 @@ var ETradeChartLabelFormat;
|
|
|
42
44
|
// 2020 ... Jan ... Feb
|
|
43
45
|
ETradeChartLabelFormat["Months"] = "Months";
|
|
44
46
|
})(ETradeChartLabelFormat || (ETradeChartLabelFormat = {}));
|
|
47
|
+
var ONE_HOUR = 60 * 60;
|
|
45
48
|
var FIVE_DAYS = 60 * 60 * 24 * 5;
|
|
46
49
|
var FIFTY_DAYS = 60 * 60 * 24 * 50;
|
|
47
50
|
/**
|
|
@@ -122,7 +125,10 @@ var SmartDateLabelProvider = /** @class */ (function (_super) {
|
|
|
122
125
|
configurable: true
|
|
123
126
|
});
|
|
124
127
|
SmartDateLabelProvider.prototype.getTradeChartLabelFormat = function (timeRange, ticksNumber) {
|
|
125
|
-
if (timeRange <=
|
|
128
|
+
if (timeRange <= ONE_HOUR) {
|
|
129
|
+
return ETradeChartLabelFormat.Seconds;
|
|
130
|
+
}
|
|
131
|
+
else if (timeRange <= FIVE_DAYS) {
|
|
126
132
|
return ETradeChartLabelFormat.Minutes;
|
|
127
133
|
}
|
|
128
134
|
else if (timeRange <= FIFTY_DAYS) {
|
|
@@ -133,7 +139,17 @@ var SmartDateLabelProvider = /** @class */ (function (_super) {
|
|
|
133
139
|
}
|
|
134
140
|
};
|
|
135
141
|
SmartDateLabelProvider.prototype.formatTradeChartLabel = function (tradeChartLabelFormat, value, prevValue, prevPrevValue) {
|
|
136
|
-
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) {
|
|
137
153
|
var newDate = prevValue === undefined ||
|
|
138
154
|
(0, date_1.formatUnixDateToHumanStringMMMDD)(value) !== (0, date_1.formatUnixDateToHumanStringMMMDD)(prevValue);
|
|
139
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;
|