From 977dfd920fcb99c1b6fe93b3e2ddae20b071bc58 Mon Sep 17 00:00:00 2001 From: Alberto Fernandez Date: Wed, 12 Sep 2018 16:40:50 -0400 Subject: [PATCH] Add optional param to `update` to customize the `responsiveOptions` --- src/scripts/base.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/scripts/base.js b/src/scripts/base.js index 88d68304..69a5272a 100644 --- a/src/scripts/base.js +++ b/src/scripts/base.js @@ -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...]] * @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 || []; @@ -35,6 +36,10 @@ }); } + if(responsiveOptions) { + this.responsiveOptions = responsiveOptions; + } + if(options) { this.options = Chartist.extend({}, override ? this.options : this.defaultOptions, options);