1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530 | 1×
1×
1×
1×
1×
131×
131×
52×
79×
131×
1×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
131×
1×
132×
132×
132×
132×
131×
1×
768×
768×
768×
768×
768×
768×
768×
768×
768×
768×
768×
768×
768×
768×
1×
93×
93×
93×
93×
93×
93×
93×
93×
3693×
4×
3693×
3693×
3693×
3693×
3693×
93×
93×
12×
12×
7×
7×
5×
5×
81×
81×
81×
34×
47×
93×
1×
131×
131×
125×
125×
37×
37×
22×
22×
13×
13×
19×
19×
17×
17×
17×
17×
125×
75×
1×
22×
22×
22×
22×
762×
762×
762×
762×
762×
22×
22×
1×
17×
17×
17×
17×
17×
557×
557×
557×
557×
557×
557×
17×
17×
1×
19×
19×
19×
19×
709×
709×
709×
709×
19×
1×
17×
17×
17×
17×
17×
154×
154×
154×
154×
154×
154×
154×
17×
17×
1×
37×
37×
37×
37×
2220×
2220×
2220×
2220×
37×
37×
1×
13×
13×
13×
13×
13×
463×
463×
463×
463×
463×
13×
1×
17×
17×
17×
17×
17×
17×
17×
17×
17×
17×
17×
17×
17×
17×
17×
1×
17×
17×
17×
17×
17×
17×
17×
17×
17×
17×
17×
17×
17×
1×
19×
19×
19×
19×
19×
19×
19×
19×
19×
709×
709×
709×
709×
3029×
83×
3029×
3029×
709×
19×
19×
19×
19×
19×
19×
79×
79×
79×
19×
19×
709×
709×
709×
709×
5349×
147×
5349×
5349×
5349×
709×
19×
19×
79×
79×
387×
387×
79×
19×
19×
19×
1×
13×
13×
13×
13×
13×
13×
13×
13×
13×
463×
463×
1049×
1049×
463×
463×
447×
447×
463×
13×
1×
37×
37×
37×
37×
37×
37×
37×
37×
37×
37×
1×
22×
22×
22×
22×
22×
22×
22×
22×
22×
22×
22×
22×
1×
19×
19×
19×
19×
19×
19×
690×
690×
19×
79×
19×
19×
19×
60×
19×
19×
19×
41×
41×
41×
41×
79×
19×
1×
79×
79×
79×
387×
387×
79×
1×
19×
19×
19×
19×
19×
19×
19×
19×
19×
79×
79×
19×
19×
79×
79×
79×
79×
79×
387×
233×
233×
1289×
519×
519×
519×
1289×
387×
79×
79×
79×
79×
79×
79×
79×
79×
79×
387×
387×
79×
79×
79×
387×
308×
308×
308×
308×
1804×
1804×
308×
387×
79×
19×
19×
79×
79×
19×
1×
132×
132×
132×
132×
132×
131×
132×
132×
132×
1×
1×
41538×
1×
1×
| define(["require", "exports", "../series/chart-series", "../../common/utils/helper", "@syncfusion/ej2-base"], function (require, exports, chart_series_1, helper_1, ej2_base_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Trendlines = (function () {
function Trendlines() {
}
Trendlines.prototype.initSeriesCollection = function (trendline, chart) {
var trendLineSeries = new chart_series_1.Series(trendline, 'targetSeries', {}, true);
if (trendline.type === 'Linear' || trendline.type === 'MovingAverage') {
trendLineSeries.type = 'Line';
}
else {
trendLineSeries.type = 'Spline';
}
this.setSeriesProperties(trendLineSeries, trendline, trendline.type, trendline.fill, trendline.width, chart);
};
Trendlines.prototype.setSeriesProperties = function (series, trendline, name, fill, width, chart) {
series.name = trendline.name;
series.xName = 'x';
series.yName = 'y';
series.fill = fill || 'blue';
series.width = width;
series.dashArray = trendline.dashArray;
series.clipRectElement = trendline.clipRectElement;
series.points = [];
series.enableTooltip = trendline.enableTooltip;
series.index = trendline.index;
series.sourceIndex = trendline.sourceIndex;
series.interior = series.fill;
series.animation = trendline.animation;
series.legendShape = 'HorizontalLine';
series.marker = trendline.marker;
series.category = 'TrendLine';
series.chart = chart;
series.xMin = Infinity;
series.xMax = -Infinity;
series.yMin = Infinity;
series.yMax = -Infinity;
series.xData = [];
series.yData = [];
trendline.targetSeries = series;
Iif (chart.isBlazor) {
trendline.targetSeries.border = {};
trendline.targetSeries.connector = {};
}
};
Trendlines.prototype.createTrendLineElements = function (chart, trendline, index, element, clipRectElement) {
trendline.trendLineElement = element;
trendline.targetSeries.clipRectElement = clipRectElement;
trendline.targetSeries.seriesElement = element;
if (chart.trendLineElements) {
chart.trendLineElements.appendChild(trendline.trendLineElement);
}
};
Trendlines.prototype.getDataPoint = function (x, y, series, index) {
var trendPoint = new chart_series_1.Points();
trendPoint.x = series.xAxis.valueType === 'DateTime' ? new Date(Number(x)) : x;
trendPoint.y = y;
trendPoint.xValue = Number(x);
trendPoint.color = series.fill;
trendPoint.index = index;
trendPoint.yValue = Number(y);
trendPoint.visible = true;
series.xMin = Math.min(series.xMin, trendPoint.xValue);
series.yMin = Math.min(series.yMin, trendPoint.yValue);
series.xMax = Math.max(series.xMax, trendPoint.xValue);
series.yMax = Math.max(series.yMax, trendPoint.yValue);
series.xData.push(trendPoint.xValue);
return trendPoint;
};
Trendlines.prototype.findSlopeIntercept = function (xValues, yValues, trendline, points) {
var xAvg = 0;
var yAvg = 0;
var xyAvg = 0;
var xxAvg = 0;
var index = 0;
var slope = 0;
var intercept = 0;
while (index < points.length) {
if (isNaN(yValues[index])) {
yValues[index] = ((yValues[index - 1] + yValues[index + 1]) / 2);
}
xAvg += xValues[index];
yAvg += yValues[index];
xyAvg += xValues[index] * yValues[index];
xxAvg += xValues[index] * xValues[index];
index++;
}
var type = trendline.type;
if (trendline.intercept && (type === 'Linear' || type === 'Exponential')) {
intercept = trendline.intercept;
switch (type) {
case 'Linear':
slope = ((xyAvg) - (trendline.intercept * xAvg)) / xxAvg;
break;
case 'Exponential':
slope = ((xyAvg) - (Math.log(Math.abs(trendline.intercept)) * xAvg)) / xxAvg;
break;
}
}
else {
slope = ((points.length * xyAvg) - (xAvg * yAvg)) / ((points.length * xxAvg) - (xAvg * xAvg));
slope = (type === 'Linear' ? slope : Math.abs(slope));
if (type === 'Exponential' || type === 'Power') {
intercept = Math.exp((yAvg - (slope * xAvg)) / points.length);
}
else {
intercept = (yAvg - (slope * xAvg)) / points.length;
}
}
return { slope: slope, intercept: intercept };
};
Trendlines.prototype.initDataSource = function (trendline) {
var points = trendline.points;
if (points && points.length) {
var trendlineSeries = trendline.targetSeries;
switch (trendline.type) {
case 'Linear':
this.setLinearRange(points, trendline, trendlineSeries);
break;
case 'Exponential':
this.setExponentialRange(points, trendline, trendlineSeries);
break;
case 'MovingAverage':
this.setMovingAverageRange(points, trendline, trendlineSeries);
break;
case 'Polynomial':
this.setPolynomialRange(points, trendline, trendlineSeries);
break;
case 'Power':
this.setPowerRange(points, trendline, trendlineSeries);
break;
case 'Logarithmic':
this.setLogarithmicRange(points, trendline, trendlineSeries);
break;
}
if (trendline.type !== 'Linear' && trendline.type !== 'MovingAverage') {
trendlineSeries.chart.splineSeriesModule.findSplinePoint(trendlineSeries);
}
}
};
Trendlines.prototype.setExponentialRange = function (points, trendline, series) {
var xValue = [];
var yValue = [];
var index = 0;
while (index < points.length) {
var point = points[index];
var yDataValue = point.yValue ? Math.log(point.yValue) : 0;
xValue.push(point.xValue);
yValue.push(yDataValue);
index++;
}
var slopeIntercept = this.findSlopeIntercept(xValue, yValue, trendline, points);
series.points = this.getExponentialPoints(trendline, points, xValue, yValue, series, slopeIntercept);
};
Trendlines.prototype.setLogarithmicRange = function (points, trendline, series) {
var xLogValue = [];
var yLogValue = [];
var xPointsLgr = [];
var index = 0;
while (index < points.length) {
var point = points[index];
var xDataValue = point.xValue ? Math.log(point.xValue) : 0;
xPointsLgr.push(point.xValue);
xLogValue.push(xDataValue);
yLogValue.push(point.yValue);
index++;
}
var slopeIntercept = this.findSlopeIntercept(xLogValue, yLogValue, trendline, points);
series.points = this.getLogarithmicPoints(trendline, points, xPointsLgr, yLogValue, series, slopeIntercept);
};
Trendlines.prototype.setPolynomialRange = function (points, trendline, series) {
var xPolyValues = [];
var yPolyValues = [];
var index = 0;
while (index < points.length) {
var point = points[index];
xPolyValues.push(point.xValue);
yPolyValues.push(point.yValue);
index++;
}
series.points = this.getPolynomialPoints(trendline, points, xPolyValues, yPolyValues, series);
};
Trendlines.prototype.setPowerRange = function (points, trendline, series) {
var xValues = [];
var yValues = [];
var powerPoints = [];
var index = 0;
while (index < points.length) {
var point = points[index];
var xDataValue = point.xValue ? Math.log(point.xValue) : 0;
var yDataValue = point.yValue ? Math.log(point.yValue) : 0;
powerPoints.push(point.xValue);
xValues.push(xDataValue);
yValues.push(yDataValue);
index++;
}
var slopeIntercept = this.findSlopeIntercept(xValues, yValues, trendline, points);
series.points = this.getPowerPoints(trendline, points, powerPoints, yValues, series, slopeIntercept);
};
Trendlines.prototype.setLinearRange = function (points, trendline, series) {
var xValues = [];
var yValues = [];
var index = 0;
while (index < points.length) {
var point = points[index];
xValues.push(point.xValue);
yValues.push(point.yValue);
index++;
}
var slopeIntercept = this.findSlopeIntercept(xValues, yValues, trendline, points);
series.points = this.getLinearPoints(trendline, points, xValues, yValues, series, slopeIntercept);
};
Trendlines.prototype.setMovingAverageRange = function (points, trendline, series) {
var xValues = [];
var yValues = [];
var xAvgValues = [];
var index = 0;
while (index < points.length) {
var point = points[index];
xAvgValues.push(point.xValue);
xValues.push(index + 1);
yValues.push(point.yValue);
index++;
}
series.points = this.getMovingAveragePoints(trendline, points, xAvgValues, yValues, series);
};
Trendlines.prototype.getLogarithmicPoints = function (trendline, points, xValues, yValues, series, slopeInterceptLog) {
var midPoint = Math.round((points.length / 2));
var pts = [];
var x1Log = xValues[0] - trendline.backwardForecast;
var x1 = x1Log ? Math.log(x1Log) : 0;
var y1Log = slopeInterceptLog.intercept + (slopeInterceptLog.slope * x1);
var x2Log = xValues[midPoint - 1];
var x2 = x2Log ? Math.log(x2Log) : 0;
var y2Log = slopeInterceptLog.intercept + (slopeInterceptLog.slope * x2);
var x3Log = xValues[xValues.length - 1] + trendline.forwardForecast;
var x3 = x3Log ? Math.log(x3Log) : 0;
var y3Log = slopeInterceptLog.intercept + (slopeInterceptLog.slope * x3);
pts.push(this.getDataPoint(x1Log, y1Log, series, pts.length));
pts.push(this.getDataPoint(x2Log, y2Log, series, pts.length));
pts.push(this.getDataPoint(x3Log, y3Log, series, pts.length));
return pts;
};
Trendlines.prototype.getPowerPoints = function (trendline, points, xValues, yValues, series, slopeInterceptPower) {
var midPoint = Math.round((points.length / 2));
var pts = [];
var x1 = xValues[0] - trendline.backwardForecast;
x1 = x1 > -1 ? x1 : 0;
var y1 = slopeInterceptPower.intercept * Math.pow(x1, slopeInterceptPower.slope);
var x2 = xValues[midPoint - 1];
var y2 = slopeInterceptPower.intercept * Math.pow(x2, slopeInterceptPower.slope);
var x3 = xValues[xValues.length - 1] + trendline.forwardForecast;
var y3 = slopeInterceptPower.intercept * Math.pow(x3, slopeInterceptPower.slope);
pts.push(this.getDataPoint(x1, y1, series, pts.length));
pts.push(this.getDataPoint(x2, y2, series, pts.length));
pts.push(this.getDataPoint(x3, y3, series, pts.length));
return pts;
};
Trendlines.prototype.getPolynomialPoints = function (trendline, points, xValues, yValues, series) {
var pts = [];
var polynomialOrder = points.length <= trendline.polynomialOrder ? points.length : trendline.polynomialOrder;
polynomialOrder = Math.max(2, polynomialOrder);
polynomialOrder = Math.min(6, polynomialOrder);
trendline.polynomialOrder = polynomialOrder;
trendline.polynomialSlopes = [];
trendline.polynomialSlopes.length = trendline.polynomialOrder + 1;
var index = 0;
while (index < xValues.length) {
var xVal = xValues[index];
var yVal = yValues[index];
var subIndex = 0;
while (subIndex <= trendline.polynomialOrder) {
if (!trendline.polynomialSlopes[subIndex]) {
trendline.polynomialSlopes[subIndex] = 0;
}
trendline.polynomialSlopes[subIndex] += Math.pow(xVal, subIndex) * yVal;
++subIndex;
}
index++;
}
var numArray = [];
numArray.length = 1 + 2 * trendline.polynomialOrder;
var matrix = [];
matrix.length = trendline.polynomialOrder + 1;
var newIndex = 0;
while (newIndex < (trendline.polynomialOrder + 1)) {
matrix[newIndex] = [];
matrix[newIndex].length = 3;
newIndex++;
}
var nIndex = 0;
while (nIndex < xValues.length) {
var d = xValues[nIndex];
var num2 = 1.0;
var nIndex2 = 0;
while (nIndex2 < numArray.length) {
if (!numArray[nIndex2]) {
numArray[nIndex2] = 0;
}
numArray[nIndex2] += num2;
num2 *= d;
++nIndex2;
}
++nIndex;
}
var nnIndex = 0;
while (nnIndex <= trendline.polynomialOrder) {
var nnIndex2 = 0;
while (nnIndex2 <= trendline.polynomialOrder) {
matrix[nnIndex][nnIndex2] = numArray[nnIndex + nnIndex2];
++nnIndex2;
}
++nnIndex;
}
Iif (!this.gaussJordanElimination(matrix, trendline.polynomialSlopes)) {
trendline.polynomialSlopes = null;
}
pts = this.getPoints(trendline, points, xValues, series);
return pts;
};
Trendlines.prototype.getMovingAveragePoints = function (trendline, points, xValues, yValues, series) {
var pts = [];
var period = trendline.period >= points.length ? points.length - 1 : trendline.period;
period = period === 1 ? 1 : Math.max(2, period);
var index = 0;
var y;
var x;
var count;
var nullCount;
while (index < points.length) {
y = count = nullCount = 0;
for (var j = index; count < period; j++) {
count++;
y += yValues[j];
}
y = period - nullCount < 0 ? null : y ? y / (period - nullCount) : y;
if (!ej2_base_1.isNullOrUndefined(y) && !isNaN(y)) {
x = xValues[period - 1 + index];
pts.push(this.getDataPoint(x, y, series, pts.length));
}
index++;
}
return pts;
};
Trendlines.prototype.getLinearPoints = function (trendline, points, xValues, yValues, series, slopeInterceptLinear) {
var pts = [];
var max = xValues.indexOf(Math.max.apply(null, xValues));
var min = xValues.indexOf(Math.min.apply(null, xValues));
var x1Linear = xValues[min] - trendline.backwardForecast;
var y1Linear = slopeInterceptLinear.slope * x1Linear + slopeInterceptLinear.intercept;
var x2Linear = xValues[max] + trendline.forwardForecast;
var y2Linear = slopeInterceptLinear.slope * x2Linear + slopeInterceptLinear.intercept;
pts.push(this.getDataPoint(x1Linear, y1Linear, series, pts.length));
pts.push(this.getDataPoint(x2Linear, y2Linear, series, pts.length));
return pts;
};
Trendlines.prototype.getExponentialPoints = function (trendline, points, xValues, yValues, series, slopeInterceptExp) {
var midPoint = Math.round((points.length / 2));
var ptsExp = [];
var x1 = xValues[0] - trendline.backwardForecast;
var y1 = slopeInterceptExp.intercept * Math.exp(slopeInterceptExp.slope * x1);
var x2 = xValues[midPoint - 1];
var y2 = slopeInterceptExp.intercept * Math.exp(slopeInterceptExp.slope * x2);
var x3 = xValues[xValues.length - 1] + trendline.forwardForecast;
var y3 = slopeInterceptExp.intercept * Math.exp(slopeInterceptExp.slope * x3);
ptsExp.push(this.getDataPoint(x1, isNaN(y1) ? 0 : y1, series, ptsExp.length));
ptsExp.push(this.getDataPoint(x2, isNaN(y2) ? 0 : y2, series, ptsExp.length));
ptsExp.push(this.getDataPoint(x3, isNaN(y3) ? 0 : y3, series, ptsExp.length));
return ptsExp;
};
Trendlines.prototype.getPoints = function (trendline, points, xValues, series) {
var polynomialSlopes = trendline.polynomialSlopes;
var pts = [];
var x1 = 1;
var index = 1;
var xValue;
var yValue;
points.sort(function (a, b) { return a.xValue - b.xValue; });
xValues.sort(function (a, b) { return a - b; });
while (polynomialSlopes !== null && index <= polynomialSlopes.length) {
if (index === 1) {
xValue = xValues[0] - trendline.backwardForecast;
yValue = this.getPolynomialYValue(polynomialSlopes, xValue);
pts.push(this.getDataPoint(xValue, yValue, series, pts.length));
}
else if (index === polynomialSlopes.length) {
xValue = xValues[points.length - 1] + trendline.forwardForecast;
yValue = this.getPolynomialYValue(polynomialSlopes, xValue);
pts.push(this.getDataPoint(xValue, yValue, series, pts.length));
}
else {
x1 += (points.length + (series.xAxis.valueType === 'DateTime' ? index : trendline.forwardForecast)) / polynomialSlopes.length;
xValue = xValues[parseInt(x1.toString(), 10) - 1];
yValue = this.getPolynomialYValue(polynomialSlopes, xValue);
pts.push(this.getDataPoint(xValue, yValue, series, pts.length));
}
index++;
}
return pts;
};
Trendlines.prototype.getPolynomialYValue = function (slopes, x) {
var sum = 0;
var index = 0;
while (index < slopes.length) {
sum += slopes[index] * Math.pow(x, index);
index++;
}
return sum;
};
Trendlines.prototype.gaussJordanElimination = function (matrix, polynomialSlopes) {
var length = matrix.length;
var numArray1 = [];
var numArray2 = [];
var numArray3 = [];
numArray1.length = length;
numArray2.length = length;
numArray3.length = length;
var index = 0;
while (index < length) {
numArray3[index] = 0;
++index;
}
var index1 = 0;
while (index1 < length) {
var num1 = 0;
var index2 = 0;
var index3 = 0;
var index4 = 0;
while (index4 < length) {
if (numArray3[index4] !== 1) {
var index5 = 0;
while (index5 < length) {
if (numArray3[index5] === 0 && Math.abs(matrix[index4][index5]) >= num1) {
num1 = Math.abs(matrix[index4][index5]);
index2 = index4;
index3 = index5;
}
++index5;
}
}
++index4;
}
++numArray3[index3];
Iif (index2 !== index3) {
var index4_1 = 0;
while (index4_1 < length) {
var num2 = matrix[index2][index4_1];
matrix[index2][index4_1] = matrix[index3][index4_1];
matrix[index3][index4_1] = num2;
++index4_1;
}
var num3 = polynomialSlopes[index2];
polynomialSlopes[index2] = polynomialSlopes[index3];
polynomialSlopes[index3] = num3;
}
numArray2[index1] = index2;
numArray1[index1] = index3;
Iif (matrix[index3][index3] === 0.0) {
return false;
}
var num4 = 1.0 / matrix[index3][index3];
matrix[index3][index3] = 1.0;
var iindex4 = 0;
while (iindex4 < length) {
matrix[index3][iindex4] *= num4;
++iindex4;
}
polynomialSlopes[index3] *= num4;
var iandex4 = 0;
while (iandex4 < length) {
if (iandex4 !== index3) {
var num2 = matrix[iandex4][index3];
matrix[iandex4][index3] = 0.0;
var index5 = 0;
while (index5 < length) {
matrix[iandex4][index5] -= matrix[index3][index5] * num2;
++index5;
}
polynomialSlopes[iandex4] -= polynomialSlopes[index3] * num2;
}
++iandex4;
}
++index1;
}
var iindex1 = length - 1;
while (iindex1 >= 0) {
Iif (numArray2[iindex1] !== numArray1[iindex1]) {
var iindex2 = 0;
while (iindex2 < length) {
var num = matrix[iindex2][numArray2[iindex1]];
matrix[iindex2][numArray2[iindex1]] = matrix[iindex2][numArray1[iindex1]];
matrix[iindex2][numArray1[iindex1]] = num;
++iindex2;
}
}
--iindex1;
}
return true;
};
Trendlines.prototype.getTrendLineElements = function (series, chart) {
helper_1.findClipRect(series);
var clipRect = series.clipRect;
var clipRectElement = chart.renderer.drawClipPath(new helper_1.RectOption(chart.element.id + '_ChartTrendlineClipRect_' + series.index, 'transparent', { width: 1, color: 'Gray' }, 1, {
x: 0, y: 0, width: clipRect.width,
height: clipRect.height
}));
var element = chart.renderer.createGroup({
'id': chart.element.id + 'TrendlineSeriesGroup' + series.index,
'transform': 'translate(' + clipRect.x + ',' + clipRect.y + ')',
'clip-path': 'url(#' + chart.element.id + '_ChartTrendlineClipRect_' + series.index + ')'
});
if (element) {
element.appendChild(clipRectElement);
}
for (var _i = 0, _a = series.trendlines; _i < _a.length; _i++) {
var trendline = _a[_i];
this.createTrendLineElements(chart, trendline, trendline.index, element, clipRectElement);
}
};
Trendlines.prototype.destroy = function () {
};
Trendlines.prototype.getModuleName = function () {
return 'TrendLine';
};
return Trendlines;
}());
exports.Trendlines = Trendlines;
});
|