gmmoraesbr / flot

Automatically exported from code.google.com/p/flot
0 stars 0 forks source link

Add labelColor option for specifying color of series in legend #337

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I suggest adding a "labelColor" option in order to specify a custom label
colour:

Line 1769, add/amend:

if (s.labelColor) {
  var labelColor = s.labelColor; 
}
else {
  var labelColor = s.color;
}
fragments.push(
  '<td class="legendColorBox"><div style="border:1px solid ' +
options.legend.labelBoxBorderColor + ';padding:1px"><div
style="width:4px;height:0;border:5px solid ' + labelColor +
';overflow:hidden"></div></div></td>' + '<td class="legendLabel">' + label
+ '</td>');

It can be specified as such:
hoverable: true,
label: 'Highlight',
labelColor: 'rgb(255,255,0)',
data: [ ...

This is useful for point data sets because flot currently takes the outer
colour, rather than the fill colour as uses it for labels.

Original issue reported on code.google.com by djrumc...@gmail.com on 26 Apr 2010 at 1:01

GoogleCodeExporter commented 8 years ago
I was going to implement this but it occurs to me that I would probably rather 
have an outline color that one can set (so you set the outline color rather 
than the series color), then people would be less confused on what to set on 
bars. Do you think that would work for you?

Original comment by olau%iol...@gtempaccount.com on 13 Dec 2010 at 3:44

GoogleCodeExporter commented 8 years ago

Original comment by dnsch...@gmail.com on 4 Jun 2012 at 8:03