Added data attributes that allow to easily select legend elements and labels through jQuery

This commit is contained in:
neveldo
2014-10-26 11:56:09 +01:00
parent 4115b5ea06
commit 50baf1600d

View File

@ -654,6 +654,9 @@
height += legendOptions.marginBottom + elemBBox.height;
}
$(elem.node).attr({"data-type": "elem", "data-index": i});
$(label.node).attr({"data-type": "label", "data-index": i});
if (legendOptions.hideElemsOnClick.enabled) {
// Hide/show elements when user clicks on a legend element
label.attr({cursor:"pointer"});