prodap-chatbot-domain
Version:
Classes utilizadas na resposta de todas as Intents do Assistente Virtual
54 lines • 1.99 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ChartTypes_1 = require("./ChartTypes");
const ChartAbstract_1 = require("./ChartAbstract");
const legends_1 = require("./legends");
const ChartData_1 = require("./ChartData");
class LineChart extends ChartAbstract_1.default {
constructor({ chartProps, titleAxisX, titleAxisY, yMax, yMin, xAxisBolders, interpolation, showTooltipLabels, data, legendList, backgroundZones, }) {
super(chartProps || {}, ChartTypes_1.default.LINE_CHART, '');
this.data = [];
this.legendList = [];
this.legendData = [];
this.chartColorScale = [];
this.chartData = [];
this.backgroundZones = [];
this.titleAxisX = titleAxisX;
this.titleAxisY = titleAxisY;
this.yMax = yMax;
this.yMin = yMin;
this.xAxisBolders = xAxisBolders;
this.interpolation = interpolation;
this.showTooltipLabels = showTooltipLabels;
this.chart = true;
this.backgroundZones = backgroundZones || [];
const values = data;
if (values) {
values.forEach((value) => {
const newValue = value.map((item) => new ChartData_1.default(item));
this.chartData.push(newValue);
});
}
const legendValues = legendList;
if (legendValues) {
legendValues.forEach((value) => {
this.legendData.push(new legends_1.default(value));
this.chartColorScale.push(value.color);
});
}
}
addData(...rows) {
this.data = this.data.concat(rows);
return this;
}
addLegend(...legend) {
this.legendList = this.legendList.concat(legend);
return this;
}
addBackgroundZone(...zones) {
this.backgroundZones = this.backgroundZones.concat(zones);
return this;
}
}
exports.default = LineChart;
//# sourceMappingURL=LineChart.js.map