Reputation:
I'm trying to have the legend title change when I drill-down to the next level of the data.
Currently, I'm using a click event to call a function which removes the existing series and adds new ones, followed by chart.redraw().
Is it possible to set the Legend title using .attr in this same function? I've seen a few examples that use this to change the y-axis or chart title, but I can't get it working for the legend title.
function redrawLegend(legendtitle) {
chart.legend.attr({
text: legendtitle
});
};
'legendtitle' is in this case a variable that I have stored with the drill-down data.
Upvotes: 2
Views: 4225
Reputation: 45079
Use: chart.legend.title.attr({ text: 'aaa' });
Example: http://jsfiddle.net/ag6Wq/
Upvotes: 4