X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;fp=dygraph.js;h=f82285b73f56fd65f93d25e490545ab6be8b4b71;hb=1f0f434a67305ccb3d54a0bbd16a1b6d9421fffb;hp=78b45f57bea0ed903eb48cba81547778217e8822;hpb=dc836ebb77ab18a402ea4ae590059299d88b0deb;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index 78b45f5..f82285b 100644 --- a/dygraph.js +++ b/dygraph.js @@ -3602,19 +3602,25 @@ Dygraph.prototype.visibility = function() { }; /** - * Changes the visiblity of a series. + * Changes the visibility of one or more series. * - * @param {number} num the series index + * @param {number|number[]} num the series index or an array of series indices * @param {boolean} value true or false, identifying the visibility. */ Dygraph.prototype.setVisibility = function(num, value) { var x = this.visibility(); - if (num < 0 || num >= x.length) { - console.warn("invalid series number in setVisibility: " + num); - } else { - x[num] = value; - this.predraw_(); + + if (num.constructor !== Array) num = [num]; + + for (var i = 0; i < num.length; i++) { + if (num[i] < 0 || num[i] >= x.length) { + console.warn("invalid series number in setVisibility: " + num[i]); + } else { + x[num[i]] = value; + } } + + this.predraw_(); }; /**