src/charts/stackedArea.js
import Chart from './base/Chart';
import * as defaultProperties from '../utils/defaults/stackedArea';
/**
* StackedArea implementation. This charts belongs to 'Flow' family.
* It is inherited on 'Flow'.
*/
export default class StackedArea extends Chart {
/**
* StackedArea constructor. It needs (at least) one argument to start: data.
* Optionally, you can indicate a second argument that includes all the chart options. If you
* do not specify this, '_default' object is used by default.
*/
constructor(data, config) {
super(data, config);
let keys = Object.keys(defaultProperties.defaults);
this._initializeAPI(keys);
}
/**
* Renders a data object on the chart.
* @param {Object} data This object contains the data that will be rendered on chart. If you do not
* specify this param, this.data will be used instead.
*/
draw(data = this.data) {
super.draw(data);
}
/**
* Add new data to the current graph. If it is empty, this creates a new one.
* @param {Object} datum data to be rendered
*/
keepDrawing(datum) {
if (!this.datum) {
this.datum = [];
}
this.datum = this.datum.concat(datum);
super.draw(this.datum);
}
}