scichart 2.1.2294 → 2.2.2378
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/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 +3 -2
- package/Charting/Model/BaseHeatmapDataSeries.js +17 -5
- 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 +7 -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/DrawingProviders/UniformHeatmapDrawingProvider.js +1 -1
- 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/UniformHeatmapRenderableSeries.d.ts +13 -0
- package/Charting/Visuals/RenderableSeries/UniformHeatmapRenderableSeries.js +23 -3
- package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.d.ts +5 -0
- package/Charting/Visuals/RenderableSeries/XyScatterRenderableSeries.js +21 -1
- package/Charting/Visuals/RenderableSeries/constants.d.ts +8 -0
- package/Charting/Visuals/RenderableSeries/constants.js +8 -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 +83 -8
- 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/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 +106 -0
- package/Core/storage/localStorageApi.d.ts +4 -0
- package/Core/storage/localStorageApi.js +12 -0
- package/_wasm/scichart.browser.js +1 -1
- package/_wasm/scichart2d.js +95 -95
- package/_wasm/scichart2d.wasm +0 -0
- package/_wasm/scichart3d.js +14 -14
- 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
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
14
|
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
15
|
if (ar || !(i in from)) {
|
|
@@ -9,22 +20,26 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
9
20
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
21
|
};
|
|
11
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.addEventListenerToPieSegment = exports.SciChartPieSurface = exports.EPieType = exports.ESizingMode = void 0;
|
|
23
|
+
exports.addEventListenerToPieSegment = exports.SciChartPieSurface = exports.EPieValueMode = exports.EPieType = exports.ESizingMode = void 0;
|
|
13
24
|
var chartBuilder_1 = require("../../../Builder/chartBuilder");
|
|
25
|
+
var classFactory_1 = require("../../../Builder/classFactory");
|
|
14
26
|
var createMaster3d_1 = require("../../../Charting3D/Visuals/createMaster3d");
|
|
15
27
|
var app_1 = require("../../../constants/app");
|
|
28
|
+
var EasingFunctions_1 = require("../../../Core/Animations/EasingFunctions");
|
|
16
29
|
var Deleter_1 = require("../../../Core/Deleter");
|
|
17
30
|
var ObservableArray_1 = require("../../../Core/ObservableArray");
|
|
18
31
|
var Rect_1 = require("../../../Core/Rect");
|
|
32
|
+
var BaseType_1 = require("../../../types/BaseType");
|
|
19
33
|
var SciChartSurfaceType_1 = require("../../../types/SciChartSurfaceType");
|
|
20
34
|
var SciChartJSDarkTheme_1 = require("../../Themes/SciChartJSDarkTheme");
|
|
35
|
+
var PieLabelProvider_1 = require("../Axis/LabelProvider/PieLabelProvider");
|
|
21
36
|
var createMaster_1 = require("../createMaster");
|
|
22
37
|
var createSingle_1 = require("../createSingle");
|
|
23
38
|
var SciChartPieLegend_1 = require("../Legend/SciChartPieLegend");
|
|
24
39
|
var sciChartInitCommon_1 = require("../sciChartInitCommon");
|
|
25
40
|
var SciChartSurfaceBase_1 = require("../SciChartSurfaceBase");
|
|
26
41
|
var constants_1 = require("./constants");
|
|
27
|
-
var
|
|
42
|
+
var constants_2 = require("./PieSegment/constants");
|
|
28
43
|
/** @ignore */
|
|
29
44
|
var DEG_TO_RAD = Math.PI / 180;
|
|
30
45
|
/** @ignore */
|
|
@@ -45,6 +60,11 @@ var EPieType;
|
|
|
45
60
|
EPieType["Pie"] = "Pie";
|
|
46
61
|
EPieType["Donut"] = "Donut";
|
|
47
62
|
})(EPieType = exports.EPieType || (exports.EPieType = {}));
|
|
63
|
+
var EPieValueMode;
|
|
64
|
+
(function (EPieValueMode) {
|
|
65
|
+
EPieValueMode[EPieValueMode["Percentage"] = 0] = "Percentage";
|
|
66
|
+
EPieValueMode[EPieValueMode["Raw"] = 1] = "Raw";
|
|
67
|
+
})(EPieValueMode = exports.EPieValueMode || (exports.EPieValueMode = {}));
|
|
48
68
|
/**
|
|
49
69
|
* @summary The {@link SciChartPieSurface} is the root Pie and Donut Chart control in SciChart's High Performance Real-time
|
|
50
70
|
* {@link https://www.scichart.com/javascript-chart-features | JavaScript Chart Library}
|
|
@@ -64,24 +84,36 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
64
84
|
function SciChartPieSurface(canvases, options) {
|
|
65
85
|
var _this = this;
|
|
66
86
|
if (canvases === void 0) { canvases = {}; }
|
|
67
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
87
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
68
88
|
this.animate = true;
|
|
89
|
+
/* The number of frames for the animation. Default 30. A frame will be trigged every 20ms. */
|
|
90
|
+
this.animationFrames = 30;
|
|
69
91
|
this.pieTypeProperty = EPieType.Pie;
|
|
70
92
|
this.holeRadiusProperty = 0.5;
|
|
71
93
|
this.holeRadiusSizingModeProperty = ESizingMode.Relative;
|
|
72
94
|
this.seriesSpacingProperty = 0;
|
|
95
|
+
this.labelRadiusProperty = 1;
|
|
73
96
|
this.titleDivs = [];
|
|
74
97
|
this.sweepAnimationDone = false;
|
|
75
98
|
this.suspendUpdate = false;
|
|
76
99
|
this.themeProviderProperty = new SciChartJSDarkTheme_1.SciChartJSDarkTheme();
|
|
77
100
|
this.previousThemeProviderProperty = new SciChartJSDarkTheme_1.SciChartJSDarkTheme();
|
|
78
101
|
this.deletables = [];
|
|
102
|
+
this.valueModeProperty = EPieValueMode.Percentage;
|
|
103
|
+
this.labelStyleProperty = {
|
|
104
|
+
fontSize: 14,
|
|
105
|
+
fontFamily: "Arial",
|
|
106
|
+
color: "#1e323d",
|
|
107
|
+
fontWeight: "bold"
|
|
108
|
+
};
|
|
79
109
|
this.domChartRoot = canvases.domChartRoot;
|
|
80
110
|
this.domCanvas2D = canvases.domCanvas2D;
|
|
81
111
|
this.domSvgContainer = canvases.domSvgContainer;
|
|
82
112
|
this.domSvgAdornerLayer = canvases.domSvgAdornerLayer;
|
|
83
113
|
this.domDivContainer = canvases.domDivContainer;
|
|
84
|
-
|
|
114
|
+
var width = this.domCanvas2D.width;
|
|
115
|
+
var height = this.domCanvas2D.height;
|
|
116
|
+
this.viewRect = new Rect_1.Rect(0, 0, width, height);
|
|
85
117
|
this.drawChart = this.drawChart.bind(this);
|
|
86
118
|
this.delete = this.delete.bind(this);
|
|
87
119
|
this.invalidateElement = this.invalidateElement.bind(this);
|
|
@@ -92,6 +124,8 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
92
124
|
var _a, _b;
|
|
93
125
|
(_a = args.getOldItems()) === null || _a === void 0 ? void 0 : _a.forEach(_this.detachPieSegment);
|
|
94
126
|
(_b = args.getNewItems()) === null || _b === void 0 ? void 0 : _b.forEach(_this.attachPieSegment);
|
|
127
|
+
// Do this only after all changes have been processed
|
|
128
|
+
_this.invalidateElement();
|
|
95
129
|
});
|
|
96
130
|
this.applySciChartBackground(SciChartSurfaceBase_1.SciChartSurfaceBase.DEFAULT_THEME.sciChartBackground);
|
|
97
131
|
this.legend = new SciChartPieLegend_1.SciChartPieLegend();
|
|
@@ -105,11 +139,19 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
105
139
|
this.holeRadiusProperty = (_d = options === null || options === void 0 ? void 0 : options.holeRadius) !== null && _d !== void 0 ? _d : this.holeRadius;
|
|
106
140
|
this.animate = (_e = options === null || options === void 0 ? void 0 : options.animate) !== null && _e !== void 0 ? _e : this.animate;
|
|
107
141
|
this.holeRadiusSizingModeProperty = (_f = options === null || options === void 0 ? void 0 : options.holeRadiusSizingMode) !== null && _f !== void 0 ? _f : this.holeRadiusSizingModeProperty;
|
|
108
|
-
|
|
109
|
-
this.legend.showLegend = (
|
|
110
|
-
this.legend.animate = (
|
|
111
|
-
this.legend.showCheckboxes = (
|
|
112
|
-
this.legend.showSeriesMarkers = (
|
|
142
|
+
this.seriesSpacingProperty = (_g = options === null || options === void 0 ? void 0 : options.seriesSpacing) !== null && _g !== void 0 ? _g : this.seriesSpacingProperty;
|
|
143
|
+
this.legend.showLegend = (_h = options === null || options === void 0 ? void 0 : options.showLegend) !== null && _h !== void 0 ? _h : this.legend.showLegend;
|
|
144
|
+
this.legend.animate = (_j = options === null || options === void 0 ? void 0 : options.animateLegend) !== null && _j !== void 0 ? _j : this.legend.animate;
|
|
145
|
+
this.legend.showCheckboxes = (_k = options === null || options === void 0 ? void 0 : options.showLegendCheckBoxes) !== null && _k !== void 0 ? _k : this.legend.showCheckboxes;
|
|
146
|
+
this.legend.showSeriesMarkers = (_l = options === null || options === void 0 ? void 0 : options.showLegendSeriesMarkers) !== null && _l !== void 0 ? _l : this.legend.showSeriesMarkers;
|
|
147
|
+
this.paddingProperty = (_m = options === null || options === void 0 ? void 0 : options.padding) !== null && _m !== void 0 ? _m : this.paddingProperty;
|
|
148
|
+
if (options === null || options === void 0 ? void 0 : options.labelProvider) {
|
|
149
|
+
if (!("getSegmentText" in (options === null || options === void 0 ? void 0 : options.labelProvider))) {
|
|
150
|
+
options.labelProvider = (0, classFactory_1.createType)(BaseType_1.EBaseType.LabelProvider, options.labelProvider.type, undefined, options.labelProvider.options);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
this.labelProvider = (_o = options === null || options === void 0 ? void 0 : options.labelProvider) !== null && _o !== void 0 ? _o : new PieLabelProvider_1.PieLabelProvider();
|
|
154
|
+
this.valueModeProperty = (_p = options === null || options === void 0 ? void 0 : options.valueMode) !== null && _p !== void 0 ? _p : this.valueModeProperty;
|
|
113
155
|
}
|
|
114
156
|
/**
|
|
115
157
|
* Creates a {@link SciChartPieSurface} to occupy the div by element ID in your DOM.
|
|
@@ -134,6 +176,42 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
134
176
|
setTimeout(function () { return resolve(scps); }, 0);
|
|
135
177
|
});
|
|
136
178
|
};
|
|
179
|
+
Object.defineProperty(SciChartPieSurface.prototype, "labelProvider", {
|
|
180
|
+
/**
|
|
181
|
+
* Gets or sets a {@link LabelProvider} - a class which is responsible for formatting axis labels and cursor labels from numeric values
|
|
182
|
+
*/
|
|
183
|
+
get: function () {
|
|
184
|
+
return this.labelProviderProperty;
|
|
185
|
+
},
|
|
186
|
+
/**
|
|
187
|
+
* Gets or sets a {@link LabelProvider} - a class which is responsible for formatting axis labels and cursor labels from numeric values
|
|
188
|
+
*/
|
|
189
|
+
set: function (labelProvider) {
|
|
190
|
+
if (labelProvider && this.labelProviderProperty !== labelProvider) {
|
|
191
|
+
this.labelProviderProperty = labelProvider;
|
|
192
|
+
this.notifyPropertyChanged(constants_1.PROPERTY.LABEL_PROVIDER);
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
enumerable: false,
|
|
196
|
+
configurable: true
|
|
197
|
+
});
|
|
198
|
+
Object.defineProperty(SciChartPieSurface.prototype, "labelStyle", {
|
|
199
|
+
/**
|
|
200
|
+
* Gets or sets a {@link TTextStyle} object for styling labels
|
|
201
|
+
*/
|
|
202
|
+
get: function () {
|
|
203
|
+
return this.labelStyleProperty;
|
|
204
|
+
},
|
|
205
|
+
/**
|
|
206
|
+
* Gets or sets a {@link TTextStyle} object for styling labels
|
|
207
|
+
*/
|
|
208
|
+
set: function (textStyle) {
|
|
209
|
+
this.labelStyleProperty = __assign(__assign({}, this.labelStyle), textStyle);
|
|
210
|
+
this.notifyPropertyChanged(constants_1.PROPERTY.TEXT_STYLE);
|
|
211
|
+
},
|
|
212
|
+
enumerable: false,
|
|
213
|
+
configurable: true
|
|
214
|
+
});
|
|
137
215
|
/**
|
|
138
216
|
* @inheritDoc
|
|
139
217
|
*/
|
|
@@ -141,6 +219,9 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
141
219
|
this.previousThemeProviderProperty = this.themeProviderProperty;
|
|
142
220
|
this.themeProviderProperty = themeProvider;
|
|
143
221
|
this.applySciChartBackground(themeProvider.sciChartBackground);
|
|
222
|
+
if (this.labelStyle.color === this.previousThemeProvider.tickTextBrush) {
|
|
223
|
+
this.labelStyle = { color: themeProvider.tickTextBrush };
|
|
224
|
+
}
|
|
144
225
|
this.invalidateElement();
|
|
145
226
|
};
|
|
146
227
|
Object.defineProperty(SciChartPieSurface.prototype, "themeProvider", {
|
|
@@ -167,8 +248,11 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
167
248
|
* Call invalidateElement() to trigger a redraw of the {@link SciChartPieSurface}. SciChart's rendering
|
|
168
249
|
* engine will schedule a redraw a the next time the renderer is free.
|
|
169
250
|
*/
|
|
170
|
-
SciChartPieSurface.prototype.invalidateElement = function () {
|
|
251
|
+
SciChartPieSurface.prototype.invalidateElement = function (propertyName) {
|
|
171
252
|
if (this.isValidToDraw()) {
|
|
253
|
+
if (propertyName === constants_2.PROPERTY.VALUE) {
|
|
254
|
+
this.sweepAnimationDone = false;
|
|
255
|
+
}
|
|
172
256
|
this.update();
|
|
173
257
|
}
|
|
174
258
|
};
|
|
@@ -185,16 +269,18 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
185
269
|
/**
|
|
186
270
|
* @inheritDoc
|
|
187
271
|
*/
|
|
188
|
-
SciChartPieSurface.prototype.delete = function () {
|
|
272
|
+
SciChartPieSurface.prototype.delete = function (isAnimationProgress) {
|
|
189
273
|
var _this = this;
|
|
190
274
|
if (this.svg) {
|
|
191
275
|
this.domSvgContainer.removeChild(this.svg);
|
|
192
276
|
this.svg = undefined;
|
|
193
277
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
278
|
+
if (!isAnimationProgress) {
|
|
279
|
+
this.titleDivs.forEach(function (divEl) {
|
|
280
|
+
_this.domDivContainer.removeChild(divEl);
|
|
281
|
+
});
|
|
282
|
+
this.titleDivs = [];
|
|
283
|
+
}
|
|
198
284
|
for (var _i = 0, _a = this.deletables; _i < _a.length; _i++) {
|
|
199
285
|
var deletable = _a[_i];
|
|
200
286
|
(0, Deleter_1.deleteSafe)(deletable);
|
|
@@ -211,8 +297,10 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
211
297
|
* @inheritDoc
|
|
212
298
|
*/
|
|
213
299
|
SciChartPieSurface.prototype.changeViewportSize = function (width, height) {
|
|
300
|
+
var domWidth = width;
|
|
301
|
+
var domHeight = height;
|
|
214
302
|
this.viewRect = new Rect_1.Rect(0, 0, width, height);
|
|
215
|
-
this.changeDomViewportSize(
|
|
303
|
+
this.changeDomViewportSize(domWidth, domHeight);
|
|
216
304
|
this.invalidateElement();
|
|
217
305
|
};
|
|
218
306
|
Object.defineProperty(SciChartPieSurface.prototype, "pieType", {
|
|
@@ -279,6 +367,92 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
279
367
|
enumerable: false,
|
|
280
368
|
configurable: true
|
|
281
369
|
});
|
|
370
|
+
Object.defineProperty(SciChartPieSurface.prototype, "padding", {
|
|
371
|
+
/**
|
|
372
|
+
* Gets or sets padding
|
|
373
|
+
*/
|
|
374
|
+
get: function () {
|
|
375
|
+
return this.paddingProperty;
|
|
376
|
+
},
|
|
377
|
+
/**
|
|
378
|
+
* Gets or sets padding
|
|
379
|
+
*/
|
|
380
|
+
set: function (value) {
|
|
381
|
+
if (this.paddingProperty !== value) {
|
|
382
|
+
this.paddingProperty = value;
|
|
383
|
+
this.updateLegendMargin();
|
|
384
|
+
this.notifyPropertyChanged(constants_1.PROPERTY.PADDING);
|
|
385
|
+
}
|
|
386
|
+
},
|
|
387
|
+
enumerable: false,
|
|
388
|
+
configurable: true
|
|
389
|
+
});
|
|
390
|
+
Object.defineProperty(SciChartPieSurface.prototype, "canvasBorder", {
|
|
391
|
+
/**
|
|
392
|
+
* Gets or sets canvas border
|
|
393
|
+
*/
|
|
394
|
+
get: function () {
|
|
395
|
+
return this.canvasBorderProperty;
|
|
396
|
+
},
|
|
397
|
+
/**
|
|
398
|
+
* Gets or sets canvas border
|
|
399
|
+
*/
|
|
400
|
+
set: function (value) {
|
|
401
|
+
if (this.canvasBorderProperty !== value) {
|
|
402
|
+
this.canvasBorderProperty = value;
|
|
403
|
+
this.updateLegendMargin();
|
|
404
|
+
this.notifyPropertyChanged(constants_1.PROPERTY.PADDING);
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
enumerable: false,
|
|
408
|
+
configurable: true
|
|
409
|
+
});
|
|
410
|
+
Object.defineProperty(SciChartPieSurface.prototype, "seriesSpacing", {
|
|
411
|
+
get: function () {
|
|
412
|
+
return this.seriesSpacingProperty;
|
|
413
|
+
},
|
|
414
|
+
set: function (value) {
|
|
415
|
+
if (this.seriesSpacingProperty !== value) {
|
|
416
|
+
this.seriesSpacingProperty = value;
|
|
417
|
+
this.notifyPropertyChanged(constants_1.PROPERTY.SERIES_SPACING);
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
enumerable: false,
|
|
421
|
+
configurable: true
|
|
422
|
+
});
|
|
423
|
+
Object.defineProperty(SciChartPieSurface.prototype, "valueMode", {
|
|
424
|
+
/** Whether to show labels as percentages, or raw values. Default to percentages */
|
|
425
|
+
get: function () {
|
|
426
|
+
return this.valueModeProperty;
|
|
427
|
+
},
|
|
428
|
+
/** Whether to show labels as percentages, or raw values. Default to percentages */
|
|
429
|
+
set: function (value) {
|
|
430
|
+
this.valueModeProperty = value;
|
|
431
|
+
this.notifyPropertyChanged(constants_1.PROPERTY.VALUE_MODE);
|
|
432
|
+
},
|
|
433
|
+
enumerable: false,
|
|
434
|
+
configurable: true
|
|
435
|
+
});
|
|
436
|
+
Object.defineProperty(SciChartPieSurface.prototype, "labelRadiusAdjustment", {
|
|
437
|
+
/**
|
|
438
|
+
* Use this to adjust the position of the labels. 1 is the default. Larger values will shift the labels outwards.
|
|
439
|
+
* For Pie charts, 1.7 will place the labels outside the pie
|
|
440
|
+
* If you want more detailed control you can override calcTitlePosition.
|
|
441
|
+
*/
|
|
442
|
+
get: function () {
|
|
443
|
+
return this.labelRadiusProperty;
|
|
444
|
+
},
|
|
445
|
+
/**
|
|
446
|
+
* Use this to adjust the position of the labels. 1 is the default. Larger values will shift the labels outwards.
|
|
447
|
+
* If you want more detailed control you can override calcTitlePosition.
|
|
448
|
+
*/
|
|
449
|
+
set: function (value) {
|
|
450
|
+
this.labelRadiusProperty = value;
|
|
451
|
+
this.notifyPropertyChanged(constants_1.PROPERTY.VALUE_MODE);
|
|
452
|
+
},
|
|
453
|
+
enumerable: false,
|
|
454
|
+
configurable: true
|
|
455
|
+
});
|
|
282
456
|
/**
|
|
283
457
|
* Convert the surface to a {@link TSurfaceDefinition}
|
|
284
458
|
* @param excludedata If false, segments will be included in the json
|
|
@@ -304,6 +478,14 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
304
478
|
showLegend: this.legend.showLegend,
|
|
305
479
|
showLegendCheckBoxes: this.legend.showCheckboxes,
|
|
306
480
|
showLegendSeriesMarkers: this.legend.showSeriesMarkers,
|
|
481
|
+
padding: this.padding,
|
|
482
|
+
canvasBorder: this.canvasBorder,
|
|
483
|
+
seriesSpacing: this.seriesSpacing,
|
|
484
|
+
// @ts-ignore
|
|
485
|
+
labelProvider: this.labelProvider.toJSON(),
|
|
486
|
+
valueMode: this.valueMode,
|
|
487
|
+
labelRadiusAdjustment: this.labelRadiusAdjustment,
|
|
488
|
+
animationFrames: this.animationFrames,
|
|
307
489
|
theme: theme
|
|
308
490
|
};
|
|
309
491
|
var options = { surface: surface, onCreated: this.onCreatedName };
|
|
@@ -312,14 +494,14 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
312
494
|
}
|
|
313
495
|
return { type: SciChartSurfaceType_1.ESciChartSurfaceType.Pie2D, options: options };
|
|
314
496
|
};
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
497
|
+
/** The method used to calculate the label position for each segment */
|
|
498
|
+
SciChartPieSurface.prototype.calcTitlePosition = function (x, y, outerRadius, innerRadius, a1, a2, delta, divWidth, divHeight) {
|
|
499
|
+
var centerRadius = innerRadius < outerRadius / 2 ? (outerRadius * 2) / 3 + innerRadius / 6 : (outerRadius + innerRadius) / 2;
|
|
500
|
+
var centerAngle = (a1 + a2) / 2;
|
|
501
|
+
var left = x + Math.cos(DEG_TO_RAD * centerAngle) * (centerRadius * this.labelRadiusProperty + delta) - divWidth / 2;
|
|
502
|
+
var top = y + Math.sin(DEG_TO_RAD * centerAngle) * (centerRadius * this.labelRadiusProperty + delta) - divHeight / 2;
|
|
503
|
+
return { left: left, top: top };
|
|
504
|
+
};
|
|
323
505
|
/**
|
|
324
506
|
* Changes the size of the DOM element where the {@link SciChartSurfaceBase} resides.
|
|
325
507
|
* @param width
|
|
@@ -348,6 +530,9 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
348
530
|
// PRIVATE
|
|
349
531
|
SciChartPieSurface.prototype.notifyPropertyChanged = function (propertyName) {
|
|
350
532
|
this.invalidateElement();
|
|
533
|
+
if (propertyName === constants_1.PROPERTY.LABEL_PROVIDER && this.labelProviderProperty) {
|
|
534
|
+
this.labelProviderProperty.attachedToSurface(this);
|
|
535
|
+
}
|
|
351
536
|
};
|
|
352
537
|
SciChartPieSurface.prototype.isValidToDraw = function () {
|
|
353
538
|
// TODO
|
|
@@ -355,20 +540,70 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
355
540
|
};
|
|
356
541
|
SciChartPieSurface.prototype.detachPieSegment = function (pieSegment) {
|
|
357
542
|
pieSegment.onDetach();
|
|
358
|
-
this.invalidateElement();
|
|
359
543
|
};
|
|
360
544
|
SciChartPieSurface.prototype.attachPieSegment = function (pieSegment) {
|
|
361
545
|
pieSegment.onAttach(this);
|
|
362
|
-
|
|
546
|
+
};
|
|
547
|
+
SciChartPieSurface.prototype.updateLegendMargin = function () {
|
|
548
|
+
var _a, _b, _c;
|
|
549
|
+
var paddingTop = ((_a = this.padding) === null || _a === void 0 ? void 0 : _a.top) || 0;
|
|
550
|
+
var canvasBorderTop = ((_b = this.canvasBorder) === null || _b === void 0 ? void 0 : _b.border) || ((_c = this.canvasBorder) === null || _c === void 0 ? void 0 : _c.borderTop) || 0;
|
|
551
|
+
// 10 - because of default spacing
|
|
552
|
+
// only top included because of margin implementation for the legend
|
|
553
|
+
this.legend.margin = paddingTop + canvasBorderTop + 10;
|
|
554
|
+
};
|
|
555
|
+
SciChartPieSurface.prototype.calculateViewRectWidth = function (width) {
|
|
556
|
+
var _a, _b, _c, _d, _e;
|
|
557
|
+
if ((_a = this.padding) === null || _a === void 0 ? void 0 : _a.left) {
|
|
558
|
+
width -= this.padding.left;
|
|
559
|
+
}
|
|
560
|
+
if ((_b = this.padding) === null || _b === void 0 ? void 0 : _b.right) {
|
|
561
|
+
width -= this.padding.right;
|
|
562
|
+
}
|
|
563
|
+
if ((_c = this.canvasBorder) === null || _c === void 0 ? void 0 : _c.border) {
|
|
564
|
+
width -= this.canvasBorder.border * 2;
|
|
565
|
+
}
|
|
566
|
+
else {
|
|
567
|
+
if ((_d = this.canvasBorder) === null || _d === void 0 ? void 0 : _d.borderLeft) {
|
|
568
|
+
width -= this.canvasBorder.borderLeft;
|
|
569
|
+
}
|
|
570
|
+
if ((_e = this.canvasBorder) === null || _e === void 0 ? void 0 : _e.borderRight) {
|
|
571
|
+
width -= this.canvasBorder.borderRight;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
return width;
|
|
575
|
+
};
|
|
576
|
+
SciChartPieSurface.prototype.calculateViewRectHeight = function (height) {
|
|
577
|
+
var _a, _b, _c, _d, _e;
|
|
578
|
+
if ((_a = this.padding) === null || _a === void 0 ? void 0 : _a.top) {
|
|
579
|
+
height -= this.padding.top;
|
|
580
|
+
}
|
|
581
|
+
if ((_b = this.padding) === null || _b === void 0 ? void 0 : _b.bottom) {
|
|
582
|
+
height -= this.padding.bottom;
|
|
583
|
+
}
|
|
584
|
+
if ((_c = this.canvasBorder) === null || _c === void 0 ? void 0 : _c.border) {
|
|
585
|
+
height -= this.canvasBorder.border * 2;
|
|
586
|
+
}
|
|
587
|
+
else {
|
|
588
|
+
if ((_d = this.canvasBorder) === null || _d === void 0 ? void 0 : _d.borderTop) {
|
|
589
|
+
height -= this.canvasBorder.borderTop;
|
|
590
|
+
}
|
|
591
|
+
if ((_e = this.canvasBorder) === null || _e === void 0 ? void 0 : _e.borderBottom) {
|
|
592
|
+
height -= this.canvasBorder.borderBottom;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
return height;
|
|
363
596
|
};
|
|
364
597
|
SciChartPieSurface.prototype.draw = function () {
|
|
365
598
|
var _this = this;
|
|
599
|
+
if (this.pieSegments.size() === 0)
|
|
600
|
+
return;
|
|
366
601
|
if (this.sweepAnimationDone || !this.animate) {
|
|
367
602
|
this.delete();
|
|
368
603
|
this.drawChart();
|
|
369
604
|
}
|
|
370
605
|
else {
|
|
371
|
-
var frames_1 =
|
|
606
|
+
var frames_1 = this.animationFrames;
|
|
372
607
|
this.suspendUpdate = true;
|
|
373
608
|
var setSuspendUpdateFalse_1 = function () { return (_this.suspendUpdate = false); };
|
|
374
609
|
var setSweepAnimationDone_1 = function () { return (_this.sweepAnimationDone = true); };
|
|
@@ -378,7 +613,7 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
378
613
|
(function myLoop(k) {
|
|
379
614
|
setTimeout(function () {
|
|
380
615
|
var animationProgress = k / frames_1;
|
|
381
|
-
callDelete_1();
|
|
616
|
+
callDelete_1(true);
|
|
382
617
|
callDrawChart_1(animationProgress);
|
|
383
618
|
if (k === frames_1) {
|
|
384
619
|
setSuspendUpdateFalse_1();
|
|
@@ -400,7 +635,6 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
400
635
|
}
|
|
401
636
|
});
|
|
402
637
|
}
|
|
403
|
-
this.drawSegmentTitles();
|
|
404
638
|
};
|
|
405
639
|
/**
|
|
406
640
|
* @description Draws pie chart itself
|
|
@@ -413,20 +647,33 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
413
647
|
var strokeColor = this.themeProviderProperty.sciChartBackground;
|
|
414
648
|
var segments = this.pieSegments.asArray();
|
|
415
649
|
var totalValue = this.pieSegmentsTotalValue();
|
|
416
|
-
var
|
|
650
|
+
var totalOldValue = this.pieSegmentsTotalOldValue();
|
|
651
|
+
var outerRadius = (Math.min(this.calculateViewRectWidth(this.viewRect.width), this.calculateViewRectHeight(this.viewRect.height)) *
|
|
652
|
+
0.8) /
|
|
653
|
+
2;
|
|
417
654
|
var innerRadius = 0;
|
|
418
655
|
if (this.pieType === EPieType.Donut) {
|
|
419
656
|
innerRadius =
|
|
420
657
|
this.holeRadiusSizingMode === ESizingMode.Absolute ? this.holeRadius : outerRadius * this.holeRadius;
|
|
421
658
|
}
|
|
422
|
-
var xCoord = this.viewRect.width / 2;
|
|
423
|
-
var yCoord = this.viewRect.height / 2;
|
|
659
|
+
var xCoord = this.calculateViewRectWidth(this.viewRect.width) / 2;
|
|
660
|
+
var yCoord = this.calculateViewRectHeight(this.viewRect.height) / 2;
|
|
424
661
|
// CREATING SVG STRING
|
|
425
662
|
var gradientsBlock = "<defs>";
|
|
426
663
|
var pathsBlock = "";
|
|
427
664
|
var currentValue = 0;
|
|
428
|
-
|
|
429
|
-
|
|
665
|
+
var currentOldValue = 0;
|
|
666
|
+
segments.forEach(function (el, index) {
|
|
667
|
+
var _a;
|
|
668
|
+
var oldValue = (_a = el.oldValue) !== null && _a !== void 0 ? _a : 0;
|
|
669
|
+
var newFrom = (360 * currentValue) / totalValue - START_ANGLE;
|
|
670
|
+
var newTo = (360 * (currentValue + el.value)) / totalValue - START_ANGLE;
|
|
671
|
+
var oldFrom = (360 * currentOldValue) / totalOldValue - START_ANGLE;
|
|
672
|
+
var oldTo = (360 * (currentOldValue + oldValue)) / totalOldValue - START_ANGLE;
|
|
673
|
+
currentValue += el.value;
|
|
674
|
+
currentOldValue += oldValue;
|
|
675
|
+
var angleFrom = oldFrom + (newFrom - oldFrom) * EasingFunctions_1.easing.inOutCubic(animationProgress);
|
|
676
|
+
var angleTo = oldTo + (newTo - oldTo) * EasingFunctions_1.easing.inOutCubic(animationProgress);
|
|
430
677
|
var hasGradient = !!el.colorLinearGradient;
|
|
431
678
|
var gradientId = "grad".concat(el.id);
|
|
432
679
|
if (hasGradient) {
|
|
@@ -442,62 +689,116 @@ var SciChartPieSurface = /** @class */ (function () {
|
|
|
442
689
|
gradientBlock_1 += "</linearGradient>";
|
|
443
690
|
gradientsBlock += gradientBlock_1;
|
|
444
691
|
}
|
|
445
|
-
var angleFrom = (360 * currentValue) / totalValue - START_ANGLE;
|
|
446
|
-
var angleTo = (360 * (currentValue + newValue)) / totalValue - START_ANGLE;
|
|
447
692
|
var dAttribute = _this.pieType === EPieType.Donut
|
|
448
|
-
? getDonutSectorPath(xCoord, yCoord, outerRadius, innerRadius, angleFrom, angleTo, el.
|
|
449
|
-
: getSectorPath(xCoord, yCoord, outerRadius, angleFrom, angleTo, el.
|
|
693
|
+
? getDonutSectorPath(xCoord, yCoord, outerRadius * el.radiusAdjustment, innerRadius, angleFrom, angleTo, el.shift + _this.seriesSpacing)
|
|
694
|
+
: getSectorPath(xCoord, yCoord, outerRadius * el.radiusAdjustment, angleFrom, angleTo, el.shift + _this.seriesSpacing);
|
|
450
695
|
var pathBlock = hasGradient
|
|
451
696
|
? "<g fill=\"url(#".concat(gradientId, ")\"><path id=\"").concat(el.id, "\" stroke=\"").concat(strokeColor, "\" stroke-width=\"").concat(strokeWidth, "\" d=\"").concat(dAttribute, "\" /></g>")
|
|
452
697
|
: "<path id=\"".concat(el.id, "\" stroke=\"").concat(strokeColor, "\" stroke-width=\"").concat(strokeWidth, "\" d=\"").concat(dAttribute, "\" fill=\"").concat(el.color, "\" />");
|
|
453
698
|
pathsBlock += pathBlock;
|
|
454
|
-
|
|
699
|
+
if (animationProgress === 1 || el.oldValue) {
|
|
700
|
+
_this.drawSegmentLabel(el, index, totalValue, angleFrom, angleTo, xCoord, yCoord, outerRadius * el.radiusAdjustment, innerRadius);
|
|
701
|
+
}
|
|
455
702
|
});
|
|
456
703
|
gradientsBlock += "</defs>";
|
|
457
|
-
|
|
704
|
+
this.adjustDomContainer();
|
|
705
|
+
var svgString = "<svg width=\"".concat(this.calculateViewRectWidth(this.viewRect.width), "\" height=\"").concat(this.calculateViewRectHeight(this.viewRect.height), "\">").concat(gradientsBlock).concat(pathsBlock, "</svg>");
|
|
458
706
|
// CREATING AND ATTACHING SVG TO DOM
|
|
459
707
|
var svgNode = document.createRange().createContextualFragment(svgString);
|
|
460
708
|
this.domSvgContainer.appendChild(svgNode);
|
|
461
709
|
this.svg = this.domSvgContainer.lastChild;
|
|
462
710
|
};
|
|
463
|
-
SciChartPieSurface.prototype.
|
|
464
|
-
var
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
if (this.
|
|
472
|
-
|
|
473
|
-
|
|
711
|
+
SciChartPieSurface.prototype.adjustDomContainer = function () {
|
|
712
|
+
var _a, _b, _c, _d, _e, _f;
|
|
713
|
+
if (this.padding && this.padding.left) {
|
|
714
|
+
this.domSvgContainer.style.paddingLeft = this.padding.left + "px";
|
|
715
|
+
}
|
|
716
|
+
if (this.padding && this.padding.right) {
|
|
717
|
+
this.domSvgContainer.style.paddingRight = this.padding.right + "px";
|
|
718
|
+
}
|
|
719
|
+
if (this.padding && this.padding.top) {
|
|
720
|
+
this.domSvgContainer.style.paddingTop = this.padding.top + "px";
|
|
721
|
+
}
|
|
722
|
+
if (this.padding && this.padding.bottom) {
|
|
723
|
+
this.domSvgContainer.style.paddingBottom = this.padding.bottom + "px";
|
|
724
|
+
}
|
|
725
|
+
if (this.canvasBorder) {
|
|
726
|
+
this.domSvgContainer.style.borderStyle = "solid";
|
|
727
|
+
}
|
|
728
|
+
if ((_a = this.canvasBorder) === null || _a === void 0 ? void 0 : _a.border) {
|
|
729
|
+
this.domSvgContainer.style.borderWidth = this.canvasBorder.border + "px";
|
|
730
|
+
}
|
|
731
|
+
if ((_b = this.canvasBorder) === null || _b === void 0 ? void 0 : _b.color) {
|
|
732
|
+
this.domSvgContainer.style.borderColor = this.canvasBorder.color;
|
|
733
|
+
}
|
|
734
|
+
if ((_c = this.canvasBorder) === null || _c === void 0 ? void 0 : _c.borderBottom) {
|
|
735
|
+
this.domSvgContainer.style.borderBottomWidth = this.canvasBorder.borderBottom + "px";
|
|
736
|
+
}
|
|
737
|
+
if ((_d = this.canvasBorder) === null || _d === void 0 ? void 0 : _d.borderTop) {
|
|
738
|
+
this.domSvgContainer.style.borderTopWidth = this.canvasBorder.borderTop + "px";
|
|
474
739
|
}
|
|
475
|
-
this.
|
|
476
|
-
|
|
740
|
+
if ((_e = this.canvasBorder) === null || _e === void 0 ? void 0 : _e.borderLeft) {
|
|
741
|
+
this.domSvgContainer.style.borderLeftWidth = this.canvasBorder.borderLeft + "px";
|
|
742
|
+
}
|
|
743
|
+
if ((_f = this.canvasBorder) === null || _f === void 0 ? void 0 : _f.borderRight) {
|
|
744
|
+
this.domSvgContainer.style.borderRightWidth = this.canvasBorder.borderRight + "px";
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
SciChartPieSurface.prototype.drawSegmentLabel = function (el, index, totalValue, angleFrom, angleTo, xCoord, yCoord, outerRadius, innerRadius) {
|
|
748
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
749
|
+
var labelDivId = "segment" + index;
|
|
750
|
+
var div = this.titleDivs.find(function (d) { return d.id === labelDivId; });
|
|
751
|
+
if (!div) {
|
|
752
|
+
div = document.createElement("div");
|
|
753
|
+
var labelStyle = el.labelStyle;
|
|
754
|
+
div.className = "scichart-pie-text-container";
|
|
755
|
+
div.id = labelDivId;
|
|
477
756
|
div.style.position = "absolute";
|
|
478
757
|
div.style.pointerEvents = "none";
|
|
479
758
|
div.style.padding = "5px";
|
|
480
759
|
div.style.borderRadius = "3px";
|
|
481
|
-
|
|
482
|
-
|
|
760
|
+
this.titleDivs.push(div);
|
|
761
|
+
this.domDivContainer.appendChild(div);
|
|
483
762
|
div.style.display = "block";
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
}
|
|
763
|
+
}
|
|
764
|
+
div.style.color = el.labelStyle.color;
|
|
765
|
+
div.style.fontWeight = el.labelStyle.fontWeight;
|
|
766
|
+
div.style.fontFamily = el.labelStyle.fontFamily;
|
|
767
|
+
div.style.fontSize = el.labelStyle.fontSize.toString() + "px";
|
|
768
|
+
div.innerHTML = el.getLabelText(totalValue);
|
|
769
|
+
var divWidth = div.offsetWidth;
|
|
770
|
+
var divHeight = div.offsetHeight;
|
|
771
|
+
var leftShift = 0;
|
|
772
|
+
var topShift = 0;
|
|
773
|
+
if ((_a = this.padding) === null || _a === void 0 ? void 0 : _a.left) {
|
|
774
|
+
leftShift += (_b = this.padding) === null || _b === void 0 ? void 0 : _b.left;
|
|
775
|
+
}
|
|
776
|
+
if ((_c = this.padding) === null || _c === void 0 ? void 0 : _c.top) {
|
|
777
|
+
topShift += (_d = this.padding) === null || _d === void 0 ? void 0 : _d.top;
|
|
778
|
+
}
|
|
779
|
+
if ((_e = this.canvasBorder) === null || _e === void 0 ? void 0 : _e.border) {
|
|
780
|
+
leftShift += (_f = this.canvasBorder) === null || _f === void 0 ? void 0 : _f.border;
|
|
781
|
+
topShift += (_g = this.canvasBorder) === null || _g === void 0 ? void 0 : _g.border;
|
|
782
|
+
}
|
|
783
|
+
else {
|
|
784
|
+
if ((_h = this.canvasBorder) === null || _h === void 0 ? void 0 : _h.borderLeft) {
|
|
785
|
+
leftShift += (_j = this.canvasBorder) === null || _j === void 0 ? void 0 : _j.borderLeft;
|
|
786
|
+
}
|
|
787
|
+
if ((_k = this.canvasBorder) === null || _k === void 0 ? void 0 : _k.borderTop) {
|
|
788
|
+
leftShift += (_l = this.canvasBorder) === null || _l === void 0 ? void 0 : _l.borderTop;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
var position = this.calcTitlePosition(xCoord + leftShift, yCoord + topShift, outerRadius, innerRadius, angleFrom, angleTo, el.shift + this.seriesSpacing, divWidth, divHeight);
|
|
792
|
+
div.style.left = "".concat(position.left + el.labelOffset.x, "px");
|
|
793
|
+
div.style.top = "".concat(position.top + el.labelOffset.y, "px");
|
|
497
794
|
};
|
|
498
795
|
SciChartPieSurface.prototype.pieSegmentsTotalValue = function () {
|
|
499
796
|
return this.pieSegments.asArray().reduce(function (prev, cur) { return prev + cur.value; }, 0);
|
|
500
797
|
};
|
|
798
|
+
SciChartPieSurface.prototype.pieSegmentsTotalOldValue = function () {
|
|
799
|
+
var total = this.pieSegments.asArray().reduce(function (prev, cur) { var _a; return prev + ((_a = cur.oldValue) !== null && _a !== void 0 ? _a : 0); }, 0);
|
|
800
|
+
return total > 0 ? total : 1;
|
|
801
|
+
};
|
|
501
802
|
SciChartPieSurface.prototype.applySciChartBackground = function (htmlColor) {
|
|
502
803
|
this.domCanvas2D.style.background = htmlColor;
|
|
503
804
|
};
|
|
@@ -552,16 +853,6 @@ var getDonutSectorPath = function (x, y, outerR, innerR, a1, a2, delta) {
|
|
|
552
853
|
return "M".concat(outerX1, " ").concat(outerY1, " A").concat(outerR, " ").concat(outerR, " 0 ").concat(bigArc, " 0 ").concat(outerX2, " ").concat(outerY2, " L").concat(innerX2, " ").concat(innerY2, " A").concat(innerR, " ").concat(innerR, " 0 ").concat(bigArc, " 1 ").concat(innerX1, " ").concat(innerY1, "Z");
|
|
553
854
|
};
|
|
554
855
|
/** @ignore */
|
|
555
|
-
var calcTitlePosition = function (x, y, outerRadius, innerRadius, a1, a2, delta, divWidth, divHeight) {
|
|
556
|
-
var centerRadius = innerRadius < outerRadius / 2
|
|
557
|
-
? (outerRadius * 2) / 3 + innerRadius / 6 + delta
|
|
558
|
-
: (outerRadius + innerRadius) / 2 + delta;
|
|
559
|
-
var centerAngle = (a1 + a2) / 2;
|
|
560
|
-
var left = x + Math.cos(DEG_TO_RAD * centerAngle) * centerRadius - divWidth / 2;
|
|
561
|
-
var top = y + Math.sin(DEG_TO_RAD * centerAngle) * centerRadius - divHeight / 2;
|
|
562
|
-
return { left: left, top: top };
|
|
563
|
-
};
|
|
564
|
-
/** @ignore */
|
|
565
856
|
var isListenerBlocked = false;
|
|
566
857
|
/** @ignore */
|
|
567
858
|
var addEventListenerToPieSegment = function (ps, el, animate) {
|
|
@@ -574,12 +865,13 @@ var addEventListenerToPieSegment = function (ps, el, animate) {
|
|
|
574
865
|
if (!isListenerBlocked) {
|
|
575
866
|
var ROUNDS_1 = 10;
|
|
576
867
|
var directionDown = ps.isSelected;
|
|
577
|
-
var start_1 = directionDown ?
|
|
578
|
-
var d_1 = directionDown ? -
|
|
868
|
+
var start_1 = directionDown ? ps.delta : 0;
|
|
869
|
+
var d_1 = directionDown ? -ps.delta / ROUNDS_1 : ps.delta / ROUNDS_1;
|
|
579
870
|
isListenerBlocked = true;
|
|
871
|
+
ps.isSelected = !ps.isSelected;
|
|
580
872
|
(function myLoop(k) {
|
|
581
873
|
setTimeout(function () {
|
|
582
|
-
ps.
|
|
874
|
+
ps.shift = start_1 + d_1 * k;
|
|
583
875
|
if (k === ROUNDS_1) {
|
|
584
876
|
isListenerBlocked = false;
|
|
585
877
|
}
|