/**
* Copyright (c) 2019
*
* @summary charts
* @author Elitza Vasileva
* @author Bernhard Pointner
*/
class VisChart {
constructor(_id, _title, _subtitle, _dummy_id, _parent, _chartType, _is_cat_list, _dimension, _group, _description, _filters, _selected, _hovered, _filterCustomData, _updateAll, _previewAll) {
// id of svg
this.id = _id;
// title of vis
this.title = _title;
// sub title of vis
this.subtitle = _subtitle;
// element container
this.dummy_id = _dummy_id;
// parent
this.parent = _parent;
// chart type
this.chartType = _chartType;
// dimension
this.dimension = _dimension;
// group
this.group = _group;
// chart type
this.description = _description;
// sets type of chart - if true then special chart because of multiple dimensions for one single chart
this.is_cat_list = _is_cat_list;
// filters consisting of active filter and preview filters
this.filters = _filters;
// selected and hovered array - must same order as group
this.selected = _selected;
this.hovered = _hovered;
// filters consisting of active filter and preview filters
this.filterCustomData = _filterCustomData;
// chart
this.chart = null;
// function to update all charts
this.updateAll = _updateAll;
// function to preview all charts
this.previewAll = _previewAll;
}
/**
* Initializes a chart
*/
initChart() {
// init chart
this.chart = initChart(this.chartType, this.parent, this.dummy_id, this.id, this.title, this.subtitle, this.is_cat_list, this.dimension, this.group, this.description, this.filters, this.selected, this.hovered, this.filterCustomData, this.updateAll.bind(this), this.previewAll.bind(this));
this.draw();
}
/**
* Draws the chart
*/
draw() {
this.chart.draw();
}
/**
* Updates the chart
*/
update() {
this.chart.update();
}
/**
* Shows preview of the chart when hovering or clicking
* @param reset
*/
preview(reset) {
this.chart.preview(reset);
}
}