|
Could not get {layerId}, when using legendBox.addKey |
Posted by ying on Jan-05-2011 07:00 |
|
Hi, Peter
For example, my xychart will show 6 dataset. One layer is line layer and have data set d, e, f. and another layer is bar layer and have set set a, b, c. line layer is generated first and bar layer second. so In my legend of the chart I get d --> e-->f -->a-->b-->c.
I can disable the legend and using legendBox.addKey to reorder the legend. However I have ImageMap for the legend to trigger some clickable event.
legendImageMap = legendBox.getHTMLImageMap("javascript:goChartUrl( '{layerId}')", " " ,"title='click the legend to highlight it on the chart'");
If I use legendBox.addKey, {layerId} is not generated. Is there anyway I can get the layerId of each legend?
Thanks
Ying |
Re: Could not get {layerId}, when using legendBox.addKey |
Posted by Peter Kwan on Jan-05-2011 16:09 |
|
Hi Ying,
If the legend key is not added by a layer, it is normal that it does not have {layerId}. If you would like to have a {layerId}, you may add it using a layer, instead of using LegendBox.addKey.
For your case, if your intention is to have the legend keys in the order (a, b, c, d, e, f), you may use Layer.setLegendOrder to rearrange the legend key order. For example:
//put the bar layer legend before the line layer legend
myBarLayer.setLegendOrder(Chart.NormalLegend, 5000);
If you want to use some other arbitrary ordering (such as f, a, e, b, d, c), you may add the keys using layers. For example:
//add the legend key "f" to the legend box, using an empty line layer
c.addLineLayer(null, myColor, "f");
Hope this can help.
Regards
Peter Kwan |
|