Hiding data point circles depending on density


#1

I want to show line chart points but only when there are fewer than some threshold in the plot area. If there are too many, then the dots bump into each other, look bad, and aren’t useful. I figured I’d use 

- (float)sChartRadiusForDataPoint:(ShinobiChart*)chart dataPointAtIndex:(NSInteger)dataIndex forSeriesAtIndex:(NSInteger)seriesIndex

... for this, but when I return 0 as the radius the dots get shown anyway. What's the best approach here?


#2

Hi jscalo,

I’m afraid the chart currently doesn’t support this functionality - once rendered the points are fixed until a redraw (although this is something we’re looking at changing for a future version). You could listen for the chart’s pan and zoom events and reload+redraw if you detect that the chart is too packed, however if you have many points this may affect performance. You may also want to set chart.autoCalculateAxisRanges to NO after the initial render, which will prevent the chart range jumping back when you reload.

Hope this helps :slight_smile:

Rob