UNPKG

ag-charts-community

Version:

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

67 lines 3.28 kB
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 __()); }; })(); import { Series } from "../series"; import { ChartAxisDirection } from "../../chartAxis"; import { SeriesMarker } from "../seriesMarker"; import { isContinuous, isDiscrete } from "../../../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[ChartAxisDirection.X] = ['xKey'], _a[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 && isContinuous(x) || isDiscrete(x)) && (isContinuousY && isContinuous(y) || 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)); export { CartesianSeries }; var CartesianSeriesMarker = /** @class */ (function (_super) { __extends(CartesianSeriesMarker, _super); function CartesianSeriesMarker() { return _super !== null && _super.apply(this, arguments) || this; } return CartesianSeriesMarker; }(SeriesMarker)); export { CartesianSeriesMarker }; //# sourceMappingURL=cartesianSeries.js.map