Commits

Anonymous committed 8c9f400

Fixed trendline issue. Fixed bug where certain area charts not highlighting.

  • Participants
  • Parent commits fa3d058

Comments (0)

Files changed (4)

File examples/theming.html

     l4 = [12, 6, 13, 11, 2];
     l5 = [4, -3, 3, 6, 2, -2];
 
-    pop1980 = [7071639, 2968528, 3005072, 1595138, 789704, 1688210, 785940, 904599, 875538, 629400]
-    pop1990 = [7322564, 3485398, 2783726, 1630553, 983403, 1585577, 935933, 1006877, 1110549, 782248]
-    pop2000 = [8008654, 3694644, 2896051, 1974152, 1322025, 1517550, 1160005, 1188603, 1223418, 895809]
-    pop2008 = [8363710, 3833995, 2853114, 2242193, 1567924, 1447395, 1351305, 1279910, 1279329, 948279]
+    pop1980 = [7071639, 2968528, 3005072, 1595138, 789704, 1688210, 785940, 904599]
+    pop1990 = [7322564, 3485398, 2783726, 1630553, 983403, 1585577, 935933, 1006877]
+    pop2000 = [8008654, 3694644, 2896051, 1974152, 1322025, 1517550, 1160005, 1188603]
+    pop2008 = [8363710, 3833995, 2853114, 2242193, 1567924, 1447395, 1351305, 1279910]
 
-    ticks = ["New York", "Los Angeles", "Chicago", "Houston", "Phoenix", "Philadelphia", "San Antonio", "Dallas", "San Diego", "San Jose"]      
+    ticks = ["New York", "Los Angeles", "Chicago", "Houston", "Phoenix", "Philadelphia", "San Antonio", "Dallas"]      
 
     plot1 = $.jqplot('chart1',[l2],{
        title: 'Line Chart',
        },
        seriesDefaults: {
            renderer: $.jqplot.BarRenderer,
-           fillToZero: true,
            rendererOptions: {
                barPadding: 2
            }
 <div id="chart1" class="plot" style="width:400px;height:260px;"></div>
 <div id="chart1b" class="plot" style="width:400px;height:260px;"></div>
 <div id="chart1c" class="plot" style="width:400px;height:260px;"></div>
-<div id="chart2" class="plot" style="width:700px;height:310px;"></div>
+<div id="chart2" class="plot" style="width:760px;height:360px;"></div>
 <div id="chart3" class="plot" style="width:400px;height:320px;"></div>
 <div id="chart4" class="plot" style="width:400px;height:260px;"></div>
 <div id="chart5" class="plot" style="width:400px;height:260px;"></div>

File src/jqplot.core.js

                                 // first check if it is in bounding box
                                 var inside = false;
                                 if (x>s._boundingBox[0][0] && x<s._boundingBox[1][0] && y>s._boundingBox[1][1] && y<s._boundingBox[0][1]) { 
-                                    // now check the crossing number         
+                                    // now check the crossing number   
                                     
                                     var numPoints = s._areaPoints.length;
                                     var ii;

File src/jqplot.lineRenderer.js

         var sopts = {lineJoin:'round', lineCap:'round', fill:this.fill, isarc:false, angle:this.shadowAngle, offset:shadow_offset, alpha:this.shadowAlpha, depth:this.shadowDepth, lineWidth:this.lineWidth, closePath:this.fill};
         this.renderer.shadowRenderer.init(sopts);
         this._areaPoints = [];
-        this._boundingBox = [[0,0],[0,0]];
+        this._boundingBox = [[],[]];
         
         if (!this.isTrendline && this.fill) {
         
                             var prev = this._prevGridData;
                             for (var i=prev.length; i>0; i--) {
                                 gd.push(prev[i-1]);
-                                this._areaPoints.push(prev[i-1]);
+                                // this._areaPoints.push(prev[i-1]);
                             }
                             if (shadow) {
                                 this.renderer.shadowRenderer.draw(ctx, gd, opts);
                             }
-            
+                            this._areaPoints = gd;
                             this.renderer.shapeRenderer.draw(ctx, gd, opts);
                         }
                     }
                             }
                         }
                         this._areaPoints = gd;
+                        
                         if (shadow) {
                             this.renderer.shadowRenderer.draw(ctx, gd, opts);
                         }
                 }
             }
             // calculate the bounding box
+            var xmin = xmax = ymin = ymax = null;
             for (i=0; i<this._areaPoints.length; i++) {
                 var p = this._areaPoints[i];
-                if (this._boundingBox[0][0] > p[0]) {
-                    this._boundingBox[0][0] = p[0];
+                if (xmin > p[0] || xmin == null) {
+                    xmin = p[0];
                 }
-                if (this._boundingBox[0][1] < p[1]) {
-                    this._boundingBox[0][1] = p[1];
+                if (ymax < p[1] || ymax == null) {
+                    ymax = p[1];
                 }
-                if (this._boundingBox[1][0] < p[0]) {
-                    this._boundingBox[1][0] = p[0];
+                if (xmax < p[0] || xmax == null) {
+                    xmax = p[0];
                 }
-                if (this._boundingBox[1][1] > p[1]) {
-                    this._boundingBox[1][1] = p[1];
+                if (ymin > p[1] || ymin == null) {
+                    ymin = p[1];
                 }
             }
+            this._boundingBox = [[xmin, ymax], [xmax, ymin]];
         
             // now draw the markers
             if (this.markerRenderer.show && !fill) {

File src/plugins/jqplot.trendline.js

         
     };
     
-    $.jqplot.postParseSeriesOptionsHooks.push(parseTrendLineOptions);
+    $.jqplot.postSeriesInitHooks.push(parseTrendLineOptions);
     $.jqplot.postDrawSeriesHooks.push(drawTrendline);
     $.jqplot.addLegendRowHooks.push(addTrendlineLegend);