UNPKG

ag-charts-community

Version:

Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue

69 lines 3.45 kB
"use strict"; 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 __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var series_1 = require("../series"); var chartAxis_1 = require("../../chartAxis"); var seriesMarker_1 = require("../seriesMarker"); var value_1 = require("../../../util/value"); var CartesianSeries = /** @class */ (function (_super) { __extends(CartesianSeries, _super); function CartesianSeries() { var _a; var _this = _super !== null && _super.apply(this, arguments) || this; _this.directionKeys = (_a = {}, _a[chartAxis_1.ChartAxisDirection.X] = ['xKey'], _a[chartAxis_1.ChartAxisDirection.Y] = ['yKey'], _a); return _this; } /** * Note: we are passing `isContinuousX` and `isContinuousY` into this method because it will * typically be called inside a loop and this check only needs to happen once. * @param x A domain value to be plotted along the x-axis. * @param y A domain value to be plotted along the y-axis. * @param isContinuousX Typically this will be the value of `xAxis.scale instanceof ContinuousScale`. * @param isContinuousY Typically this will be the value of `yAxis.scale instanceof ContinuousScale`. * @returns `[x, y]`, if both x and y are valid domain values for their respective axes/scales, or `undefined`. */ CartesianSeries.prototype.checkDomainXY = function (x, y, isContinuousX, isContinuousY) { var isValidDatum = (isContinuousX && value_1.isContinuous(x) || value_1.isDiscrete(x)) && (isContinuousY && value_1.isContinuous(y) || value_1.isDiscrete(y)); return isValidDatum ? [x, y] : undefined; }; /** * Note: we are passing the xAxis and yAxis because the calling code is supposed to make sure * that series has both of them defined, and also to avoid one level of indirection, * e.g. `this.xAxis!.inRange(x)`, both of which are suboptimal in tight loops where this method is used. * @param x A range value to be plotted along the x-axis. * @param y A range value to be plotted along the y-axis. * @param xAxis The series' x-axis. * @param yAxis The series' y-axis. * @returns */ CartesianSeries.prototype.checkRangeXY = function (x, y, xAxis, yAxis) { return !isNaN(x) && !isNaN(y) && xAxis.inRange(x) && yAxis.inRange(y); }; return CartesianSeries; }(series_1.Series)); exports.CartesianSeries = CartesianSeries; var CartesianSeriesMarker = /** @class */ (function (_super) { __extends(CartesianSeriesMarker, _super); function CartesianSeriesMarker() { return _super !== null && _super.apply(this, arguments) || this; } return CartesianSeriesMarker; }(seriesMarker_1.SeriesMarker)); exports.CartesianSeriesMarker = CartesianSeriesMarker; //# sourceMappingURL=cartesianSeries.js.map