Toggle series in line chart


#1

Hello,

I have a line chart with around 10 series. I’ve created a custom legend which includes a uiswitcher for each series. Every time a uiswitch is flicked, I need the series graphed in the line chart to disappear or reappear accordingly. Can anyone tell me how I can do this?


#2

Best solution I found so far was to redraw the chart at ever toggle. Before the redraw, create a list of seriesIndexes to ignore. then at styleAtSeriesIndex, set the line color UIColor clearcolor.

If aynone has a better solution, let me know


#3

I have a releated issue where you can toggle the series which will be plotted on the chart and I want to maintain a given colour for a series - they’re columns so I can’t just make clear. Where have you found styleAtSeriesIndex? I can’t find it in the docs. I think I need to be able to override the series style to keep a consistent column colour  as a given property might be toggled on the chart as series 1, 2, n etc.

Cheers,
Steve


#4

-(SChartSeries *)sChart:(ShinobiChart *)chartLocal seriesAtIndex:(int)index 

What I do is tell lineseries.style.linecolor  to clearColor. This doesn’t really work for bar graphs since you’ll just see a gap though. Your best bet is probably to redifine the number of series in the chart and exclude the series you don’t want to appear.


#5

if you do as Johnny said, you will lose it symbol from the legend so you will not be able to re enable it again.
I think ou can just return nil value nil serie.