TigrouMeow
TigrouMeow

Reputation: 1036

How to draw a line at yaxis = 0 with jQPlot?

I am using jQPlot and disabled the grid lines on my charts (drawGridlines: false). However, I would like to have a line at yaxis = 0, and I also would like to make sure that the 0 appears as well. Is this doable easily?

Thanks!

Upvotes: 1

Views: 1276

Answers (1)

AnthonyLeGovic
AnthonyLeGovic

Reputation: 2335

You can add an object in canvasOverlay :

var options={ //jqplot options
   canvasOverlay: {
     show: true,
     objects: [
       {
         horizontalLine: {
           name: "y=0",
           y: 0,
           yaxis: "yaxis",
           lineWidth: 1,
           color: "rgb(0,0,0)",
           shadow: false
         }
       }
     ]
   }
}

Don't forget to include jqplot.canvasOverlay.min.js plugin.

Upvotes: 5

Related Questions