prodap-chatbot-domain
Version:
Classes utilizadas na resposta de todas as Intents do Assistente Virtual
47 lines • 1.66 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 BarChart extends ChartAbstract_1.default {
constructor({ barWidth, chartProps, titleAxisX, titleAxisY, minimumBars, rules, data, }) {
super(chartProps, ChartTypes_1.default.BAR_CHART, '');
this.data = [];
this.rules = [];
this.chartColorScale = [];
this.legendData = [];
this.chartData = [];
this.barWidth = barWidth;
this.titleAxisX = titleAxisX;
this.titleAxisY = titleAxisY;
this.minimumBars = minimumBars;
this.data = [];
this.legendData = [];
this.rules = [];
this.chartColorScale = [];
const values = data;
const dataRules = rules;
if (values) {
dataRules === null || dataRules === void 0 ? void 0 : dataRules.forEach((r) => {
this.rules.push(r);
r.subtitle = r.label;
this.legendData.push(new legends_1.default(r));
});
values.forEach((value) => {
this.chartData.push(new ChartData_1.default(value));
this.chartColorScale.push(value.color);
});
}
}
addData(...rows) {
this.data = this.data.concat(rows);
return this;
}
addRule(...rules) {
this.rules = this.rules.concat(rules);
return this;
}
}
exports.default = BarChart;
//# sourceMappingURL=BarChart.js.map