| 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 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 57× 1× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 93× 6× 87× 93× 643× 643× 643× 643× 643× 643× 610× 126× 126× 126× 126× 126× 126× 610× 484× 484× 484× 484× 126× 126× 126× 126× 610× 610× 610× 643× 33× 33× 99× 99× 99× 99× 8× 8× 91× 99× 99× 33× 33× 33× 93× 93× 91× 91× 91× 91× 91× 91× 91× 91× 93× 511× 511× 511× 511× 511× 511× 33× 511× 451× 451× 451× 451× 418× 93× 93× 93× 93× 2× 2× 93× 92× 1× 1× 1× 1× 1× 6× 6× 6× 1× 5× 5× 5× 5× 5× 5× 5× 5× 4× 45× 40× 40× 4× 1× 1× 2× 2× 1× 1× 44694× 1× 33× 33× 66× 33× 33× 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", "./line-base"], function (require, exports, helper_1, ej2_svg_base_1, line_base_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var StackingStepAreaSeries = (function (_super) { __extends(StackingStepAreaSeries, _super); function StackingStepAreaSeries() { return _super !== null && _super.apply(this, arguments) || this; } StackingStepAreaSeries.prototype.render = function (stackSeries, xAxis, yAxis, isInverted, pointAnimate, pointUpdate) { var currentPointLocation; var secondPoint; var start = null; var direction = ''; var borderDirection = ''; var stackedvalue = stackSeries.stackedValues; var visiblePoint = this.enableComplexProperty(stackSeries); var origin = Math.max(stackSeries.yAxis.visibleRange.min, stackedvalue.startValues[0]); var pointsLength = visiblePoint.length; var options; var point; var point2; var point3; var xValue; var lineLength; var prevPoint = null; var validIndex; var startPoint = 0; var pointIndex; if (xAxis.valueType === 'Category' && xAxis.labelPlacement === 'BetweenTicks') { lineLength = 0.5; } else { lineLength = 0; } for (var i = 0; i < pointsLength; i++) { point = visiblePoint[i]; xValue = point.xValue; point.symbolLocations = []; point.regions = []; pointIndex = point.index; if (point.visible && helper_1.withInRange(visiblePoint[i - 1], point, visiblePoint[i + 1], stackSeries)) { if (start === null) { start = new helper_1.ChartLocation(xValue, 0); currentPointLocation = helper_1.getPoint(xValue - lineLength, origin, xAxis, yAxis, isInverted); direction += ('M' + ' ' + (currentPointLocation.x) + ' ' + (currentPointLocation.y) + ' '); currentPointLocation = helper_1.getPoint(xValue - lineLength, stackedvalue.endValues[pointIndex], xAxis, yAxis, isInverted); direction += ('L' + ' ' + (currentPointLocation.x) + ' ' + (currentPointLocation.y) + ' '); borderDirection += ('M' + ' ' + (currentPointLocation.x) + ' ' + (currentPointLocation.y) + ' '); } if (prevPoint != null) { currentPointLocation = helper_1.getPoint(point.xValue, stackedvalue.endValues[pointIndex], xAxis, yAxis, isInverted); secondPoint = helper_1.getPoint(prevPoint.xValue, stackedvalue.endValues[prevPoint.index], xAxis, yAxis, isInverted); direction += (this.GetStepLineDirection(currentPointLocation, secondPoint, stackSeries.step, 'L', stackSeries, false)); borderDirection += (this.GetStepLineDirection(currentPointLocation, secondPoint, stackSeries.step, 'L', stackSeries, true)); } else Eif (stackSeries.emptyPointSettings.mode === 'Gap') { currentPointLocation = helper_1.getPoint(point.xValue, stackedvalue.endValues[pointIndex], xAxis, yAxis, isInverted); direction += 'L' + ' ' + (currentPointLocation.x) + ' ' + (currentPointLocation.y) + ' '; borderDirection += 'L' + ' ' + (currentPointLocation.x) + ' ' + (currentPointLocation.y) + ' '; } visiblePoint[i].symbolLocations.push(helper_1.getPoint(visiblePoint[i].xValue, stackedvalue.endValues[pointIndex], xAxis, yAxis, isInverted)); visiblePoint[i].regions.push(new ej2_svg_base_1.Rect(visiblePoint[i].symbolLocations[0].x - stackSeries.marker.width, visiblePoint[i].symbolLocations[0].y - stackSeries.marker.height, 2 * stackSeries.marker.width, 2 * stackSeries.marker.height)); prevPoint = point; } if (visiblePoint[i + 1] && (!visiblePoint[i + 1].visible && start !== null) && stackSeries.emptyPointSettings.mode !== 'Drop') { var previousPointIndex = void 0; for (var j = i; j >= startPoint; j--) { pointIndex = visiblePoint[j].index; previousPointIndex = j === 0 ? 0 : visiblePoint[j - 1].index; currentPointLocation = helper_1.getPoint(visiblePoint[pointIndex].xValue, stackedvalue.startValues[pointIndex], xAxis, yAxis, isInverted); if (j !== 0 && (stackedvalue.startValues[pointIndex] < stackedvalue.startValues[previousPointIndex] || stackedvalue.startValues[pointIndex] > stackedvalue.startValues[previousPointIndex])) { direction = direction.concat('L' + ' ' + (currentPointLocation.x) + ' ' + (currentPointLocation.y) + ' '); secondPoint = helper_1.getPoint(visiblePoint[previousPointIndex].xValue, stackedvalue.startValues[previousPointIndex], xAxis, yAxis, isInverted); } else { secondPoint = helper_1.getPoint(visiblePoint[pointIndex].xValue, stackedvalue.startValues[pointIndex], xAxis, yAxis, isInverted); } Eif (visiblePoint[previousPointIndex].visible) { direction = direction.concat(this.GetStepLineDirection(secondPoint, currentPointLocation, this.prevStep, 'L', stackSeries)); } } startPoint = i + 2; start = null; prevPoint = null; } } Eif (direction !== '') { if (pointsLength > 1) { pointIndex = visiblePoint[pointsLength - 1].index; start = { 'x': visiblePoint[pointsLength - 1].xValue + lineLength, 'y': stackedvalue.endValues[pointIndex] }; secondPoint = helper_1.getPoint(start.x, start.y, xAxis, yAxis, isInverted); direction += ('L' + ' ' + (secondPoint.x) + ' ' + (secondPoint.y) + ' '); borderDirection += ('L' + ' ' + (secondPoint.x) + ' ' + (secondPoint.y) + ' '); start = { 'x': visiblePoint[pointsLength - 1].xValue + lineLength, 'y': stackedvalue.startValues[pointIndex] }; secondPoint = helper_1.getPoint(start.x, start.y, xAxis, yAxis, isInverted); direction += ('L' + ' ' + (secondPoint.x) + ' ' + (secondPoint.y) + ' '); } for (var j = pointsLength - 1; j >= startPoint; j--) { var index = void 0; Eif (visiblePoint[j].visible) { pointIndex = visiblePoint[j].index; point2 = helper_1.getPoint(visiblePoint[j].xValue, stackedvalue.startValues[pointIndex], xAxis, yAxis, isInverted); direction = direction.concat('L' + ' ' + (point2.x) + ' ' + (point2.y) + ' '); } if (j !== 0 && !visiblePoint[j - 1].visible) { index = this.getNextVisiblePointIndex(visiblePoint, j); } if (j !== 0 && visiblePoint[j].visible) { validIndex = index ? index : j - 1; pointIndex = index ? visiblePoint[index].index : visiblePoint[j - 1].index; point3 = helper_1.getPoint(visiblePoint[validIndex].xValue, stackedvalue.startValues[pointIndex], xAxis, yAxis, isInverted); if (!(j !== 0 && !visiblePoint[j - 1].visible)) { direction = direction.concat(this.GetStepLineDirection(point3, point2, this.prevStep, 'L', stackSeries)); } } } this.prevStep = stackSeries.step === 'Right' ? 'Left' : stackSeries.step === 'Left' ? 'Right' : stackSeries.step; options = new ej2_svg_base_1.PathOption(stackSeries.chart.element.id + '_Series_' + stackSeries.index, stackSeries.interior, 0, 'transparent', stackSeries.opacity, stackSeries.dashArray, direction); this[pointAnimate ? 'addPath' : 'appendLinePath'](options, stackSeries, ''); if (stackSeries.border.width !== 0) { options = new ej2_svg_base_1.PathOption(stackSeries.chart.element.id + '_Series_border_' + stackSeries.index, 'transparent', stackSeries.border.width, stackSeries.border.color ? stackSeries.border.color : stackSeries.interior, 1, stackSeries.border.dashArray, borderDirection); this[pointAnimate ? 'addPath' : 'appendLinePath'](options, stackSeries, ''); } if (!pointUpdate) { this.renderMarker(stackSeries); } } }; StackingStepAreaSeries.prototype.updateDirection = function (series, point) { for (var i = 0; i < series.xAxis.series.length; i++) { var stackSeries = series.xAxis.series[i]; this.render(stackSeries, stackSeries.xAxis, stackSeries.yAxis, stackSeries.chart.requireInvertedAxis, false, true); for (var j = 0; j < point.length; j++) { Eif (stackSeries.marker && stackSeries.marker.visible) { stackSeries.chart.markerRender.renderMarker(stackSeries, stackSeries.points[point[j]], stackSeries.points[point[j]].symbolLocations[0], null, true); } Iif (stackSeries.marker.dataLabel.visible && stackSeries.chart.dataLabelModule) { stackSeries.chart.dataLabelModule.commonId = stackSeries.chart.element.id + '_Series_' + stackSeries.index + '_Point_'; stackSeries.chart.dataLabelModule. renderDataLabel(stackSeries, stackSeries.points[point[j]], null, stackSeries.marker.dataLabel); } } } }; StackingStepAreaSeries.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((Math.floor((startPathCommands.length / 2)) - 1), 0, startPathCommands[Math.floor((startPathCommands.length / 2)) - 1], startPathCommands[Math.floor((startPathCommands.length / 2)) - 1]); startPathCommands.splice((Math.floor((startPathCommands.length / 2)) + 2), 0, startPathCommands[Math.floor((startPathCommands.length / 2)) + 2], startPathCommands[Math.floor((startPathCommands.length / 2)) + 2], startPathCommands[Math.floor((startPathCommands.length / 2)) + 2]); } } 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, endPathCommands[2]); endPathCommands.splice(endPathCommands.length - 3, 0, endPathCommands[endPathCommands.length - 3]); } } 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); } } }; StackingStepAreaSeries.prototype.doAnimation = function (series) { var option = series.animation; this.doLinearAnimation(series, option); }; StackingStepAreaSeries.prototype.destroy = function () { }; StackingStepAreaSeries.prototype.getModuleName = function () { return 'StackingStepAreaSeries'; }; StackingStepAreaSeries.prototype.getNextVisiblePointIndex = function (points, j) { var index; for (index = j - 1; index >= 0; index--) { if (!points[index].visible) { continue; } else { return index; } } return 0; }; return StackingStepAreaSeries; }(line_base_1.LineBase)); exports.StackingStepAreaSeries = StackingStepAreaSeries; }); |