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 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 57× 1× 93× 93× 93× 93× 93× 93× 93× 709× 709× 709× 709× 694× 694× 694× 694× 694× 694× 694× 694× 694× 694× 694× 694× 694× 1× 2082× 710× 710× 1372× 1372× 1× 694× 694× 694× 1× 694× 694× 694× 16× 16× 16× 678× 678× 678× 694× 694× 694× 694× 1× 20665× 1× 4× 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", "./column-base"], function (require, exports, helper_1, column_base_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var HiloOpenCloseSeries = (function (_super) { __extends(HiloOpenCloseSeries, _super); function HiloOpenCloseSeries() { return _super !== null && _super.apply(this, arguments) || this; } HiloOpenCloseSeries.prototype.render = function (series) { var highLowRect; var open; var close; var sideBySideInfo = this.getSideBySideInfo(series); var argsData; var borderWidth = Math.max(series.border.width, 2); 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)) { 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)); argsData = this.triggerPointRenderEvent(series, point); Eif (!argsData.cancel) { this.updateSymbolLocation(point, point.regions[0], series); var open_1 = { x: point.regions[1].x, y: point.regions[1].y }; var close_1 = { x: point.regions[2].x, y: point.regions[2].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.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.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; var options; 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) + ' ' + (open.y) + ' '); direction += ('M' + ' ' + (rect.x + rect.width / 2) + ' ' + (close.y) + ' ' + 'L' + ' ' + (rect.x + rect.width) + ' ' + (close.y) + ' '); } options = new helper_1.PathOption(series.chart.element.id + '_Series_' + series.index + '_Point_' + point.index, argsData.fill, argsData.border.width, argsData.fill, series.opacity, series.dashArray, direction); var element = series.chart.renderer.drawPath(options); element.setAttribute('aria-label', point.x.toString() + ':' + point.high.toString() + ':' + point.low.toString() + ':' + point.close.toString() + ':' + point.open.toString()); series.seriesElement.appendChild(element); }; HiloOpenCloseSeries.prototype.getModuleName = function () { return 'HiloOpenCloseSeries'; }; HiloOpenCloseSeries.prototype.doAnimation = function (series) { this.animate(series); }; HiloOpenCloseSeries.prototype.destroy = function (chart) { }; return HiloOpenCloseSeries; }(column_base_1.ColumnBase)); exports.HiloOpenCloseSeries = HiloOpenCloseSeries; }); |