Home forums Feature Requests & Feedback Add tooltip on legend labels Reply To: Add tooltip on legend labels

#15601

Anthony
Member

Figured it out. Gotta use setter methods:


                itemmouseover: function (e) {
                    $(e.chart._canvasJSContainer).attr("title", "My custom tooltip");
                    console.log('mouseover');
                    e.chart.legend.set("fontColor", 'orange');
                    e.chart.legend.set("backgroundColor", 'blue');
                    e.chart.legend.set("borderColor", 'red');
                    e.chart.legend.set("borderThickness", 3);
                    e.chart.legend.set("fontStyle", 'italic');
                    e.chart.legend.set("fontWeight", 'bold');
                    e.chart.render();
                },
                itemmouseout: function (e) {
                    $(e.chart._canvasJSContainer).removeAttr("title");                    
                    console.log('mouseout');
                    e.chart.legend.set("fontColor", 'black');
                    e.chart.legend.set("backgroundColor", 'transparent');
                    e.chart.legend.set("borderColor", 'transparent');
                    e.chart.legend.set("borderThickness", 0);
                    e.chart.legend.set("fontStyle", 'normal');
                    e.chart.legend.set("fontWeight", 'normal'); 
                    e.chart.render();
                }