@progress/kendo-charts 1.31.0 → 1.32.0
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/README.md +1 -1
- package/dist/cdn/js/kendo-charts.js +1 -1
- package/dist/cdn/main.js +1 -1
- package/dist/es/chart/base-theme.js +22 -2
- package/dist/es/chart/categorical-chart.js +6 -26
- package/dist/es/chart/constants.js +11 -1
- package/dist/es/chart/heatmap-chart/heatmap-chart.js +2 -6
- package/dist/es/chart/plotarea/categorical-plotarea.js +83 -16
- package/dist/es/chart/plotarea/plotarea-base.js +71 -2
- package/dist/es/chart/plotarea/plotarea-factory.js +4 -2
- package/dist/es/chart/plotarea/polar-plotarea.js +21 -2
- package/dist/es/chart/plotarea/radar-plotarea.js +13 -2
- package/dist/es/chart/plotarea/xy-plotarea.js +38 -5
- package/dist/es/chart/register-charts.js +12 -7
- package/dist/es/chart/scatter-charts/scatter-chart.js +3 -7
- package/dist/es/chart/trendlines/calculate-moving-average.js +44 -0
- package/dist/es/chart/trendlines/calculate-slope.js +37 -0
- package/dist/es/chart/trendlines/linear-trendline.js +61 -0
- package/dist/es/chart/trendlines/moving-average.js +65 -0
- package/dist/es/chart/trendlines/scatter-linear-trendline.js +63 -0
- package/dist/es/chart/trendlines/scatter-moving-average.js +34 -0
- package/dist/es/chart/trendlines/scatter-trendline-registry.js +9 -0
- package/dist/es/chart/trendlines/scatter-value-getter.js +7 -0
- package/dist/es/chart/trendlines/trendline-factory.js +10 -0
- package/dist/es/chart/trendlines/trendline-registry.js +9 -0
- package/dist/es/chart/utils.js +0 -2
- package/dist/es/common/constants.js +1 -0
- package/dist/es/common/hash-map.js +7 -11
- package/dist/es/core/category-axis.js +37 -30
- package/dist/es/core/date-category-axis.js +27 -3
- package/dist/es2015/chart/base-theme.js +22 -2
- package/dist/es2015/chart/categorical-chart.js +6 -26
- package/dist/es2015/chart/constants.js +11 -1
- package/dist/es2015/chart/heatmap-chart/heatmap-chart.js +2 -6
- package/dist/es2015/chart/plotarea/categorical-plotarea.js +81 -16
- package/dist/es2015/chart/plotarea/plotarea-base.js +69 -2
- package/dist/es2015/chart/plotarea/plotarea-factory.js +4 -2
- package/dist/es2015/chart/plotarea/polar-plotarea.js +21 -2
- package/dist/es2015/chart/plotarea/radar-plotarea.js +13 -2
- package/dist/es2015/chart/plotarea/xy-plotarea.js +36 -5
- package/dist/es2015/chart/register-charts.js +14 -5
- package/dist/es2015/chart/scatter-charts/scatter-chart.js +3 -7
- package/dist/es2015/chart/trendlines/calculate-moving-average.js +42 -0
- package/dist/es2015/chart/trendlines/calculate-slope.js +35 -0
- package/dist/es2015/chart/trendlines/linear-trendline.js +51 -0
- package/dist/es2015/chart/trendlines/moving-average.js +53 -0
- package/dist/es2015/chart/trendlines/scatter-linear-trendline.js +57 -0
- package/dist/es2015/chart/trendlines/scatter-moving-average.js +31 -0
- package/dist/es2015/chart/trendlines/scatter-trendline-registry.js +9 -0
- package/dist/es2015/chart/trendlines/scatter-value-getter.js +4 -0
- package/dist/es2015/chart/trendlines/trendline-factory.js +10 -0
- package/dist/es2015/chart/trendlines/trendline-registry.js +9 -0
- package/dist/es2015/chart/utils.js +0 -2
- package/dist/es2015/common/constants.js +1 -0
- package/dist/es2015/common/hash-map.js +7 -11
- package/dist/es2015/core/category-axis.js +37 -30
- package/dist/es2015/core/date-category-axis.js +27 -3
- package/dist/npm/main.js +889 -353
- package/dist/systemjs/kendo-charts.js +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { TRENDLINE_SERIES } from './constants';
|
|
2
|
+
import { INHERIT } from '../common/constants';
|
|
3
|
+
|
|
1
4
|
var BAR_GAP = 1.5;
|
|
2
5
|
var BAR_SPACING = 0.4;
|
|
3
6
|
var BLACK = '#000';
|
|
@@ -262,7 +265,22 @@ var heatmapSeries = function () { return ({
|
|
|
262
265
|
}
|
|
263
266
|
}); };
|
|
264
267
|
|
|
265
|
-
var
|
|
268
|
+
var trendlineSeriesDefaults = function () { return TRENDLINE_SERIES.reduce(
|
|
269
|
+
function (options, type) {
|
|
270
|
+
options[type] = {
|
|
271
|
+
color: INHERIT,
|
|
272
|
+
trendline: {},
|
|
273
|
+
markers: {
|
|
274
|
+
visible: false
|
|
275
|
+
},
|
|
276
|
+
width: 1,
|
|
277
|
+
dashType: 'longDash'
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
return options;
|
|
281
|
+
}, {}); };
|
|
282
|
+
|
|
283
|
+
var seriesDefaults = function (options) { return (Object.assign({
|
|
266
284
|
visible: true,
|
|
267
285
|
labels: {
|
|
268
286
|
font: SANS11
|
|
@@ -300,7 +318,9 @@ var seriesDefaults = function (options) { return ({
|
|
|
300
318
|
verticalBullet: bulletSeries(),
|
|
301
319
|
verticalLine: lineSeries(),
|
|
302
320
|
waterfall: waterfallSeries()
|
|
303
|
-
}
|
|
321
|
+
},
|
|
322
|
+
trendlineSeriesDefaults()
|
|
323
|
+
)); };
|
|
304
324
|
|
|
305
325
|
var title = function () { return ({
|
|
306
326
|
font: SANS16
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import ErrorRangeCalculator from './error-bars/error-range-calculator';
|
|
2
2
|
import CategoricalErrorBar from './error-bars/categorical-error-bar';
|
|
3
3
|
|
|
4
|
-
import SeriesBinder from './series-binder';
|
|
5
4
|
import { ERROR_LOW_FIELD, ERROR_HIGH_FIELD } from './constants';
|
|
6
5
|
|
|
7
|
-
import evalOptions from './utils
|
|
8
|
-
import categoriesCount from './utils/categories-count';
|
|
6
|
+
import { evalOptions, categoriesCount } from './utils';
|
|
9
7
|
|
|
10
8
|
import { ChartElement, Box } from '../core';
|
|
11
9
|
|
|
@@ -444,9 +442,9 @@ var CategoricalChart = (function (ChartElement) {
|
|
|
444
442
|
};
|
|
445
443
|
|
|
446
444
|
CategoricalChart.prototype.limitPoint = function limitPoint (point) {
|
|
447
|
-
var
|
|
448
|
-
if (!
|
|
449
|
-
point.reflow(
|
|
445
|
+
var limitedSlot = this.categoryAxis.limitSlot(point.box);
|
|
446
|
+
if (!limitedSlot.equals(point.box)) {
|
|
447
|
+
point.reflow(limitedSlot);
|
|
450
448
|
}
|
|
451
449
|
};
|
|
452
450
|
|
|
@@ -502,7 +500,7 @@ var CategoricalChart = (function (ChartElement) {
|
|
|
502
500
|
for (var seriesIx$1 = 0; seriesIx$1 < seriesCount; seriesIx$1++) {
|
|
503
501
|
var currentSeries = series[seriesIx$1];
|
|
504
502
|
var currentCategory = this$1.categoryAxis.categoryAt(categoryIx);
|
|
505
|
-
var pointData = this$1.
|
|
503
|
+
var pointData = this$1.plotArea.bindPoint(currentSeries, categoryIx);
|
|
506
504
|
|
|
507
505
|
callback(pointData, {
|
|
508
506
|
category: currentCategory,
|
|
@@ -523,7 +521,7 @@ var CategoricalChart = (function (ChartElement) {
|
|
|
523
521
|
var outOfRangePoint = series[field];
|
|
524
522
|
if (outOfRangePoint) {
|
|
525
523
|
var categoryIx = outOfRangePoint.categoryIx;
|
|
526
|
-
var pointData = this.
|
|
524
|
+
var pointData = this.plotArea.bindPoint(series, categoryIx, outOfRangePoint.item);
|
|
527
525
|
|
|
528
526
|
callback(pointData, {
|
|
529
527
|
category: outOfRangePoint.category,
|
|
@@ -535,24 +533,6 @@ var CategoricalChart = (function (ChartElement) {
|
|
|
535
533
|
}
|
|
536
534
|
};
|
|
537
535
|
|
|
538
|
-
CategoricalChart.prototype._bindPoint = function _bindPoint (series, seriesIx, categoryIx, item) {
|
|
539
|
-
if (!this._bindCache) {
|
|
540
|
-
this._bindCache = [];
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
var bindCache = this._bindCache[seriesIx];
|
|
544
|
-
if (!bindCache) {
|
|
545
|
-
bindCache = this._bindCache[seriesIx] = [];
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
var data = bindCache[categoryIx];
|
|
549
|
-
if (!data) {
|
|
550
|
-
data = bindCache[categoryIx] = SeriesBinder.current.bindPoint(series, categoryIx, item);
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
return data;
|
|
554
|
-
};
|
|
555
|
-
|
|
556
536
|
CategoricalChart.prototype.formatPointValue = function formatPointValue (point, format) {
|
|
557
537
|
if (point.value === null) {
|
|
558
538
|
return "";
|
|
@@ -62,6 +62,12 @@ var EQUALLY_SPACED_SERIES = [
|
|
|
62
62
|
BULLET, RANGE_COLUMN, RANGE_BAR, WATERFALL, HORIZONTAL_WATERFALL
|
|
63
63
|
];
|
|
64
64
|
|
|
65
|
+
var TRENDLINE_LINEAR = 'linearTrendline';
|
|
66
|
+
var TRENDLINE_MOVING_AVERAGE = 'movingAverageTrendline';
|
|
67
|
+
var TRENDLINE_SERIES = [
|
|
68
|
+
TRENDLINE_LINEAR, TRENDLINE_MOVING_AVERAGE
|
|
69
|
+
];
|
|
70
|
+
|
|
65
71
|
var LEGEND_ITEM_CLICK = "legendItemClick";
|
|
66
72
|
var LEGEND_ITEM_HOVER = "legendItemHover";
|
|
67
73
|
var LEGEND_ITEM_LEAVE = "legendItemLeave";
|
|
@@ -100,6 +106,8 @@ var MOUSEWHEEL_ZOOM_RATE = 0.3;
|
|
|
100
106
|
var DRILLDOWN = "drilldown";
|
|
101
107
|
var DRILLDOWN_FIELD = "drilldown";
|
|
102
108
|
|
|
109
|
+
var MIN_MOVING_AVERAGE_PERIOD = 2;
|
|
110
|
+
|
|
103
111
|
export {
|
|
104
112
|
INITIAL_ANIMATION_DURATION, FADEIN,
|
|
105
113
|
LEGEND_ITEM_CLICK, LEGEND_ITEM_HOVER, LEGEND_ITEM_LEAVE,
|
|
@@ -124,5 +132,7 @@ export {
|
|
|
124
132
|
SHOW_TOOLTIP, HIDE_TOOLTIP,
|
|
125
133
|
EQUALLY_SPACED_SERIES, ABOVE, BELOW,
|
|
126
134
|
HEATMAP,
|
|
127
|
-
DRILLDOWN, DRILLDOWN_FIELD
|
|
135
|
+
DRILLDOWN, DRILLDOWN_FIELD,
|
|
136
|
+
MIN_MOVING_AVERAGE_PERIOD,
|
|
137
|
+
TRENDLINE_SERIES, TRENDLINE_LINEAR, TRENDLINE_MOVING_AVERAGE
|
|
128
138
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { deepExtend, defined, isFunction, setDefaultOptions } from '../../common';
|
|
2
2
|
import { MAX_VALUE, MIN_VALUE } from '../../common/constants';
|
|
3
3
|
import { Box, ChartElement } from '../../core';
|
|
4
|
-
import CategoricalChart from '../categorical-chart';
|
|
5
4
|
import evalOptions from '../utils/eval-options';
|
|
6
5
|
import colorScale from './color-scale';
|
|
7
6
|
import HeatmapPoint from './heatmap-point';
|
|
@@ -43,7 +42,7 @@ var HeatmapChart = (function (ChartElement) {
|
|
|
43
42
|
var currentSeries = series[seriesIx];
|
|
44
43
|
|
|
45
44
|
for (var pointIx = 0; pointIx < currentSeries.data.length; pointIx++) {
|
|
46
|
-
var ref$1 = this$1.
|
|
45
|
+
var ref$1 = this$1.plotArea.bindPoint(currentSeries, pointIx);
|
|
47
46
|
var valueFields = ref$1.valueFields;
|
|
48
47
|
if (defined(valueFields.value) && valueFields.value !== null) {
|
|
49
48
|
this$1.valueRange.min = Math.min(this$1.valueRange.min, valueFields.value);
|
|
@@ -210,7 +209,7 @@ var HeatmapChart = (function (ChartElement) {
|
|
|
210
209
|
var yRange = yAxis.currentRangeIndices();
|
|
211
210
|
|
|
212
211
|
for (var pointIx = 0; pointIx < currentSeries.data.length; pointIx++) {
|
|
213
|
-
var ref$2 = this$1.
|
|
212
|
+
var ref$2 = this$1.plotArea.bindPoint(currentSeries, pointIx);
|
|
214
213
|
var value = ref$2.valueFields;
|
|
215
214
|
var fields = ref$2.fields;
|
|
216
215
|
var xIndex = xAxis.totalIndex(value.x);
|
|
@@ -257,8 +256,5 @@ setDefaultOptions(HeatmapChart, {
|
|
|
257
256
|
},
|
|
258
257
|
clip: true
|
|
259
258
|
});
|
|
260
|
-
deepExtend(HeatmapChart.prototype, {
|
|
261
|
-
_bindPoint: CategoricalChart.prototype._bindPoint
|
|
262
|
-
});
|
|
263
259
|
|
|
264
260
|
export default HeatmapChart;
|
|
@@ -14,6 +14,8 @@ import OHLCChart from '../ohlc-chart/ohlc-chart';
|
|
|
14
14
|
import CandlestickChart from '../candlestick-chart/candlestick-chart';
|
|
15
15
|
import BoxPlotChart from '../box-plot-chart/box-plot-chart';
|
|
16
16
|
import WaterfallChart from '../waterfall-chart/waterfall-chart';
|
|
17
|
+
import trendlineFactory from '../trendlines/trendline-factory';
|
|
18
|
+
import trendlineRegistry from '../trendlines/trendline-registry';
|
|
17
19
|
|
|
18
20
|
import { CategoryAxis, DateCategoryAxis, NumericAxis, LogarithmicAxis, Point } from '../../core';
|
|
19
21
|
|
|
@@ -25,7 +27,7 @@ import { BAR, COLUMN, BULLET, VERTICAL_BULLET, LINE, VERTICAL_LINE, AREA, VERTIC
|
|
|
25
27
|
BOX_PLOT, VERTICAL_BOX_PLOT, OHLC, CANDLESTICK, LOGARITHMIC, STEP, EQUALLY_SPACED_SERIES } from '../constants';
|
|
26
28
|
|
|
27
29
|
import { DATE, MAX_VALUE } from '../../common/constants';
|
|
28
|
-
import { setDefaultOptions, inArray,
|
|
30
|
+
import { setDefaultOptions, inArray, deepExtend, defined, eventElement, grep } from '../../common';
|
|
29
31
|
|
|
30
32
|
var AREA_SERIES = [ AREA, VERTICAL_AREA, RANGE_AREA, VERTICAL_RANGE_AREA ];
|
|
31
33
|
var OUT_OF_RANGE_SERIES = [ LINE, VERTICAL_LINE ].concat(AREA_SERIES);
|
|
@@ -45,6 +47,8 @@ var CategoricalPlotArea = (function (PlotAreaBase) {
|
|
|
45
47
|
this.namedCategoryAxes = {};
|
|
46
48
|
this.namedValueAxes = {};
|
|
47
49
|
this.valueAxisRangeTracker = new AxisGroupRangeTracker();
|
|
50
|
+
this._seriesPointsCache = {};
|
|
51
|
+
this._currentPointsCache = {};
|
|
48
52
|
|
|
49
53
|
if (series.length > 0) {
|
|
50
54
|
this.invertAxes = inArray(
|
|
@@ -60,14 +64,17 @@ var CategoricalPlotArea = (function (PlotAreaBase) {
|
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
|
-
|
|
64
67
|
};
|
|
65
68
|
|
|
66
69
|
CategoricalPlotArea.prototype.render = function render (panes) {
|
|
67
70
|
if ( panes === void 0 ) panes = this.panes;
|
|
68
71
|
|
|
72
|
+
this.series = [].concat( this.originalSeries );
|
|
69
73
|
this.createCategoryAxes(panes);
|
|
74
|
+
|
|
70
75
|
this.aggregateCategories(panes);
|
|
76
|
+
this.createTrendlineSeries(panes);
|
|
77
|
+
|
|
71
78
|
this.createCategoryAxesLabels(panes);
|
|
72
79
|
this.createCharts(panes);
|
|
73
80
|
this.createValueAxes(panes);
|
|
@@ -94,6 +101,62 @@ var CategoricalPlotArea = (function (PlotAreaBase) {
|
|
|
94
101
|
}
|
|
95
102
|
};
|
|
96
103
|
|
|
104
|
+
CategoricalPlotArea.prototype.trendlineFactory = function trendlineFactory$1 (options, series) {
|
|
105
|
+
var categoryAxis = this.seriesCategoryAxis(options);
|
|
106
|
+
var seriesValues = this.seriesValues.bind(this, series.index);
|
|
107
|
+
|
|
108
|
+
var trendline = trendlineFactory(trendlineRegistry, options.type, {
|
|
109
|
+
options: options,
|
|
110
|
+
categoryAxis: categoryAxis,
|
|
111
|
+
seriesValues: seriesValues
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
if (trendline) {
|
|
115
|
+
// Inherit settings
|
|
116
|
+
trendline.categoryAxis = series.categoryAxis;
|
|
117
|
+
trendline.valueAxis = series.valueAxis;
|
|
118
|
+
|
|
119
|
+
return this.filterSeries(trendline, categoryAxis);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return trendline;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
CategoricalPlotArea.prototype.trendlineAggregateForecast = function trendlineAggregateForecast () {
|
|
126
|
+
return this.series
|
|
127
|
+
.map(function (series) { return (series.trendline || {}).forecast; })
|
|
128
|
+
.filter(function (forecast) { return forecast !== undefined; })
|
|
129
|
+
.reduce(function (result, forecast) { return ({
|
|
130
|
+
before: Math.max(result.before, forecast.before || 0),
|
|
131
|
+
after: Math.max(result.after, forecast.after || 0)
|
|
132
|
+
}); }, { before: 0, after: 0 });
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
CategoricalPlotArea.prototype.seriesValues = function seriesValues (seriesIx, range) {
|
|
136
|
+
var this$1 = this;
|
|
137
|
+
|
|
138
|
+
var result = [];
|
|
139
|
+
|
|
140
|
+
var series = this.srcSeries[seriesIx];
|
|
141
|
+
var categoryAxis = this.seriesCategoryAxis(series);
|
|
142
|
+
var dateAxis = equalsIgnoreCase(categoryAxis.options.type, DATE);
|
|
143
|
+
if (dateAxis) {
|
|
144
|
+
this._seriesPointsCache = {};
|
|
145
|
+
this._currentPointsCache = {};
|
|
146
|
+
categoryAxis.options.dataItems = [];
|
|
147
|
+
series = this.aggregateSeries(series, categoryAxis, categoryAxis.totalRangeIndices());
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
var min = range ? range.min : 0;
|
|
151
|
+
var max = range ? range.max : series.data.length;
|
|
152
|
+
for (var categoryIx = min; categoryIx < max; categoryIx++) {
|
|
153
|
+
var data = this$1.bindPoint(series, categoryIx);
|
|
154
|
+
result.push({ categoryIx: categoryIx, category: data.fields.category, valueFields: data.valueFields });
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return result;
|
|
158
|
+
};
|
|
159
|
+
|
|
97
160
|
CategoricalPlotArea.prototype.createCharts = function createCharts (panes) {
|
|
98
161
|
var this$1 = this;
|
|
99
162
|
|
|
@@ -161,21 +224,24 @@ var CategoricalPlotArea = (function (PlotAreaBase) {
|
|
|
161
224
|
CategoricalPlotArea.prototype.aggregateCategories = function aggregateCategories (panes) {
|
|
162
225
|
var this$1 = this;
|
|
163
226
|
|
|
164
|
-
var series =
|
|
227
|
+
var series = [].concat( this.series );
|
|
165
228
|
var processedSeries = [];
|
|
166
229
|
this._currentPointsCache = {};
|
|
167
230
|
this._seriesPointsCache = this._seriesPointsCache || {};
|
|
168
231
|
|
|
169
232
|
for (var i = 0; i < series.length; i++) {
|
|
170
233
|
var currentSeries = series[i];
|
|
171
|
-
var categoryAxis = this$1.seriesCategoryAxis(currentSeries);
|
|
172
|
-
var axisPane = this$1.findPane(categoryAxis.options.pane);
|
|
173
|
-
var dateAxis = equalsIgnoreCase(categoryAxis.options.type, DATE);
|
|
174
234
|
|
|
175
|
-
if ((
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
235
|
+
if (!this$1.isTrendline(currentSeries)) {
|
|
236
|
+
var categoryAxis = this$1.seriesCategoryAxis(currentSeries);
|
|
237
|
+
var axisPane = this$1.findPane(categoryAxis.options.pane);
|
|
238
|
+
var dateAxis = equalsIgnoreCase(categoryAxis.options.type, DATE);
|
|
239
|
+
|
|
240
|
+
if ((dateAxis || currentSeries.categoryField) && inArray(axisPane, panes)) {
|
|
241
|
+
currentSeries = this$1.aggregateSeries(currentSeries, categoryAxis, categoryAxis.currentRangeIndices());
|
|
242
|
+
} else {
|
|
243
|
+
currentSeries = this$1.filterSeries(currentSeries, categoryAxis);
|
|
244
|
+
}
|
|
179
245
|
}
|
|
180
246
|
|
|
181
247
|
processedSeries.push(currentSeries);
|
|
@@ -192,7 +258,7 @@ var CategoricalPlotArea = (function (PlotAreaBase) {
|
|
|
192
258
|
var dataLength = (series.data || {}).length;
|
|
193
259
|
categoryAxis._seriesMax = Math.max(categoryAxis._seriesMax || 0, dataLength);
|
|
194
260
|
|
|
195
|
-
if (!(
|
|
261
|
+
if (!(defined(categoryAxis.options.min) || defined(categoryAxis.options.max))) {
|
|
196
262
|
return series;
|
|
197
263
|
}
|
|
198
264
|
|
|
@@ -221,7 +287,7 @@ var CategoricalPlotArea = (function (PlotAreaBase) {
|
|
|
221
287
|
var this$1 = this;
|
|
222
288
|
|
|
223
289
|
var key = (series.index) + ";" + (categoryAxis.categoriesHash());
|
|
224
|
-
if (this._seriesPointsCache[key]) {
|
|
290
|
+
if (this._seriesPointsCache && this._seriesPointsCache[key]) {
|
|
225
291
|
this._currentPointsCache[key] = this._seriesPointsCache[key];
|
|
226
292
|
return this._seriesPointsCache[key];
|
|
227
293
|
}
|
|
@@ -233,7 +299,7 @@ var CategoricalPlotArea = (function (PlotAreaBase) {
|
|
|
233
299
|
var getFn = dateAxis ? getDateField : getField;
|
|
234
300
|
var result = [];
|
|
235
301
|
if (!dateAxis) {
|
|
236
|
-
categoryAxis.mapCategories()
|
|
302
|
+
categoryAxis.mapCategories(); //fixes major performance issue caused by searching for the index for large data
|
|
237
303
|
}
|
|
238
304
|
|
|
239
305
|
for (var idx = 0; idx < srcData.length; idx++) {
|
|
@@ -256,7 +322,7 @@ var CategoricalPlotArea = (function (PlotAreaBase) {
|
|
|
256
322
|
return result;
|
|
257
323
|
};
|
|
258
324
|
|
|
259
|
-
CategoricalPlotArea.prototype.aggregateSeries = function aggregateSeries (series, categoryAxis) {
|
|
325
|
+
CategoricalPlotArea.prototype.aggregateSeries = function aggregateSeries (series, categoryAxis, range) {
|
|
260
326
|
var srcData = series.data;
|
|
261
327
|
if (!srcData.length) {
|
|
262
328
|
return series;
|
|
@@ -266,9 +332,9 @@ var CategoricalPlotArea = (function (PlotAreaBase) {
|
|
|
266
332
|
var result = deepExtend({}, series);
|
|
267
333
|
var aggregator = new SeriesAggregator(deepExtend({}, series), SeriesBinder.current, DefaultAggregates.current);
|
|
268
334
|
var data = result.data = [];
|
|
335
|
+
|
|
269
336
|
var dataItems = categoryAxis.options.dataItems || [];
|
|
270
337
|
|
|
271
|
-
var range = categoryAxis.currentRangeIndices();
|
|
272
338
|
var categoryItem = function (idx) {
|
|
273
339
|
var categoryIdx = idx - range.min;
|
|
274
340
|
var point = srcPoints[idx];
|
|
@@ -616,6 +682,7 @@ var CategoricalPlotArea = (function (PlotAreaBase) {
|
|
|
616
682
|
var categoryAxis = (void 0);
|
|
617
683
|
|
|
618
684
|
if (isDateAxis(axisOptions, categories[0])) {
|
|
685
|
+
axisOptions._forecast = this$1.trendlineAggregateForecast();
|
|
619
686
|
categoryAxis = new DateCategoryAxis(axisOptions, this$1.chartService);
|
|
620
687
|
} else {
|
|
621
688
|
categoryAxis = new CategoryAxis(axisOptions, this$1.chartService);
|
|
@@ -795,4 +862,4 @@ setDefaultOptions(CategoricalPlotArea, {
|
|
|
795
862
|
|
|
796
863
|
deepExtend(CategoricalPlotArea.prototype, PlotAreaEventsMixin);
|
|
797
864
|
|
|
798
|
-
export default CategoricalPlotArea;
|
|
865
|
+
export default CategoricalPlotArea;
|
|
@@ -4,9 +4,11 @@ import { ChartElement, Box } from '../../core';
|
|
|
4
4
|
import Crosshair from '../crosshair/crosshair';
|
|
5
5
|
import Pane from '../pane';
|
|
6
6
|
import { hasValue } from '../utils';
|
|
7
|
+
import SeriesBinder from '../series-binder';
|
|
7
8
|
|
|
8
|
-
import { WHITE, BLACK, X, Y, COORD_PRECISION, TOP, BOTTOM, LEFT, RIGHT, START, END } from '../../common/constants';
|
|
9
|
-
import { append, deepExtend, defined, getSpacing, getTemplate, inArray, isFunction, isString, limitValue, round, setDefaultOptions } from '../../common';
|
|
9
|
+
import { WHITE, BLACK, X, Y, COORD_PRECISION, TOP, BOTTOM, LEFT, RIGHT, START, END, INHERIT } from '../../common/constants';
|
|
10
|
+
import { append, deepExtend, defined, getSpacing, getTemplate, inArray, isFunction, isString, limitValue, round, setDefaultOptions, last } from '../../common';
|
|
11
|
+
import { TRENDLINE_SERIES } from '../constants';
|
|
10
12
|
|
|
11
13
|
var PlotAreaBase = (function (ChartElement) {
|
|
12
14
|
function PlotAreaBase(series, options, chartService) {
|
|
@@ -22,6 +24,8 @@ var PlotAreaBase = (function (ChartElement) {
|
|
|
22
24
|
this.crosshairs = [];
|
|
23
25
|
this.chartService = chartService;
|
|
24
26
|
this.originalOptions = options;
|
|
27
|
+
this.originalSeries = series;
|
|
28
|
+
this._bindCache = new WeakMap();
|
|
25
29
|
|
|
26
30
|
this.createPanes();
|
|
27
31
|
this.render();
|
|
@@ -42,6 +46,21 @@ var PlotAreaBase = (function (ChartElement) {
|
|
|
42
46
|
}
|
|
43
47
|
};
|
|
44
48
|
|
|
49
|
+
PlotAreaBase.prototype.bindPoint = function bindPoint (series, pointIx, item) {
|
|
50
|
+
var cached = this._bindCache.get(series);
|
|
51
|
+
if (!cached) {
|
|
52
|
+
cached = [];
|
|
53
|
+
this._bindCache.set(series, cached);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var data = cached[pointIx];
|
|
57
|
+
if (!data) {
|
|
58
|
+
data = cached[pointIx] = SeriesBinder.current.bindPoint(series, pointIx, item);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return data;
|
|
62
|
+
};
|
|
63
|
+
|
|
45
64
|
PlotAreaBase.prototype.createPanes = function createPanes () {
|
|
46
65
|
var this$1 = this;
|
|
47
66
|
|
|
@@ -334,6 +353,8 @@ var PlotAreaBase = (function (ChartElement) {
|
|
|
334
353
|
panesArray[i].empty();
|
|
335
354
|
}
|
|
336
355
|
|
|
356
|
+
this._bindCache = new WeakMap();
|
|
357
|
+
|
|
337
358
|
this.render(panesArray);
|
|
338
359
|
this.detachLabels();
|
|
339
360
|
this.reflowAxes(this.panes);
|
|
@@ -968,6 +989,54 @@ var PlotAreaBase = (function (ChartElement) {
|
|
|
968
989
|
return labelAxis;
|
|
969
990
|
};
|
|
970
991
|
|
|
992
|
+
PlotAreaBase.prototype.isTrendline = function isTrendline (series) {
|
|
993
|
+
return series && inArray(series.type, TRENDLINE_SERIES);
|
|
994
|
+
};
|
|
995
|
+
|
|
996
|
+
PlotAreaBase.prototype.trendlineFactory = function trendlineFactory () { /* abstract */ };
|
|
997
|
+
|
|
998
|
+
PlotAreaBase.prototype.createTrendlineSeries = function createTrendlineSeries () {
|
|
999
|
+
var this$1 = this;
|
|
1000
|
+
|
|
1001
|
+
var modifiedSeries = [];
|
|
1002
|
+
|
|
1003
|
+
this.series = this.series.map(function (series) {
|
|
1004
|
+
if (!this$1.isTrendline(series)) {
|
|
1005
|
+
return series;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
var forSeries = this$1.seriesByName(series.for);
|
|
1009
|
+
if (!forSeries) {
|
|
1010
|
+
throw new Error('Invalid Configuration: Unable to locate linked series ' +
|
|
1011
|
+
"\"" + (series.for) + "\" for trendline \"" + (series.name) + "\".");
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
var valueFields = SeriesBinder.current.valueFields(forSeries);
|
|
1015
|
+
var field = last(valueFields); // Use the last field for multi-field series
|
|
1016
|
+
|
|
1017
|
+
var trendlineSeries = this$1.trendlineFactory(Object.assign({}, {field: field}, series), forSeries);
|
|
1018
|
+
if (trendlineSeries) {
|
|
1019
|
+
if (forSeries.visible === false) {
|
|
1020
|
+
trendlineSeries.visible = false;
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
if (trendlineSeries.color === INHERIT) {
|
|
1024
|
+
trendlineSeries.color = forSeries.color;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
modifiedSeries.push(trendlineSeries);
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
return trendlineSeries;
|
|
1031
|
+
}).filter(function (series) { return series !== null; });
|
|
1032
|
+
|
|
1033
|
+
return modifiedSeries;
|
|
1034
|
+
};
|
|
1035
|
+
|
|
1036
|
+
PlotAreaBase.prototype.seriesByName = function seriesByName (name) {
|
|
1037
|
+
return this.series.find(function (series) { return series.name === name; });
|
|
1038
|
+
};
|
|
1039
|
+
|
|
971
1040
|
return PlotAreaBase;
|
|
972
1041
|
}(ChartElement));
|
|
973
1042
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import filterSeriesByType from '../utils/filter-series-by-type';
|
|
2
2
|
import { Class } from '../../common';
|
|
3
|
+
import { TRENDLINE_SERIES } from '../constants';
|
|
3
4
|
|
|
4
5
|
var PlotAreaFactory = (function (Class) {
|
|
5
6
|
function PlotAreaFactory() {
|
|
@@ -27,8 +28,9 @@ var PlotAreaFactory = (function (Class) {
|
|
|
27
28
|
for (var idx = 0; idx < registry.length; idx++) {
|
|
28
29
|
var entry = registry[idx];
|
|
29
30
|
series = filterSeriesByType(srcSeries, entry.seriesTypes);
|
|
31
|
+
var trendlines = filterSeriesByType(srcSeries, TRENDLINE_SERIES);
|
|
30
32
|
|
|
31
|
-
if (series.length > 0) {
|
|
33
|
+
if ((series.length - trendlines.length) > 0) {
|
|
32
34
|
match = entry;
|
|
33
35
|
break;
|
|
34
36
|
}
|
|
@@ -42,4 +44,4 @@ var PlotAreaFactory = (function (Class) {
|
|
|
42
44
|
|
|
43
45
|
PlotAreaFactory.current = new PlotAreaFactory();
|
|
44
46
|
|
|
45
|
-
export default PlotAreaFactory;
|
|
47
|
+
export default PlotAreaFactory;
|
|
@@ -13,6 +13,7 @@ import filterSeriesByType from '../utils/filter-series-by-type';
|
|
|
13
13
|
|
|
14
14
|
import { ARC } from '../../common/constants';
|
|
15
15
|
import { deepExtend, eventElement, setDefaultOptions } from '../../common';
|
|
16
|
+
import XYPlotArea from './xy-plotarea';
|
|
16
17
|
|
|
17
18
|
var PolarPlotArea = (function (PolarPlotAreaBase) {
|
|
18
19
|
function PolarPlotArea () {
|
|
@@ -31,6 +32,13 @@ var PolarPlotArea = (function (PolarPlotAreaBase) {
|
|
|
31
32
|
this.appendAxis(polarAxis);
|
|
32
33
|
};
|
|
33
34
|
|
|
35
|
+
PolarPlotArea.prototype.render = function render () {
|
|
36
|
+
this.series = [].concat( this.originalSeries );
|
|
37
|
+
this.createTrendlineSeries();
|
|
38
|
+
|
|
39
|
+
PolarPlotAreaBase.prototype.render.call(this);
|
|
40
|
+
};
|
|
41
|
+
|
|
34
42
|
PolarPlotArea.prototype.valueAxisOptions = function valueAxisOptions (defaults) {
|
|
35
43
|
return deepExtend(defaults, {
|
|
36
44
|
majorGridLines: { type: ARC },
|
|
@@ -43,6 +51,15 @@ var PolarPlotArea = (function (PolarPlotAreaBase) {
|
|
|
43
51
|
this.axisY = this.valueAxis;
|
|
44
52
|
};
|
|
45
53
|
|
|
54
|
+
PolarPlotArea.prototype.trendlineFactory = function trendlineFactory (options, series) {
|
|
55
|
+
var trendline = XYPlotArea.prototype.trendlineFactory.call(this, options, series);
|
|
56
|
+
if (trendline) {
|
|
57
|
+
trendline.type = POLAR_LINE;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return trendline;
|
|
61
|
+
};
|
|
62
|
+
|
|
46
63
|
PolarPlotArea.prototype.appendChart = function appendChart (chart, pane) {
|
|
47
64
|
this.valueAxisRangeTracker.update(chart.yAxisRanges);
|
|
48
65
|
|
|
@@ -124,6 +141,8 @@ setDefaultOptions(PolarPlotArea, {
|
|
|
124
141
|
yAxis: {}
|
|
125
142
|
});
|
|
126
143
|
|
|
127
|
-
deepExtend(PolarPlotArea.prototype, PlotAreaEventsMixin
|
|
144
|
+
deepExtend(PolarPlotArea.prototype, PlotAreaEventsMixin, {
|
|
145
|
+
seriesValues: XYPlotArea.prototype.seriesValues
|
|
146
|
+
});
|
|
128
147
|
|
|
129
|
-
export default PolarPlotArea;
|
|
148
|
+
export default PolarPlotArea;
|
|
@@ -30,6 +30,7 @@ var RadarPlotArea = (function (PolarPlotAreaBase) {
|
|
|
30
30
|
this.categoryAxis = categoryAxis;
|
|
31
31
|
this.appendAxis(categoryAxis);
|
|
32
32
|
this.aggregateCategories();
|
|
33
|
+
this.createTrendlineSeries();
|
|
33
34
|
this.createCategoryAxesLabels();
|
|
34
35
|
};
|
|
35
36
|
|
|
@@ -65,6 +66,15 @@ var RadarPlotArea = (function (PolarPlotAreaBase) {
|
|
|
65
66
|
return currentSeries;
|
|
66
67
|
};
|
|
67
68
|
|
|
69
|
+
RadarPlotArea.prototype.trendlineFactory = function trendlineFactory (options, series) {
|
|
70
|
+
var trendline = CategoricalPlotArea.prototype.trendlineFactory.call(this, options, series);
|
|
71
|
+
if (trendline) {
|
|
72
|
+
trendline.type = RADAR_LINE;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return trendline;
|
|
76
|
+
};
|
|
77
|
+
|
|
68
78
|
RadarPlotArea.prototype.createCharts = function createCharts () {
|
|
69
79
|
var series = this.filterVisibleSeries(this.series);
|
|
70
80
|
var pane = this.panes[0];
|
|
@@ -163,7 +173,8 @@ var RadarPlotArea = (function (PolarPlotAreaBase) {
|
|
|
163
173
|
deepExtend(RadarPlotArea.prototype, PlotAreaEventsMixin, {
|
|
164
174
|
appendChart: CategoricalPlotArea.prototype.appendChart,
|
|
165
175
|
aggregateSeries: CategoricalPlotArea.prototype.aggregateSeries,
|
|
166
|
-
seriesSourcePoints: CategoricalPlotArea.prototype.seriesSourcePoints
|
|
176
|
+
seriesSourcePoints: CategoricalPlotArea.prototype.seriesSourcePoints,
|
|
177
|
+
seriesValues: CategoricalPlotArea.prototype.seriesValues
|
|
167
178
|
});
|
|
168
179
|
|
|
169
180
|
setDefaultOptions(RadarPlotArea, {
|
|
@@ -173,4 +184,4 @@ setDefaultOptions(RadarPlotArea, {
|
|
|
173
184
|
valueAxis: {}
|
|
174
185
|
});
|
|
175
186
|
|
|
176
|
-
export default RadarPlotArea;
|
|
187
|
+
export default RadarPlotArea;
|
|
@@ -5,12 +5,12 @@ import ScatterChart from '../scatter-charts/scatter-chart';
|
|
|
5
5
|
import ScatterLineChart from '../scatter-charts/scatter-line-chart';
|
|
6
6
|
import BubbleChart from '../bubble-chart/bubble-chart';
|
|
7
7
|
import SeriesBinder from '../series-binder';
|
|
8
|
+
import trendlineFactory from '../trendlines/trendline-factory';
|
|
9
|
+
import scatterTrendlineRegistry from '../trendlines/scatter-trendline-registry';
|
|
8
10
|
|
|
9
11
|
import { NumericAxis, LogarithmicAxis, DateValueAxis, Point } from '../../core';
|
|
10
12
|
|
|
11
|
-
import filterSeriesByType from '../utils
|
|
12
|
-
import equalsIgnoreCase from '../utils/equals-ignore-case';
|
|
13
|
-
import singleItemOrArray from '../utils/single-item-or-array';
|
|
13
|
+
import { filterSeriesByType, equalsIgnoreCase, singleItemOrArray } from '../utils';
|
|
14
14
|
|
|
15
15
|
import { SCATTER, SCATTER_LINE, BUBBLE, LOGARITHMIC } from '../constants';
|
|
16
16
|
|
|
@@ -38,8 +38,10 @@ var XYPlotArea = (function (PlotAreaBase) {
|
|
|
38
38
|
var this$1 = this;
|
|
39
39
|
if ( panes === void 0 ) panes = this.panes;
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
this.series = [].concat( this.originalSeries );
|
|
42
|
+
this.createTrendlineSeries();
|
|
42
43
|
|
|
44
|
+
var seriesByPane = this.groupSeriesByPane();
|
|
43
45
|
for (var i = 0; i < panes.length; i++) {
|
|
44
46
|
var pane = panes[i];
|
|
45
47
|
var paneSeries = seriesByPane[pane.options.name || "default"] || [];
|
|
@@ -265,6 +267,37 @@ var XYPlotArea = (function (PlotAreaBase) {
|
|
|
265
267
|
updateAxisOptions(this.originalOptions, index, vertical, options);
|
|
266
268
|
};
|
|
267
269
|
|
|
270
|
+
XYPlotArea.prototype.trendlineFactory = function trendlineFactory$1 (options, series) {
|
|
271
|
+
var seriesValues = this.seriesValues.bind(this, series.index);
|
|
272
|
+
|
|
273
|
+
var trendline = trendlineFactory(scatterTrendlineRegistry, options.type, {
|
|
274
|
+
options: options,
|
|
275
|
+
seriesValues: seriesValues
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
if (trendline) {
|
|
279
|
+
// Inherit settings
|
|
280
|
+
trendline.xAxis = series.xAxis;
|
|
281
|
+
trendline.yAxis = series.yAxis;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return trendline;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
XYPlotArea.prototype.seriesValues = function seriesValues (seriesIx) {
|
|
288
|
+
var this$1 = this;
|
|
289
|
+
|
|
290
|
+
var result = [];
|
|
291
|
+
var currentSeries = this.series[seriesIx];
|
|
292
|
+
|
|
293
|
+
for (var pointIx = 0; pointIx < currentSeries.data.length; pointIx++) {
|
|
294
|
+
var data = this$1.bindPoint(currentSeries, pointIx);
|
|
295
|
+
result.push({ pointIx: pointIx, valueFields: data.valueFields });
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
return result;
|
|
299
|
+
};
|
|
300
|
+
|
|
268
301
|
return XYPlotArea;
|
|
269
302
|
}(PlotAreaBase));
|
|
270
303
|
|
|
@@ -280,4 +313,4 @@ setDefaultOptions(XYPlotArea, {
|
|
|
280
313
|
|
|
281
314
|
deepExtend(XYPlotArea.prototype, PlotAreaEventsMixin);
|
|
282
315
|
|
|
283
|
-
export default XYPlotArea;
|
|
316
|
+
export default XYPlotArea;
|