Commits

cleonello  committed 754b680

Removed debug statement from pie renderer.
Added drawBorder option to grid.
Don't draw lines (or borders) in grid if lineWidth is 0. Apparently canvas context may ignore a 0 lineWidth setting and stroke a default width line.

  • Participants
  • Parent commits 271e6f9

Comments (0)

Files changed (4)

File examples/dataLabels.html

     s1 = [['Sony',7], ['Samsumg',13.3], ['LG',14.7], ['Vizio',5.2], ['Insignia', 1.2]];
         
     plot1 = $.jqplot('chart1', [s1], {
+        grid: {
+            drawBorder: false, 
+            drawGridlines: false,
+            background: '#ffffff',
+            shadow:false
+        },
+        axesDefaults: {
+            
+        },
         seriesDefaults:{
             renderer:$.jqplot.PieRenderer,
             rendererOptions: {

File src/jqplot.canvasGridRenderer.js

         function drawLine(bx, by, ex, ey, opts) {
             ctx.save();
             opts = opts || {};
-            $.extend(true, ctx, opts);
-            ctx.beginPath();
-            ctx.moveTo(bx, by);
-            ctx.lineTo(ex, ey);
-            ctx.stroke();
-            ctx.restore();
+            if (opts.lineWidth == null || opts.lineWidth != 0){
+                $.extend(true, ctx, opts);
+                ctx.beginPath();
+                ctx.moveTo(bx, by);
+                ctx.lineTo(ex, ey);
+                ctx.stroke();
+                ctx.restore();
+            }
         }
         
         if (this.shadow) {
         }
         // Now draw border around grid.  Use axis border definitions. start at
         // upper left and go clockwise.
-        drawLine (this._left, this._top, this._right, this._top, {lineCap:'round', strokeStyle:axes.x2axis.borderColor, lineWidth:axes.x2axis.borderWidth});
-        drawLine (this._right, this._top, this._right, this._bottom, {lineCap:'round', strokeStyle:axes.y2axis.borderColor, lineWidth:axes.y2axis.borderWidth});
-        drawLine (this._right, this._bottom, this._left, this._bottom, {lineCap:'round', strokeStyle:axes.xaxis.borderColor, lineWidth:axes.xaxis.borderWidth});
-        drawLine (this._left, this._bottom, this._left, this._top, {lineCap:'round', strokeStyle:axes.yaxis.borderColor, lineWidth:axes.yaxis.borderWidth});
+        if (this.borderWidth != 0 && this.drawBorder) {
+            drawLine (this._left, this._top, this._right, this._top, {lineCap:'round', strokeStyle:axes.x2axis.borderColor, lineWidth:axes.x2axis.borderWidth});
+            drawLine (this._right, this._top, this._right, this._bottom, {lineCap:'round', strokeStyle:axes.y2axis.borderColor, lineWidth:axes.y2axis.borderWidth});
+            drawLine (this._right, this._bottom, this._left, this._bottom, {lineCap:'round', strokeStyle:axes.xaxis.borderColor, lineWidth:axes.xaxis.borderWidth});
+            drawLine (this._left, this._bottom, this._left, this._top, {lineCap:'round', strokeStyle:axes.yaxis.borderColor, lineWidth:axes.yaxis.borderWidth});
+        }
         // ctx.lineWidth = this.borderWidth;
         // ctx.strokeStyle = this.borderColor;
         // ctx.strokeRect(this._left, this._top, this._width, this._height);

File src/jqplot.core.js

         // prop: borderWidth
         // width of the border in pixels.
         this.borderWidth = 2.0;
+        // prop: drawBorder
+        // True to draw border around grid.
+        this.drawBorder = true;
         // prop: shadow
         // wether to show a shadow behind the grid.
         this.shadow = true;

File src/plugins/jqplot.pieRenderer.js

                     y -= labelelem.height()/2;
                 }
                 else {
-                    console.log('here now');
                     x -= labelelem.width() * Math.sin(avgang/2);
                     y -= labelelem.height()/2;
                 }