Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion jquery.flot.js
Expand Up @@ -2549,7 +2549,8 @@ Licensed under the MIT license.
if (label) { if (label) {
entries.push({ entries.push({
label: label, label: label,
color: s.color color: s.color,
series: s
}); });
} }
} }
Expand Down Expand Up @@ -2584,11 +2585,17 @@ Licensed under the MIT license.
fragments.push('<tr>'); fragments.push('<tr>');
rowStarted = true; rowStarted = true;
} }

if (options.legend.fragmentFormatter) {
fragments.push(options.legend.fragmentFormatter(entry,options));

} else {


fragments.push( 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="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>' '<td class="legendLabel">' + entry.label + '</td>'
); );
}
} }


if (rowStarted) if (rowStarted)
Expand Down