Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/scripts/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
* @param {Object} [data] Optional data you'd like to set for the chart before it will update. If not specified the update method will use the data that is already configured with the chart.
* @param {Object} [options] Optional options you'd like to add to the previous options for the chart before it will update. If not specified the update method will use the options that have been already configured with the chart.
* @param {Boolean} [override] If set to true, the passed options will be used to extend the options that have been configured already. Otherwise the chart default options will be used as the base
* @param {Array} [responsiveOptions] Optional array of responsive option arrays which are a media query and options object pair => [[mediaQueryString, optionsObject],[more...]]. Always overrides any already configured responsiveOptions.
* @memberof Chartist.Base
*/
function update(data, options, override) {
function update(data, options, override, responsiveOptions) {
if(data) {
this.data = data || {};
this.data.labels = this.data.labels || [];
Expand All @@ -35,9 +36,15 @@
});
}

if(responsiveOptions) {
this.responsiveOptions = responsiveOptions;
}

if(options) {
this.options = Chartist.extend({}, override ? this.options : this.defaultOptions, options);
}

if(options || responsiveOptions) {
// If chartist was not initialized yet, we just set the options and leave the rest to the initialization
// Otherwise we re-create the optionsProvider at this point
if(!this.initializeTimeoutId) {
Expand Down