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 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 122× 122× 122× 1× 82× 82× 82× 82× 82× 82× 82× 82× 82× 82× 82× 82× 82× 82× 82× 82× 82× 648× 648× 2× 646× 646× 646× 82× 82× 82× 82× 82× 644× 644× 644× 644× 644× 644× 644× 644× 24× 24× 24× 644× 644× 644× 644× 644× 644× 620× 24× 644× 644× 643× 563× 563× 563× 563× 563× 563× 563× 80× 3× 3× 3× 77× 77× 77× 80× 643× 80× 80× 80× 80× 80× 643× 1× 1× 1× 82× 82× 82× 82× 64× 64× 82× 81× 1× 80× 80× 80× 80× 80× 80× 80× 565× 564× 564× 564× 564× 21× 21× 21× 564× 564× 564× 484× 484× 484× 484× 484× 484× 484× 484× 80× 3× 3× 77× 77× 1× 564× 80× 1× 1× 1× 1× 1× 2× 1× 1× 1× 1× 1× 1× 12× 12× 12× 12× 12× 12× 12× 12× 8× 40× 20× 20× 8× 4× 1× 2× 2× 1× 41750× 1× 1× 1× | /* istanbul ignore next */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); define(["require", "exports", "../../common/utils/helper", "@syncfusion/ej2-svg-base", "./spline-base"], function (require, exports, helper_1, ej2_svg_base_1, spline_base_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var SplineRangeAreaSeries = (function (_super) { __extends(SplineRangeAreaSeries, _super); function SplineRangeAreaSeries() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.borderDirection = ''; return _this; } SplineRangeAreaSeries.prototype.render = function (series, xAxis, yAxis, inverted, pointAnimate, pointUpdate) { var point; var direction = ''; var closed = undefined; var firstPoint = null; var pt; var betweenPt1; var betweenPt2; var highControlPt1; var highControlPt2; var realPoint = []; var points = []; var Index = 0; var borderWidth = series.border.width ? series.border.width : 0; var borderColor = series.border.color ? series.border.color : series.interior; var lastPoint = ''; realPoint = this.filterEmptyPoints(series); for (var i = 0; i < realPoint.length; i++) { point = realPoint[i]; if (point.x === null || point.x === '') { continue; } else { point.index = Index; Index++; points.push(point); } } var previous; var next; var visiblePoint = this.enableComplexProperty(series); var length = visiblePoint.length; for (var i = 0; i < length; i++) { point = visiblePoint[i]; point.regions = []; point.symbolLocations = []; next = this.getNextIndex(points, point.index - 1, series); previous = this.getPreviousIndex(points, point.index - 1, series); var lowPoint = Math.min(point.low, point.high); var highPoint = Math.max(point.low, point.high); if (yAxis.isAxisInverse) { var temp = lowPoint; lowPoint = highPoint; highPoint = temp; } var lowPtCoordinate = helper_1.getPoint(point.xValue, lowPoint, xAxis, yAxis, inverted); var highPtCoordinate = helper_1.getPoint(point.xValue, highPoint, xAxis, yAxis, inverted); point.symbolLocations.push(highPtCoordinate); point.symbolLocations.push(lowPtCoordinate); var rect1 = new ej2_svg_base_1.Rect(Math.min(lowPtCoordinate.x, highPtCoordinate.x), Math.min(lowPtCoordinate.y, highPtCoordinate.y), Math.max(Math.abs(highPtCoordinate.x - lowPtCoordinate.x), series.marker.width), Math.max(Math.abs(highPtCoordinate.y - lowPtCoordinate.y), series.marker.width)); if (!inverted) { rect1.x -= series.marker.width / 2; } else { rect1.y -= series.marker.width / 2; } point.regions.push(rect1); if (point.visible && helper_1.withInRange(visiblePoint[previous], point, visiblePoint[next], series)) { if (firstPoint) { highControlPt1 = series.drawPoints[previous].controlPoint1; highControlPt2 = series.drawPoints[previous].controlPoint2; pt = helper_1.getPoint(point.xValue, point.high > point.low ? point.high : point.low, xAxis, yAxis, inverted); betweenPt1 = helper_1.getPoint(highControlPt1.x, highControlPt1.y, xAxis, yAxis, inverted); betweenPt2 = helper_1.getPoint(highControlPt2.x, highControlPt2.y, xAxis, yAxis, inverted); direction = direction.concat('C ' + betweenPt1.x + ' ' + betweenPt1.y + ' ' + betweenPt2.x + ' ' + betweenPt2.y + ' ' + pt.x + ' ' + pt.y + ' '); this.borderDirection += 'C ' + betweenPt1.x + ' ' + betweenPt1.y + ' ' + betweenPt2.x + ' ' + betweenPt2.y + ' ' + pt.x + ' ' + pt.y + ' '; } else { if (yAxis.isAxisInverse) { direction = direction.concat('M ' + (highPtCoordinate.x) + ' ' + (highPtCoordinate.y) + ' ' + 'L ' + (lowPtCoordinate.x) + ' ' + (lowPtCoordinate.y) + ' '); this.borderDirection += 'M ' + (highPtCoordinate.x) + ' ' + (highPtCoordinate.y) + ' '; lastPoint = 'L ' + (lowPtCoordinate.x) + ' ' + (lowPtCoordinate.y); } else { direction = direction.concat('M ' + (lowPtCoordinate.x) + ' ' + (lowPtCoordinate.y) + ' ' + 'L ' + (highPtCoordinate.x) + ' ' + (highPtCoordinate.y) + ' '); this.borderDirection += 'M ' + (highPtCoordinate.x) + ' ' + (highPtCoordinate.y) + ' '; lastPoint = 'L ' + (lowPtCoordinate.x) + ' ' + (lowPtCoordinate.y); } closed = false; } if ((i + 1 < visiblePoint.length && !visiblePoint[i + 1].visible) || i === visiblePoint.length - 1) { direction = this.closeSplineRangeAreaPath(visiblePoint, point, series, direction, i, xAxis, yAxis, inverted); this.borderDirection += lastPoint; lastPoint = ''; direction = direction.concat(' ' + 'Z'); closed = true; } firstPoint = point; } else { Iif (closed === false && i !== 0) { direction = this.closeSplineRangeAreaPath(visiblePoint, point, series, direction, i, xAxis, yAxis, inverted); closed = true; } firstPoint = null; point.symbolLocations = []; } } var name1 = series.category === 'Indicator' ? series.chart.element.id + '_Indicator_' + series.index + '_' + series.name : series.chart.element.id + '_Series_' + series.index; var options = new ej2_svg_base_1.PathOption(name1, series.interior, 0, 'transparent', series.opacity, series.dashArray, direction); this[pointAnimate ? 'addPath' : 'appendLinePath'](options, series, ''); if (series.border.width !== 0) { this[pointAnimate ? 'addPath' : 'appendLinePath'](new ej2_svg_base_1.PathOption(series.chart.element.id + '_Series_border_' + series.index, 'transparent', borderWidth, borderColor, 1, series.border.dashArray, this.borderDirection), series, ''); this.borderDirection = ''; } if (!pointUpdate) { this.renderMarker(series); } }; SplineRangeAreaSeries.prototype.closeSplineRangeAreaPath = function (visiblePoint, point, series, direction, i, xAxis, yAxis, inverted) { var firstPoint = null; var pt; var betweenPt1; var betweenPt2; var lowControlPt1; var lowControlPt2; for (var j = i; j > 0; j--) { if (visiblePoint[j].visible) { point = visiblePoint[j]; var low = Math.min(point.low, point.high); var high = Math.max(point.low, point.high); if (yAxis.isAxisInverse) { var temp = low; low = high; high = temp; } var lowPtCoordinate = helper_1.getPoint(point.xValue, low, xAxis, yAxis, inverted); var highPtCoordinate = helper_1.getPoint(point.xValue, high, xAxis, yAxis, inverted); if (firstPoint) { lowControlPt1 = series.lowDrawPoints[j].controlPoint1; lowControlPt2 = series.lowDrawPoints[j].controlPoint2; pt = helper_1.getPoint(point.xValue, point.low < point.high ? point.low : point.high, xAxis, yAxis, inverted); betweenPt1 = helper_1.getPoint(lowControlPt1.x, lowControlPt1.y, xAxis, yAxis, inverted); betweenPt2 = helper_1.getPoint(lowControlPt2.x, lowControlPt2.y, xAxis, yAxis, inverted); Eif (!isNaN(betweenPt1.y) || !isNaN(betweenPt2.y)) { direction = direction.concat('C ' + betweenPt2.x + ' ' + betweenPt2.y + ' ' + betweenPt1.x + ' ' + betweenPt1.y + ' ' + pt.x + ' ' + pt.y + ' '); this.borderDirection += 'C ' + betweenPt2.x + ' ' + betweenPt2.y + ' ' + betweenPt1.x + ' ' + betweenPt1.y + ' ' + pt.x + ' ' + pt.y + ' '; } } else { if (yAxis.isAxisInverse) { direction = direction.concat('L ' + (highPtCoordinate.x) + ' ' + (highPtCoordinate.y) + ' '); this.borderDirection += 'M ' + (highPtCoordinate.x) + ' ' + (highPtCoordinate.y) + ' '; } else { direction = direction.concat('L ' + (lowPtCoordinate.x) + ' ' + (lowPtCoordinate.y) + ' '); this.borderDirection += 'M ' + (lowPtCoordinate.x) + ' ' + (lowPtCoordinate.y) + ' '; } } } else { break; } firstPoint = point; } return direction; }; SplineRangeAreaSeries.prototype.updateDirection = function (series, point) { this.render(series, series.xAxis, series.yAxis, series.chart.requireInvertedAxis, false, true); var _loop_1 = function (i) { Eif (series.marker && series.marker.visible) { series.points[i].symbolLocations.map(function (location, index) { series.chart.markerRender.renderMarker(series, series.points[point[i]], location, index, true); }); } Eif (series.marker.dataLabel.visible && series.chart.dataLabelModule) { series.chart.dataLabelModule.commonId = series.chart.element.id + '_Series_' + series.index + '_Point_'; series.chart.dataLabelModule.renderDataLabel(series, series.points[point[i]], null, series.marker.dataLabel); } }; for (var i = 0; i < point.length; i++) { _loop_1(i); } }; SplineRangeAreaSeries.prototype.addPath = function (options, series, clipRect) { var points = this.appendPathElement(options, series, clipRect); Eif (points.previousDirection !== '' && options.d !== '') { var startPathCommands = points.previousDirection.match(/[MLHVCSQTAZ][^MLHVCSQTAZ]*/g); var endPathCommands = (options.d).match(/[MLHVCSQTAZ][^MLHVCSQTAZ]*/g); var maxLength = Math.max(startPathCommands.length, endPathCommands.length); var minLength = Math.min(startPathCommands.length, endPathCommands.length); Iif (startPathCommands.length < endPathCommands.length) { for (var i = startPathCommands.length; i < endPathCommands.length; i++) { if (endPathCommands.length !== startPathCommands.length) { startPathCommands.splice(((startPathCommands.length) / 2) + 1, 0, 'C ' + ((startPathCommands[(startPathCommands.length - 1) / 2].split(' ')).slice(5, 7)).join(' ') + ' ' + ((startPathCommands[(startPathCommands.length - 1) / 2].split(' ')).slice(5, 7)).join(' ') + ' ' + ((startPathCommands[(startPathCommands.length - 1) / 2].split(' ')).slice(5, 7)).join(' ')); startPathCommands.splice((startPathCommands.length / 2) + 2, 0, 'C ' + (startPathCommands[(startPathCommands.length / 2) + 1].split(' ')).slice(1, 3).join(' ') + ' ' + (startPathCommands[(startPathCommands.length / 2) + 1].split(' ')).slice(1, 3).join(' ') + ' ' + (startPathCommands[(startPathCommands.length / 2) + 1].split(' ')).slice(1, 3).join(' ')); } } helper_1.animateAddPoints(points.element, options.d, series.chart.redraw, startPathCommands.join(' '), this.chart.duration); } else if (startPathCommands.length > endPathCommands.length) { for (var i = minLength; i < maxLength; i++) { if (endPathCommands.length !== startPathCommands.length) { endPathCommands.splice(2, 0, 'C ' + endPathCommands[1].split(' ').slice(-3).join(' ') + endPathCommands[1].split(' ').slice(-3).join(' ') + endPathCommands[1].split(' ').slice(-3).join(' ')); endPathCommands.splice(endPathCommands.length - 1, 0, 'C ' + endPathCommands[endPathCommands.length - 2].split(' ').slice(-4).join(' ') + endPathCommands[endPathCommands.length - 2].split(' ').slice(-4).join(' ') + endPathCommands[endPathCommands.length - 2].split(' ').slice(-4).join(' ')); } } helper_1.animateAddPoints(points.element, endPathCommands.join(''), series.chart.redraw, points.previousDirection, this.chart.duration, options.d); } else { helper_1.animateAddPoints(points.element, options.d, series.chart.redraw, points.previousDirection, this.chart.duration); } } }; SplineRangeAreaSeries.prototype.doAnimation = function (series) { var option = series.animation; this.doLinearAnimation(series, option); }; SplineRangeAreaSeries.prototype.getModuleName = function () { return 'SplineRangeAreaSeries'; }; SplineRangeAreaSeries.prototype.destroy = function () { }; return SplineRangeAreaSeries; }(spline_base_1.SplineBase)); exports.SplineRangeAreaSeries = SplineRangeAreaSeries; }); |