View Full Version : Hiding series in a linechart

08-25-2006, 01:42 PM
I'm stuck on this problem for a while now. I have a linechart with multiple series (lines). Now I want to build in an option to (temporary) hide lines. I've searched the docs, blogs and forums but just can't find a way to do it except changing the dataprovider for my chart. But since my chart is based on a lot of data this is not a very good solution, I think.

To get an idea of what I'm trying to do, take a look at this application (http://www.wowhealers.com/healbot1.40.html)

If you click on the black dots (next to the colorpickers) you can hide certain lines.

04-07-2008, 05:14 PM
I'm no Flexpert, but the only way I know is to change the DataProvider. If you make a function that goes through the current DP and stores the "hidden" series' info in a separate Array, then the amount of data shouldn't be an issue - looping through a small chart or looping through a data-heavy one, a well-made function would do the same work for both, right?

I could be wrong, though, maybe there is an easier way. I just think that the amount of data shouldn't scare you off.

04-07-2008, 08:35 PM
I have something like this done, all I did was change the alpha of the series to 0 when someone clicks the legend item for that particular series.

So on the legend I have an itemclick listener:


which runs this:

private function onLegendClick(e:LegendMouseEvent):void{
if(e.item.source.alpha == 1){
e.item.alpha = 0.5;
e.item.source.alpha = 0;
e.item.enabled = false;
e.item.alpha = 1;
e.item.source.alpha = 1;
e.item.enabled = true;

04-08-2008, 07:31 AM
series have a property:visible, that can be set to False. you can use that at runtime to hide the series.