User avatar
egret230
Posts: 43
Joined: Wed Oct 06, 2010 2:04 pm
Location: Rhode Island, USA

Does the legend have an id? Or can I give it one?

Does the legend have an id? Or can I give it one?

I'd like to be able to change it's style programmatically.

Specifically, I'd like to use JQUERY UI to make it draggable. ( http://jqueryui.com/demos/draggable/ )

Code: Select all

$("#legend").draggable(); // this would go right after generating the chart
Any suggestions?
User avatar
egret230
Posts: 43
Joined: Wed Oct 06, 2010 2:04 pm
Location: Rhode Island, USA

Re: Does the legend have an id? Or can I give it one?

When I right-click on the legend, my Firefox browser's Firebug toolbar tells me that it has a class called "highcharts-legend" - I see something that looks like this:

<g class="highcharts-legend" zindex="7" transform=...etc...

I tried to set up a JQUERY click event to capture a click on anything that has that class - I tried this:

$(".highcharts-legend").live("click",function(){
alert("legend");
}
);

But that didn't work.

Any idea on how to make this work? Because if we can make that work, then we should be able to make it draggable, right? Perhaps something like: $(".highcharts-legend").draggable(); But when I try that, Firebug says: "setting a property that has only a getter"

This is over my head at this point. Developers: can you explain this to me? Thank you 8)
hfrntt
Posts: 6393
Joined: Mon Aug 30, 2010 8:41 am
Contact: Website

Re: Does the legend have an id? Or can I give it one?

It doesn't work because jQuery draggable bases on position absolute and top/left css values and highcharts draw chart inside SVG namespace - position absolute or top/left css attribute doesn't work there.
Slawek Kolodziej
Highcharts support team
User avatar
egret230
Posts: 43
Joined: Wed Oct 06, 2010 2:04 pm
Location: Rhode Island, USA

Re: Does the legend have an id? Or can I give it one?

That's a bummer. But, I wouldn't want to give up the ability to print/download charts that we get from SVG - so thanks for the explanation, and keep up the good work!!!

Return to “Highcharts Usage”