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 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 152× 1× 161× 161× 76× 85× 1× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 84× 336260× 336260× 84× 645× 645× 645× 645× 629× 629× 629× 629× 629× 629× 629× 629× 629× 629× 459× 459× 459× 459× 459× 459× 459× 459× 459× 459× 459× 459× 459× 459× 459× 437× 22× 459× 170× 170× 170× 170× 170× 170× 170× 130× 40× 170× 629× 629× 629× 629× 629× 567× 62× 84× 1× 629× 629× 629× 629× 1× 84× 84× 84× 84× 84× 156× 156× 146× 84× 146× 111× 32× 17× 17× 15× 79× 49× 49× 30× 35× 84× 146× 1× 183× 183× 183× 183× 183× 183× 11× 79× 79× 4× 75× 75× 172× 717× 1× 717× 717× 717× 717× 717× 29626× 28909× 28909× 28909× 717× 717× 717× 1× 20665× 1× 1× 1× | /* istanbul ignore next */ var __extends = (this && this.__extends) || (function () { var 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 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", "../axis/polar-radar-panel", "../../common/model/constants", "@syncfusion/ej2-base"], function (require, exports, helper_1, polar_radar_panel_1, constants_1, ej2_base_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var PolarSeries = (function (_super) { __extends(PolarSeries, _super); function PolarSeries() { return _super !== null && _super.apply(this, arguments) || this; } PolarSeries.prototype.render = function (series) { var seriesType = helper_1.firstToLowerCase(series.drawType); if (series.drawType.indexOf('Column') > -1) { this.columnDrawTypeRender(series); } else { series.chart[seriesType + 'SeriesModule'].render(series, series.xAxis, series.yAxis, series.chart.requireInvertedAxis); } }; PolarSeries.prototype.columnDrawTypeRender = function (series) { var visiblePoints = series.points; var rect; var options; var argsData; var startAngle; var endAngle; var itemCurrentXPos; var radius; var pointStartAngle; var pointEndAngle; var x1; var x2; var y1; var y2; var startValue; var endValue; var innerRadius; var centerX = (series.clipRect.width / 2) + series.clipRect.x; var dStartX; var dStartY; var centerY = (series.clipRect.height / 2) + series.clipRect.y; var dEndX; var dEndY; var axisInversed = series.xAxis.isInversed ? 1 : 0; var direction = ''; var sumofYValues = 0; var interval = (series.points[1] ? series.points[1].xValue : 2 * series.points[0].xValue) - series.points[0].xValue; var ticks = series.xAxis.valueType === 'Category' && series.xAxis.labelPlacement === 'BetweenTicks' ? 0 : interval / 2; var rangeInterval = series.xAxis.valueType === 'DateTime' ? series.xAxis.dateTimeInterval : 1; var min = series.xAxis.actualRange.min; var inversedValue; this.getSeriesPosition(series); var position = series.xAxis.isInversed ? (series.rectCount - 1 - series.position) : series.position; var ticksbwtLabel = series.xAxis.valueType === 'Category' && series.xAxis.labelPlacement === 'BetweenTicks' ? 0.5 : 0.5 - (series.rectCount / 2); do { sumofYValues += rangeInterval; min += rangeInterval; } while (min <= series.xAxis.actualRange.max - (series.xAxis.valueType === 'Category' ? 0 : 1)); for (var _i = 0, _a = series.points; _i < _a.length; _i++) { var point = _a[_i]; point.symbolLocations = []; point.regions = []; if (point.visible && helper_1.withInRange(series.points[point.index - 1], point, series.points[point.index + 1], series)) { inversedValue = series.xAxis.isInversed ? (series.xAxis.visibleRange.max - point.xValue) : point.xValue - series.xAxis.visibleRange.min; itemCurrentXPos = (inversedValue) + ((interval / series.rectCount) * position - ticks) + (sumofYValues / 360 * series.xAxis.startAngle); itemCurrentXPos = (((itemCurrentXPos) / (sumofYValues))); startAngle = 2 * Math.PI * (itemCurrentXPos + series.xAxis.startAngle); endAngle = 2 * Math.PI * ((itemCurrentXPos + series.xAxis.startAngle) + (interval / series.rectCount) / (sumofYValues)); pointStartAngle = startAngle; pointEndAngle = endAngle; startAngle = (startAngle - 0.5 * Math.PI); endAngle = (endAngle - 0.5 * Math.PI) - 0.000001; if (series.drawType === 'StackingColumn' || series.drawType === 'RangeColumn') { startValue = series.drawType === 'RangeColumn' ? point.low : series.stackedValues.startValues[point.index]; endValue = series.drawType === 'RangeColumn' ? point.high : series.stackedValues.endValues[point.index]; endValue = (series.yAxis.valueType === 'Logarithmic' ? helper_1.logBase(endValue === 0 ? 1 : endValue, series.yAxis.logBase) : endValue); endValue = endValue > series.yAxis.actualRange.max ? series.yAxis.actualRange.max : endValue; radius = startValue === endValue ? 0 : series.chart.radius * helper_1.valueToCoefficient(endValue, series.yAxis); x1 = centerX + radius * Math.cos(startAngle); x2 = centerX + radius * Math.cos(endAngle); y1 = centerY + radius * Math.sin(startAngle); y2 = centerY + radius * Math.sin(endAngle); innerRadius = series.chart.radius * helper_1.valueToCoefficient((startValue === 0 && series.yAxis.visibleRange.min !== 0) ? series.yAxis.visibleRange.min : startValue, series.yAxis); dStartX = centerX + innerRadius * Math.cos(startAngle); dStartY = centerY + innerRadius * Math.sin(startAngle); dEndX = centerX + innerRadius * Math.cos(endAngle); dEndY = centerY + innerRadius * Math.sin(endAngle); if (series.type === 'Polar') { direction = ('M' + ' ' + x1 + ' ' + y1 + ' ' + 'A' + ' ' + radius + ' ' + radius + ' ' + '0' + ' ' + '0' + ' ' + 1 + ' ' + x2 + ' ' + y2 + ' ' + 'L' + ' ' + dEndX + ' ' + dEndY + ' ' + 'A' + ' ' + innerRadius + ' ' + innerRadius + ' ' + '1' + ' ' + '0' + ' ' + '0' + ' ' + dStartX + ' ' + dStartY + ' ' + 'z'); } else { direction = ('M' + ' ' + x1 + ' ' + y1 + ' ' + 'L' + ' ' + x2 + ' ' + y2 + ' ' + 'L' + dEndX + ' ' + dEndY + ' ' + 'L' + ' ' + dStartX + ' ' + dStartY + ' ' + 'z'); } point.regionData = new helper_1.PolarArc(pointStartAngle, pointEndAngle, innerRadius, radius, itemCurrentXPos); } else { endValue = point.yValue > series.yAxis.actualRange.max ? series.yAxis.actualRange.max : point.yValue; radius = series.chart.radius * helper_1.valueToCoefficient((series.yAxis.valueType === 'Logarithmic' ? helper_1.logBase(endValue, series.yAxis.logBase) : endValue), series.yAxis); x1 = centerX + radius * Math.cos(startAngle); x2 = centerX + radius * Math.cos(endAngle); y1 = centerY + radius * Math.sin(startAngle); y2 = centerY + radius * Math.sin(endAngle); if (series.type === 'Polar') { direction = ('M' + ' ' + x1 + ' ' + y1 + ' ' + 'A' + ' ' + radius + ' ' + radius + ' ' + '0' + ' ' + '0' + ' ' + 1 + ' ' + x2 + ' ' + y2 + ' ' + 'L' + ' ' + centerX + ' ' + centerY + ' ' + 'z'); } else { direction = ('M' + ' ' + x1 + ' ' + y1 + ' ' + 'L' + ' ' + x2 + ' ' + y2 + ' ' + 'L' + ' ' + centerX + ' ' + centerY + ' ' + 'z'); } point.regionData = new helper_1.PolarArc(pointStartAngle, pointEndAngle, 0, radius, itemCurrentXPos); } argsData = this.triggerEvent(series.chart, series, point); options = new helper_1.PathOption(series.chart.element.id + '_Series_' + series.index + '_Point_' + point.index, argsData.fill, argsData.border.width, argsData.border.color, series.opacity, series.dashArray, direction); Eif (!argsData.cancel) { this.appendLinePath(options, series, ''); if (series.type === 'Polar') { point.symbolLocations.push({ x: centerX + radius * Math.cos((startAngle + (endAngle - startAngle) / 2)), y: centerY + radius * Math.sin((startAngle + (endAngle - startAngle) / 2)) }); } else { point.symbolLocations.push({ x: (x1 + x2) / 2, y: (y1 + y2) / 2 }); } } } } series.isRectSeries = true; }; PolarSeries.prototype.triggerEvent = function (chart, series, point) { var argsData = { cancel: false, name: constants_1.pointRender, series: series, point: point, fill: series.setPointColor(point, series.interior), border: series.setBorderColor(point, { width: series.border.width, color: series.border.color }) }; chart.trigger(constants_1.pointRender, argsData); point.color = argsData.fill; return argsData; }; PolarSeries.prototype.getSeriesPosition = function (series) { var chart = series.chart; var seriesCollection = []; var stackingGroup = []; var vSeries = { rectCount: 0, position: null }; for (var _i = 0, _a = chart.visibleSeries; _i < _a.length; _i++) { var series_1 = _a[_i]; if (series_1.visible && (series_1.type === 'Polar' || series_1.type === 'Radar') && series_1.drawType.indexOf('Column') !== -1) { seriesCollection.push(series_1); } } seriesCollection.forEach(function (series) { if (series.drawType.indexOf('Stacking') !== -1) { if (series.stackingGroup) { if (stackingGroup[series.stackingGroup] === undefined) { series.position = vSeries.rectCount; stackingGroup[series.stackingGroup] = vSeries.rectCount++; } else { series.position = stackingGroup[series.stackingGroup]; } } else { if (vSeries.position === null) { series.position = vSeries.rectCount; vSeries.position = vSeries.rectCount++; } else { series.position = vSeries.position; } } } else { series.position = vSeries.rectCount++; } }); seriesCollection.forEach(function (value) { value.rectCount = vSeries.rectCount; }); }; PolarSeries.prototype.doAnimation = function (series) { var option = series.animation; var duration = series.animation.duration; var delay = series.animation.delay; var rectElements = series.seriesElement.childNodes; var count = 1; if (series.drawType === 'Scatter') { for (var _i = 0, _a = series.points; _i < _a.length; _i++) { var point = _a[_i]; if (!point.symbolLocations.length || !rectElements[count]) { continue; } helper_1.markerAnimate(rectElements[count], delay, duration, series, point.index, point.symbolLocations[0], false); count++; } } else { for (count = 1; count < rectElements.length; count++) { this.doPolarRadarAnimation(rectElements[count], delay, duration, series); } } }; PolarSeries.prototype.doPolarRadarAnimation = function (animateElement, delay, duration, series) { var chartcenterX = series.clipRect.width / 2 + series.clipRect.x; var chartcenterY = series.clipRect.height / 2 + series.clipRect.y; var elementHeight = 0; animateElement.style.visibility = 'hidden'; new ej2_base_1.Animation({}).animate(animateElement, { duration: duration, delay: delay, progress: function (args) { if (args.timeStamp > args.delay) { args.element.style.visibility = 'visible'; elementHeight = ((args.timeStamp - args.delay) / args.duration); animateElement.setAttribute('transform', 'translate(' + chartcenterX + ' ' + chartcenterY + ') scale(' + elementHeight + ') translate(' + (-chartcenterX) + ' ' + (-chartcenterY) + ')'); } }, end: function (model) { animateElement.style.visibility = 'visible'; animateElement.removeAttribute('transform'); series.chart.trigger('animationComplete', { series: series }); } }); }; PolarSeries.prototype.getModuleName = function () { return 'PolarSeries'; }; PolarSeries.prototype.destroy = function (chart) { }; return PolarSeries; }(polar_radar_panel_1.PolarRadarPanel)); exports.PolarSeries = PolarSeries; }); |