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 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 62× 62× 62× 1× 99× 99× 99× 775× 775× 1× 777× 777× 777× 777× 777× 777× 760× 760× 760× 760× 760× 760× 760× 760× 760× 760× 760× 760× 760× 760× 760× 1× 1× 1× 2× 2× 2× 2× 1× 2280× 776× 776× 1504× 1504× 1× 760× 760× 760× 1× 760× 760× 16× 16× 16× 744× 744× 744× 760× 760× 760× 760× 760× 760× 760× 760× 1× 41750× 1× 5× 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", "./column-base"], function (require, exports, helper_1, ej2_svg_base_1, column_base_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var HiloOpenCloseSeries = (function (_super) { __extends(HiloOpenCloseSeries, _super); function HiloOpenCloseSeries() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.sideBySideInfo = []; return _this; } HiloOpenCloseSeries.prototype.render = function (series) { this.sideBySideInfo[series.index] = this.getSideBySideInfo(series); var borderWidth = Math.max(series.border.width, 2); for (var _i = 0, _a = series.points; _i < _a.length; _i++) { var point = _a[_i]; this.renderPoint(series, point, this.sideBySideInfo[series.index], borderWidth); } }; HiloOpenCloseSeries.prototype.renderPoint = function (series, point, sideBySideInfo, borderWidth) { point.symbolLocations = []; point.regions = []; var highLowRect; var index1; var index2; if (point.visible && helper_1.withInRange(series.points[point.index - 1], point, series.points[point.index + 1], series)) { highLowRect = this.getRectangle(point.xValue + sideBySideInfo.start, Math.max(point.high, point.low), point.xValue + sideBySideInfo.end, Math.min(point.high, point.low), series); point.regions.push(this.getRectangle(point.xValue + sideBySideInfo.median, Math.max(point.high, point.low), point.xValue + sideBySideInfo.median, Math.min(point.high, point.low), series)); this.updateTickRegion(!series.chart.requireInvertedAxis, point.regions[0], borderWidth); point.regions.push(this.getRectangle(point.xValue + sideBySideInfo.start, Math.max(point.open, point.close), point.xValue + sideBySideInfo.median, Math.max(point.open, point.close), series)); point.regions.push(this.getRectangle(point.xValue + sideBySideInfo.median, Math.min(point.open, point.close), point.xValue + sideBySideInfo.end, Math.min(point.open, point.close), series)); var argsData = this.triggerPointRenderEvent(series, point); Eif (!argsData.cancel) { this.updateSymbolLocation(point, point.regions[0], series); index1 = point.open > point.close ? 1 : 2; index2 = point.open > point.close ? 2 : 1; var open_1 = { x: point.regions[index1].x, y: point.regions[index1].y }; var close_1 = { x: point.regions[index2].x, y: point.regions[index2].y }; this.drawHiloOpenClosePath(series, point, open_1, close_1, highLowRect, argsData); } this.updateTickRegion(series.chart.requireInvertedAxis, point.regions[1], borderWidth); this.updateTickRegion(series.chart.requireInvertedAxis, point.regions[2], borderWidth); } }; HiloOpenCloseSeries.prototype.updateDirection = function (series, point) { var borderWidth = Math.max(series.border.width, 2); for (var i = 0; i < point.length; i++) { this.renderPoint(series, series.points[point[i]], this.sideBySideInfo[series.index], borderWidth); 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); } } }; HiloOpenCloseSeries.prototype.updateTickRegion = function (horizontal, region, borderWidth) { if (horizontal) { region.x -= borderWidth / 2; region.width = borderWidth; } else { region.y -= borderWidth / 2; region.height = borderWidth; } }; HiloOpenCloseSeries.prototype.triggerPointRenderEvent = function (series, point) { var fill = (point.open <= point.close) ? series.bearFillColor || series.chart.themeStyle.bearFillColor : series.bullFillColor || series.chart.themeStyle.bullFillColor; var border = { color: series.border.color, width: Math.max(series.border.width, 1) }; return this.triggerEvent(series, point, fill, border); }; HiloOpenCloseSeries.prototype.drawHiloOpenClosePath = function (series, point, open, close, rect, argsData) { var direction; if (series.chart.requireInvertedAxis) { direction = ('M' + ' ' + (rect.x) + ' ' + (rect.y + rect.height / 2) + ' ' + 'L' + ' ' + (rect.x + rect.width) + ' ' + (rect.y + rect.height / 2) + ' '); direction += ('M' + ' ' + (open.x) + ' ' + (rect.y + rect.height / 2) + ' ' + 'L' + ' ' + (open.x) + ' ' + (rect.y + rect.height) + ' '); direction += ('M' + ' ' + (close.x) + ' ' + (rect.y + rect.height / 2) + ' ' + 'L' + ' ' + (close.x) + ' ' + (rect.y) + ' '); } else { direction = ('M' + ' ' + (rect.x + rect.width / 2) + ' ' + (rect.y + rect.height) + ' ' + 'L' + ' ' + (rect.x + rect.width / 2) + ' ' + (rect.y) + ' '); direction += ('M' + ' ' + (rect.x) + ' ' + (open.y) + ' ' + 'L' + ' ' + (rect.x + rect.width / 2 + argsData.border.width / 2) + ' ' + (open.y) + ' '); direction += ('M' + ' ' + (rect.x + rect.width / 2 - argsData.border.width / 2) + ' ' + (close.y) + ' ' + 'L' + ' ' + (rect.x + rect.width) + ' ' + (close.y) + ' '); } var options = new ej2_svg_base_1.PathOption(series.chart.element.id + '_Series_' + series.index + '_Point_' + ((series.removedPointIndex !== null && series.removedPointIndex <= point.index) ? (point.index + 1) : point.index), argsData.fill, argsData.border.width, argsData.fill, series.opacity, series.dashArray, direction); helper_1.pathAnimation(helper_1.getElement(options.id), direction, series.chart.redraw, null, series.chart.duration); var element = series.chart.renderer.drawPath(options, new Int32Array([series.clipRect.x, series.clipRect.y])); Iif (series.removedPointIndex !== null && series.removedPointIndex <= point.index) { element.id = series.chart.element.id + '_Series_' + series.index + '_Point_' + point.index; } element.setAttribute('role', 'img'); element.setAttribute('aria-label', point.x.toString() + ':' + point.high.toString() + ':' + point.low.toString() + ':' + point.close.toString() + ':' + point.open.toString()); Eif (!series.chart.enableCanvas) { series.seriesElement.appendChild(element); } }; HiloOpenCloseSeries.prototype.getModuleName = function () { return 'HiloOpenCloseSeries'; }; HiloOpenCloseSeries.prototype.doAnimation = function (series) { this.animate(series); }; HiloOpenCloseSeries.prototype.destroy = function () { }; return HiloOpenCloseSeries; }(column_base_1.ColumnBase)); exports.HiloOpenCloseSeries = HiloOpenCloseSeries; }); |