Showing line with the right lineWidth in legend
I have a group of lines, with different width. I would like to show the same width of lines in the legend area, is there a way to do that? Currently, the legend only has the right color in a b开发者_开发百科lock (same size for all the lines.)
The legend is overlaid on top of the canvas so you can manipulate the css to get this functionality:
var p = $.plot(...);
$.each(p.getData(), function(i, el){
$($('.legendColorBox div div')[i]).css({border: 'none',
height: el.lines.lineWidth+'px',
width: '20px',
'background-color': el.color});
});
精彩评论