dygraphs
dygraphs copied to clipboard
Allow legendFormatter function to return DOM elements
It would be useful to allow the legendFormatter function to return DOM elements or an HTML string.
This would allow a user to supply elements that have more complex formatting and attached event handlers. For example, I'd like to create a legend that supports click events on legend labels to change the visibility or styling of series plot lines.
I think this would be pretty easy to add to legend.js and could supply the PR for this. Let me know what you think.
It might be easiest to allow the returned item to be a DocumentFragment or a String. The DocumentFragment would be appended instead of using innerHTML. If a String is returned, innerHTML is used.