Commits

Anonymous committed c35956a

Fix for persistent graphs and color syncing when hiding curves

Comments (0)

Files changed (1)

src/jqplot.core.js

     Axis.prototype.constructor = Axis;
     
     Axis.prototype.init = function() {
-        this.renderer = new this.renderer();
+        if(typeof this.renderer === "function") {
+            this.renderer = new this.renderer; 
+        }
+
         // set the axis name
         this.tickOptions.axis = this.name;
         if (this.label == null || this.label == '') {
     
     Axis.prototype.resetScale = function() {
         this.min = null;
+        this._ticks = [];
+        this._series = [];
+        this._dataBounds = {min:null, max:null};
         this.max = null;
         this.numberTicks = null;
         this.tickInterval = null;
     Legend.prototype.constructor = Legend;
     
     Legend.prototype.init = function() {
-        this.renderer = new this.renderer();
+        if(typeof this.renderer === "function") {
+            this.renderer = new this.renderer;
+        } 
         this.renderer.init.call(this, this.rendererOptions);
     };
     
     Title.prototype.constructor = Title;
     
     Title.prototype.init = function() {
-        this.renderer = new this.renderer();
+        if(typeof this.renderer === "function") {
+            this.renderer = new this.renderer;
+        }
         this.renderer.init.call(this, this.rendererOptions);
     };
     
             var comp = $.jqplot.getColorComponents(comp);
             this.fillColor = 'rgba('+comp[0]+','+comp[1]+','+comp[2]+','+this.fillAlpha+')';
         }
-        this.renderer = new this.renderer();
+        if(typeof this.renderer === "function") {
+            this.renderer = new this.renderer();
+        }
         this.renderer.init.call(this, this.rendererOptions, plot);
-        this.markerRenderer = new this.markerRenderer();
+        if(typeof this.markerRenderer === "function") {
+            this.markerRenderer = new this.markerRenderer();
+        }
         if (!this.markerOptions.color) {
             this.markerOptions.color = this.color;
         }
     Grid.prototype.constructor = Grid;
     
     Grid.prototype.init = function() {
-        this.renderer = new this.renderer();
+        if(typeof this.renderer === "function") {
+            this.renderer = new this.renderer;
+        }
         this.renderer.init.call(this, this.rendererOptions);
     };
     
             if (!this.target.get(0)) {
                 throw "No plot target specified";
             }
+
+            this.series = [];
+            for (var name in this.axes) {
+                this.axes[name].resetScale();
+            }
             
             // make sure the target is positioned by some means and set css
             if (this.target.css('position') == 'static') {
                 }
 
                 // parse the renderer options and apply default colors if not provided
-                if (!temp.color && temp.show != false) {
+                if (!temp.color) {
                     temp.color = cg.next();
                 }
                 if (!temp.label) {
     };
     var log = $.jqplot.log;
     
-})(jQuery);
+})(jQuery);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.