Chart automatically sets the last point equal to the first one


#1

Hello I just updated to the last version of the charts framework. I have noticed that line chart sets the last point of the chart equal to the first one… It’s like closing a CGPath. Any ideas how to deal with this bug?


#2

Hi,

Thank you for raising this. This sounds like a known bug in ShinobiCharts, which will be fixed in the next release. The bug presents if you persist your chart series in between data reloads. The problem is due to the series data not being properly cleared when the new data is reloaded. Does this sound like the situation you have with your code?

If this is the case, a workaround for the issue would be to provide a new chart series from your datasource each time the chart queries it. Code like the following should do this:

-(SChartSeries *)sChart:(ShinobiChart *)chart seriesAtIndex:(NSInteger)index {
    
    SChartLineSeries *series = [SChartLineSeries new]; // You should insert the correct type of series here
    // configure your series here...
  
    return series;
}

I hope that helps, let me know how things go.

Regards,

Dan


#3

Hi, I just figure it out… I “cloned” the series object to see the if there is any cache issue and it worked… The only problem is that I have to set the styles to the new series every single time…


#4

Yes, that sounds right. This issue will be addressed in the new version of ShinobiCharts. We’ll let you know when that’s available, and you should be able to get rid of the workaround.


#5

I also have this problem on Android after I rotate the screen. Is it the same bug?

Before screen rotation:

After screen rotation:

How can I fix it?


#6

Hi sdeff,

No, this is not the same issue, but looks more likely to be do about incorrect handling of the activity lifecycle events triggered by device rotation in Android (I suspect you are inadvertently re-adding your data points whenever the activity is torn down as part of the rotation). There is a general discussion of how you should address these issues in the How to: Manage Chart Lifecycles guide in the download bundle, but as you have also raised a support ticket with us I’ll deal with the specifics of your case there.

Best regards,

Robin Sillem


#7

Hi,

We’ve just released version 2.5.7 of the iOS ShinobiCharts library. That fixes this issue in iOS. If you have a workaround for this issue, you should be able to remove it now.

Many thanks,

Dan