scichart
Version:
Fast WebGL JavaScript Charting Library and Framework
80 lines (79 loc) • 3.92 kB
JavaScript
;
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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TriangleSeriesInfo = void 0;
var TriangleSeriesDrawMode_1 = require("../../../types/TriangleSeriesDrawMode");
var SeriesInfo_1 = require("./SeriesInfo");
var TriangleSeriesInfo = /** @class */ (function (_super) {
__extends(TriangleSeriesInfo, _super);
function TriangleSeriesInfo(renderableSeries, hitTestInfo, drawMode, polygonVertices) {
var _this = this;
var _a, _b;
_this = _super.call(this, renderableSeries, hitTestInfo) || this;
_this.drawMode = drawMode;
_this.vertices = drawMode === TriangleSeriesDrawMode_1.ETriangleSeriesDrawMode.Polygon ? polygonVertices : 3;
if (((_a = hitTestInfo.xValues) === null || _a === void 0 ? void 0 : _a.length) === _this.vertices && ((_b = hitTestInfo.yValues) === null || _b === void 0 ? void 0 : _b.length) === _this.vertices) {
_this.xValues = __spreadArray([], hitTestInfo.xValues, true);
_this.yValues = __spreadArray([], hitTestInfo.yValues, true);
}
return _this;
}
Object.defineProperty(TriangleSeriesInfo.prototype, "formattedXValues", {
get: function () {
var _this = this;
if (!this.xValues)
return [];
return this.xValues.map(function (xVal) { return _this.getXCursorFormattedValue(xVal); });
},
enumerable: false,
configurable: true
});
Object.defineProperty(TriangleSeriesInfo.prototype, "formattedYValues", {
get: function () {
var _this = this;
if (!this.yValues)
return [];
return this.yValues.map(function (yVal) { return _this.getYCursorFormattedValue(yVal); });
},
enumerable: false,
configurable: true
});
TriangleSeriesInfo.prototype.getValuesWithLabels = function (title, xLabel, yLabel, isXYGrouped) {
var res = _super.prototype.getValuesWithLabels.call(this, title, xLabel, yLabel, isXYGrouped);
res.push(this.concatValueWithLabel(this.dataSeriesIndex.toFixed(0), "Index"));
var xFormattedValues = this.formattedXValues;
var yFormattedValues = this.formattedYValues;
for (var i = 0; i < xFormattedValues.length; i++) {
var labelIndex = i + 1;
var x = xFormattedValues[i];
var y = yFormattedValues[i];
res.push(this.concatTwoValuesWithLabels(x, y, "".concat(xLabel).concat(labelIndex), "".concat(yLabel).concat(labelIndex)));
}
return res;
};
return TriangleSeriesInfo;
}(SeriesInfo_1.SeriesInfo));
exports.TriangleSeriesInfo = TriangleSeriesInfo;