@progress/kendo-charts 2.12.3-develop.1 → 2.12.3-develop.2
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/dist/cdn/js/kendo-charts.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/chart/area-chart/area-chart.js +33 -27
- package/dist/es/chart/area-chart/spline-area-segment.js +1 -16
- package/dist/es/chart/mixins/line-chart-mixin.js +13 -1
- package/dist/es2015/chart/area-chart/area-chart.js +33 -27
- package/dist/es2015/chart/area-chart/spline-area-segment.js +1 -16
- package/dist/es2015/chart/mixins/line-chart-mixin.js +13 -1
- package/dist/npm/main.js +44 -43
- package/dist/systemjs/kendo-charts.js +1 -1
- package/package.json +1 -1
|
@@ -7,6 +7,8 @@ import SplineAreaSegment from './spline-area-segment';
|
|
|
7
7
|
|
|
8
8
|
import { STEP, SMOOTH, ZERO } from '../constants';
|
|
9
9
|
|
|
10
|
+
import { last } from '../../common';
|
|
11
|
+
|
|
10
12
|
class AreaChart extends LineChart {
|
|
11
13
|
createSegment(linePoints, currentSeries, seriesIx, prevSegment) {
|
|
12
14
|
const isStacked = this.options.isStacked;
|
|
@@ -15,13 +17,8 @@ class AreaChart extends LineChart {
|
|
|
15
17
|
|
|
16
18
|
let stackPoints;
|
|
17
19
|
if (isStacked && seriesIx > 0 && prevSegment) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
stackPoints = prevSegment.linePoints;
|
|
21
|
-
previousSegment = prevSegment;
|
|
22
|
-
} else {
|
|
23
|
-
stackPoints = this._gapStackPoints(linePoints, seriesIx, style);
|
|
24
|
-
}
|
|
20
|
+
stackPoints = this._getStackPoints(linePoints, seriesIx, style);
|
|
21
|
+
previousSegment = prevSegment;
|
|
25
22
|
}
|
|
26
23
|
|
|
27
24
|
let pointType;
|
|
@@ -49,41 +46,50 @@ class AreaChart extends LineChart {
|
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
48
|
|
|
52
|
-
|
|
49
|
+
_getStackPoints(linePoints, seriesIx, style) {
|
|
53
50
|
const seriesPoints = this.seriesPoints;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (startIdx < 0) {
|
|
57
|
-
startIdx = 0;
|
|
58
|
-
length--;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const endIdx = startIdx + length;
|
|
51
|
+
const startIdx = Math.max(-1, linePoints[0].categoryIx);
|
|
52
|
+
const endIdx = last(linePoints).categoryIx + 1;
|
|
62
53
|
const pointOffset = this.seriesOptions[0]._outOfRangeMinPoint ? 1 : 0;
|
|
63
54
|
const stackPoints = [];
|
|
64
55
|
|
|
65
56
|
this._stackPoints = this._stackPoints || [];
|
|
66
57
|
for (let categoryIx = startIdx; categoryIx < endIdx; categoryIx++) {
|
|
67
|
-
const pointIx = categoryIx
|
|
58
|
+
const pointIx = categoryIx;
|
|
68
59
|
let currentSeriesIx = seriesIx;
|
|
69
|
-
let
|
|
60
|
+
let prevPoint;
|
|
61
|
+
let crossesSegment = false;
|
|
70
62
|
|
|
71
63
|
do {
|
|
72
64
|
currentSeriesIx--;
|
|
73
|
-
|
|
74
|
-
} while (currentSeriesIx > 0 && !point);
|
|
65
|
+
prevPoint = seriesPoints[currentSeriesIx][pointIx + pointOffset];
|
|
75
66
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
if (!prevPoint && this.hasSegmentForPoint(currentSeriesIx, categoryIx)) {
|
|
68
|
+
crossesSegment = true;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
} while (currentSeriesIx > 0 && !prevPoint);
|
|
72
|
+
|
|
73
|
+
if (prevPoint) {
|
|
74
|
+
if (style !== STEP && categoryIx > startIdx) {
|
|
75
|
+
const crossesPrevSegment = this.hasSegmentForPoint(currentSeriesIx, pointIx - 1);
|
|
76
|
+
if (!crossesPrevSegment) {
|
|
77
|
+
// No previous point, close the gap with a point from the previous segment
|
|
78
|
+
stackPoints.push(this._previousSegmentPoint(categoryIx, pointIx, pointIx - 1, currentSeriesIx));
|
|
79
|
+
}
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
stackPoints.push(
|
|
82
|
+
stackPoints.push(prevPoint);
|
|
82
83
|
|
|
83
|
-
if (style !== STEP && categoryIx + 1 < endIdx
|
|
84
|
-
|
|
84
|
+
if (style !== STEP && categoryIx + 1 < endIdx) {
|
|
85
|
+
const crossesNextSegment = this.hasSegmentForPoint(currentSeriesIx, pointIx + 1);
|
|
86
|
+
if (!crossesNextSegment) {
|
|
87
|
+
// No next point, close the gap with a point from the previous segment
|
|
88
|
+
stackPoints.push(this._previousSegmentPoint(categoryIx, pointIx, pointIx + 1, currentSeriesIx));
|
|
89
|
+
}
|
|
85
90
|
}
|
|
86
|
-
} else {
|
|
91
|
+
} else if (!crossesSegment) {
|
|
92
|
+
// No previous point in the stack and does not cross a segment, add a gap point
|
|
87
93
|
const gapStackPoint = this._createGapStackPoint(categoryIx);
|
|
88
94
|
this._stackPoints.push(gapStackPoint);
|
|
89
95
|
stackPoints.push(gapStackPoint);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { geometry as geom } from '@progress/kendo-drawing';
|
|
2
1
|
import { CurveProcessor } from '../../core';
|
|
3
2
|
|
|
4
3
|
import AreaSegment from './area-segment';
|
|
@@ -12,20 +11,6 @@ class SplineAreaSegment extends AreaSegment {
|
|
|
12
11
|
return curveProcessor.process(linePoints);
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
createStackSegments() {
|
|
16
|
-
const strokeSegments = this.strokeSegments();
|
|
17
|
-
const stackSegments = [];
|
|
18
|
-
for (let idx = strokeSegments.length - 1; idx >= 0; idx--) {
|
|
19
|
-
const segment = strokeSegments[idx];
|
|
20
|
-
stackSegments.push(new geom.Segment(
|
|
21
|
-
segment.anchor(),
|
|
22
|
-
segment.controlOut(),
|
|
23
|
-
segment.controlIn()
|
|
24
|
-
));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return stackSegments;
|
|
28
|
-
}
|
|
29
14
|
}
|
|
30
15
|
|
|
31
|
-
export default SplineAreaSegment;
|
|
16
|
+
export default SplineAreaSegment;
|
|
@@ -49,6 +49,18 @@ const LineChartMixin = {
|
|
|
49
49
|
segment.parent = this;
|
|
50
50
|
},
|
|
51
51
|
|
|
52
|
+
hasSegmentForPoint(seriesIx, pointIx) {
|
|
53
|
+
return this._segments.some(segment => {
|
|
54
|
+
if (segment.seriesIx !== seriesIx) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
const points = segment.linePoints;
|
|
58
|
+
const start = points[0].categoryIx;
|
|
59
|
+
const end = points[points.length - 1].categoryIx;
|
|
60
|
+
return pointIx >= start && pointIx <= end;
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
|
|
52
64
|
sortPoints: function(points) {
|
|
53
65
|
return points;
|
|
54
66
|
},
|
|
@@ -84,4 +96,4 @@ const LineChartMixin = {
|
|
|
84
96
|
}
|
|
85
97
|
};
|
|
86
98
|
|
|
87
|
-
export default LineChartMixin;
|
|
99
|
+
export default LineChartMixin;
|
|
@@ -7,6 +7,8 @@ import SplineAreaSegment from './spline-area-segment';
|
|
|
7
7
|
|
|
8
8
|
import { STEP, SMOOTH, ZERO } from '../constants';
|
|
9
9
|
|
|
10
|
+
import { last } from '../../common';
|
|
11
|
+
|
|
10
12
|
class AreaChart extends LineChart {
|
|
11
13
|
createSegment(linePoints, currentSeries, seriesIx, prevSegment) {
|
|
12
14
|
const isStacked = this.options.isStacked;
|
|
@@ -15,13 +17,8 @@ class AreaChart extends LineChart {
|
|
|
15
17
|
|
|
16
18
|
let stackPoints;
|
|
17
19
|
if (isStacked && seriesIx > 0 && prevSegment) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
stackPoints = prevSegment.linePoints;
|
|
21
|
-
previousSegment = prevSegment;
|
|
22
|
-
} else {
|
|
23
|
-
stackPoints = this._gapStackPoints(linePoints, seriesIx, style);
|
|
24
|
-
}
|
|
20
|
+
stackPoints = this._getStackPoints(linePoints, seriesIx, style);
|
|
21
|
+
previousSegment = prevSegment;
|
|
25
22
|
}
|
|
26
23
|
|
|
27
24
|
let pointType;
|
|
@@ -49,41 +46,50 @@ class AreaChart extends LineChart {
|
|
|
49
46
|
}
|
|
50
47
|
}
|
|
51
48
|
|
|
52
|
-
|
|
49
|
+
_getStackPoints(linePoints, seriesIx, style) {
|
|
53
50
|
const seriesPoints = this.seriesPoints;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (startIdx < 0) {
|
|
57
|
-
startIdx = 0;
|
|
58
|
-
length--;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
const endIdx = startIdx + length;
|
|
51
|
+
const startIdx = Math.max(-1, linePoints[0].categoryIx);
|
|
52
|
+
const endIdx = last(linePoints).categoryIx + 1;
|
|
62
53
|
const pointOffset = this.seriesOptions[0]._outOfRangeMinPoint ? 1 : 0;
|
|
63
54
|
const stackPoints = [];
|
|
64
55
|
|
|
65
56
|
this._stackPoints = this._stackPoints || [];
|
|
66
57
|
for (let categoryIx = startIdx; categoryIx < endIdx; categoryIx++) {
|
|
67
|
-
const pointIx = categoryIx
|
|
58
|
+
const pointIx = categoryIx;
|
|
68
59
|
let currentSeriesIx = seriesIx;
|
|
69
|
-
let
|
|
60
|
+
let prevPoint;
|
|
61
|
+
let crossesSegment = false;
|
|
70
62
|
|
|
71
63
|
do {
|
|
72
64
|
currentSeriesIx--;
|
|
73
|
-
|
|
74
|
-
} while (currentSeriesIx > 0 && !point);
|
|
65
|
+
prevPoint = seriesPoints[currentSeriesIx][pointIx + pointOffset];
|
|
75
66
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
if (!prevPoint && this.hasSegmentForPoint(currentSeriesIx, categoryIx)) {
|
|
68
|
+
crossesSegment = true;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
} while (currentSeriesIx > 0 && !prevPoint);
|
|
72
|
+
|
|
73
|
+
if (prevPoint) {
|
|
74
|
+
if (style !== STEP && categoryIx > startIdx) {
|
|
75
|
+
const crossesPrevSegment = this.hasSegmentForPoint(currentSeriesIx, pointIx - 1);
|
|
76
|
+
if (!crossesPrevSegment) {
|
|
77
|
+
// No previous point, close the gap with a point from the previous segment
|
|
78
|
+
stackPoints.push(this._previousSegmentPoint(categoryIx, pointIx, pointIx - 1, currentSeriesIx));
|
|
79
|
+
}
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
stackPoints.push(
|
|
82
|
+
stackPoints.push(prevPoint);
|
|
82
83
|
|
|
83
|
-
if (style !== STEP && categoryIx + 1 < endIdx
|
|
84
|
-
|
|
84
|
+
if (style !== STEP && categoryIx + 1 < endIdx) {
|
|
85
|
+
const crossesNextSegment = this.hasSegmentForPoint(currentSeriesIx, pointIx + 1);
|
|
86
|
+
if (!crossesNextSegment) {
|
|
87
|
+
// No next point, close the gap with a point from the previous segment
|
|
88
|
+
stackPoints.push(this._previousSegmentPoint(categoryIx, pointIx, pointIx + 1, currentSeriesIx));
|
|
89
|
+
}
|
|
85
90
|
}
|
|
86
|
-
} else {
|
|
91
|
+
} else if (!crossesSegment) {
|
|
92
|
+
// No previous point in the stack and does not cross a segment, add a gap point
|
|
87
93
|
const gapStackPoint = this._createGapStackPoint(categoryIx);
|
|
88
94
|
this._stackPoints.push(gapStackPoint);
|
|
89
95
|
stackPoints.push(gapStackPoint);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { geometry as geom } from '@progress/kendo-drawing';
|
|
2
1
|
import { CurveProcessor } from '../../core';
|
|
3
2
|
|
|
4
3
|
import AreaSegment from './area-segment';
|
|
@@ -12,20 +11,6 @@ class SplineAreaSegment extends AreaSegment {
|
|
|
12
11
|
return curveProcessor.process(linePoints);
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
createStackSegments() {
|
|
16
|
-
const strokeSegments = this.strokeSegments();
|
|
17
|
-
const stackSegments = [];
|
|
18
|
-
for (let idx = strokeSegments.length - 1; idx >= 0; idx--) {
|
|
19
|
-
const segment = strokeSegments[idx];
|
|
20
|
-
stackSegments.push(new geom.Segment(
|
|
21
|
-
segment.anchor(),
|
|
22
|
-
segment.controlOut(),
|
|
23
|
-
segment.controlIn()
|
|
24
|
-
));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return stackSegments;
|
|
28
|
-
}
|
|
29
14
|
}
|
|
30
15
|
|
|
31
|
-
export default SplineAreaSegment;
|
|
16
|
+
export default SplineAreaSegment;
|
|
@@ -49,6 +49,18 @@ const LineChartMixin = {
|
|
|
49
49
|
segment.parent = this;
|
|
50
50
|
},
|
|
51
51
|
|
|
52
|
+
hasSegmentForPoint(seriesIx, pointIx) {
|
|
53
|
+
return this._segments.some(segment => {
|
|
54
|
+
if (segment.seriesIx !== seriesIx) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
const points = segment.linePoints;
|
|
58
|
+
const start = points[0].categoryIx;
|
|
59
|
+
const end = points[points.length - 1].categoryIx;
|
|
60
|
+
return pointIx >= start && pointIx <= end;
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
|
|
52
64
|
sortPoints: function(points) {
|
|
53
65
|
return points;
|
|
54
66
|
},
|
|
@@ -84,4 +96,4 @@ const LineChartMixin = {
|
|
|
84
96
|
}
|
|
85
97
|
};
|
|
86
98
|
|
|
87
|
-
export default LineChartMixin;
|
|
99
|
+
export default LineChartMixin;
|