+ if (typeof(axis) == "object") {
+ throw "Using objects for axis specification " +
+ "is not supported inside the 'series' option.";
+ }
+ if (axis) {
+ throw "Unknown axis : " + axis;
+ }
+ // No axis specification means axis 0.
+ return 0;
+};
+
+/**
+ * Reparses options that are all related to series. This typically occurs when
+ * options are either updated, or source data has been made avaialble.
+ *
+ * TODO(konigsberg): The method name is kind of weak; fix.
+ */
+DygraphOptions.prototype.reparseSeries = function() {
+ var labels = this.get("labels");
+ if (!labels) {
+ return; // -- can't do more for now, will parse after getting the labels.
+ }
+
+ this.labels = labels.slice(1);
+
+ this.yAxes_ = [ { series : [], options : {}} ]; // Always one axis at least.
+ this.xAxis_ = { options : {} };
+ this.series_ = {};
+
+ // Traditionally, per-series options were specified right up there with the options. For instance
+ // {
+ // labels: [ "X", "foo", "bar" ],
+ // pointSize: 3,
+ // foo : {}, // options for foo
+ // bar : {} // options for bar
+ // }
+ //
+ // Moving forward, series really should be specified in the series element, separating them.
+ // like so:
+ //
+ // {
+ // labels: [ "X", "foo", "bar" ],
+ // pointSize: 3,
+ // series : {
+ // foo : {}, // options for foo
+ // bar : {} // options for bar
+ // }
+ // }
+ //
+ // So, if series is found, it's expected to contain per-series data, otherwise we fall
+ // back.
+ var oldStyleSeries = !this.user_["series"];
+
+ if (oldStyleSeries) {
+ var axisId = 0; // 0-offset; there's always one.
+ // Go through once, add all the series, and for those with {} axis options, add a new axis.
+ for (var idx = 0; idx < this.labels.length; idx++) {
+ var seriesName = this.labels[idx];