Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Minor modification for option to supply a custom legend fragment formatter #993

Closed
wants to merge 1 commit into from

1 participant

ajholyoake
ajholyoake

Useful if you want to plot e.g. symbols in the legend.

ajholyoake ajholyoake Custom legend fragment formatter
Useful if you want to plot e.g. symbols in the legend.
3bf274b
ajholyoake ajholyoake closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 18, 2013
  1. ajholyoake

    Custom legend fragment formatter

    ajholyoake authored
    Useful if you want to plot e.g. symbols in the legend.
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 1 deletion.
  1. +8 −1 jquery.flot.js
9 jquery.flot.js
View
@@ -2549,7 +2549,8 @@ Licensed under the MIT license.
if (label) {
entries.push({
label: label,
- color: s.color
+ color: s.color,
+ series: s
});
}
}
@@ -2584,11 +2585,17 @@ Licensed under the MIT license.
fragments.push('<tr>');
rowStarted = true;
}
+
+ if (options.legend.fragmentFormatter) {
+ fragments.push(options.legend.fragmentFormatter(entry,options));
+
+ } else {
fragments.push(
'<td class="legendColorBox"><div style="border:1px solid ' + options.legend.labelBoxBorderColor + ';padding:1px"><div style="width:4px;height:0;border:5px solid ' + entry.color + ';overflow:hidden"></div></div></td>' +
'<td class="legendLabel">' + entry.label + '</td>'
);
+ }
}
if (rowStarted)
Something went wrong with that request. Please try again.