I managed to create dashed lines for grid layout by changing the library. I am currently using Flot ver 0.8.0
First I added a new attribute under the grid (around line 400), just below markingsLineWidth:
markingsStyle: 'dashed'
Since Flot uses the canvas to render charts, I added the dashedLineTo () extension for the canvas using this code from David Owens. I added it right after the color parser plugin on top of the Flot code, with loans granted to David. The dashedLineTo () function has the following parameters:
dashedLineTo(fromX, fromY, toX, toY, pattern)
I used [5.5] for the template, which means that 5px dashes and 5px spaces will alternate.
Finally, I modified the drawGrid function in the plugin when marking is drawn.
if(options.grid.markingsStyle == 'dashed') { ctx.dashedLineTo(xrange.from, yrange.from, xrange.to, yrange.to, [5,5]) } else { ctx.moveTo(xrange.from, yrange.from); ctx.lineTo(xrange.to, yrange.to); }
Just thought you could use this as a link when changing the library.
source share