iOS SChartDiscontinuousDateTimeAxis hangs 100% cpu when the date frequency changes across a range


#1

Hi,

Currently evaluating for a client and we have a strong requirement for a discontinuous date/time axis.

We have data that has a range of two weeks

In the two weeks the frequency of data is as follows

Day 1 - 2 : 1 hour

Day 3 - 5 : 3 hour

Day 6 - 10 : 12 hour

I have setup the SChartDiscontinuousDateTimeAxis to remove redundant time peroids using addExcludedTimePeriod

If I don’t remove them then we have large gaps in our range e.g. day 7 shows lots of empty 1 hour datapoints where we don’t have data

Everything works fine except for when I add a major or minor tick frequency.

I set the frequency at 1 hour.

When the use pans the chart and ‘crosses’ the change over boundary from 1 hour to 3 hour fequency then the chart hangs and consumes 70-80% cpu.

If I REMOVE all labels then the chart is fine.

I had an expectation that the SChartDiscontinuousDateTimeAxis would automatically set the label and adjust the frquency based on the date/time in the data source.

To recap, my datasource has time based data which hourly times for the first two days. The datasource then has 3 hourly time slots for days 3-5 and finally 12 hourly time slots for days 6-10.

So far the charts package has performed adminrably. However, this problem is a major blocker for us.

As a side note, if we choose Shinobi then we would be looking for Android / Xamarin support for the discontinuous axis in the next 4 months, is it on the radar?

Thanks

Scott Wilson-Billing

UK Met Office


#2

Hi Scott,

This isn’t a known issue with the chart - we’re currently unaware of any hangs in the discontinuous-date-time axis. Are you able to reproduce this reliably? And could I ask what version of the chart library you’re using? We did have a few issues several releases ago but as far as I’m aware they were all fixed. If possible, are you able to provide us with a code sample? This would greatly help me get to the bottom of this issue for you :slight_smile:

Kind regards,

Rob


#3

Hi Rob,

Thanks for the reply. The bug is very similar to this one:

As a workaround I chose to plot my own tick labels using annotations and this has allowed me to move on.

To reproduce:

  • create a discontinuous date/time line series with chart frequency set to 1 hour

  • have a datasource with hourly data and then some 3 hourly data

  • add the missing time slots as excluded periods e.g. if my data is 10am, 11am, 12am, 13pm, 16pm, 19pm then add 14pm,15pm,17pm,18pm as exluded periods

  • set to show labels

  • pan the chart 

The chart will hang as the label tranisitions from hourly time slots to 3 hourly time slots. 

It’s something to do with the chart frequency not matching the frequency of the time slots. If I set chart frequency to 3 hours then everything works fine.

Kind regards

Scott


#4

Hi Scott,

Could I ask how you’re creating and setting the excluded time periods? If you could copy and paste it that would be really handy.

It may be that your time periods are overlapping with your data points which can cause the chart to consume a large amount of CPU.

Thanks,

Sam


#5

Just updated to iOS 8.4 and now this code hangs the CPU 100% of the time and consumes all the memory. Previosuly worked fine.

My code hasn’t changed.

    for (NSDate *timePeriod in missingTimePeriods) {
        SChartTimePeriod *chartTimePeriod = [[SChartTimePeriod alloc]initWithStart:timePeriod andLength:[SChartDateFrequency dateFrequencyWithHour:1]];
        [xAxis addExcludedTimePeriod:chartTimePeriod];

    }

#6
More info, using     SChartDiscontinuousDateTimeAxis *xAxis = [[SChartDiscontinuousDateTimeAxis alloc] initWithRange:dateRange];

You can see from my log that the ranges look fine, yet the error is chucked out:

2015-07-01 15:49:21.197 Weather One[1373:52578] Default range Min date [2015-07-01 14:00:00 +0000]
 2015-07-01 15:49:21.197 Weather One[1373:52578] Default range Max date [2015-07-01 19:00:00 +0000]
 2015-07-01 15:49:21.197 Weather One[1373:52578] Default range [{ 2015-07-01 14:00:00 +0000, 2015-07-01 19:00:00 +0000 }]
 2015-07-01 15:49:21.197 Weather One[1373:52578] Date range Min date [2015-07-01 14:00:00 +0000]
 2015-07-01 15:49:21.197 Weather One[1373:52578] Date range Max date [2015-07-05 22:00:00 +0000]
 2015-07-01 15:49:21.197 Weather One[1373:52578] ShinobiCharts: Invalid data range specified: nan -> nan. This range has been ignored.
 From: SChartDiscontinuousDateTimeAxis at 0x7fd8d59ef490, axisRange = { 0.000000, 1.000000 }, defaultRange = { 1435759200.000000, 1435777200.000000 }, maxRange = { 2015-07-01 14:00:00 +0000, 2015-07-01 19:00:00 +0000 }

2015-07-01 15:49:21.197 Weather One[1373:52578] Date range [{ 1970-01-01 00:00:00 +0000, 1970-01-01 00:00:01 +0000 }]

 


#7

Hi Scott,

Thanks for reporting this. I’m unable to replicate your issue with your invalid data range, however I’ve managed to recreate the problem you were experiencing with the chart hanging.

We’ve narrowed down this issue to a bug within our DiscontinuousDateTimeAxis logic but need to explore it a little further. A member of our team will continue looking into this next week and will update you on the progress.

Many thanks,

Sam


#8

Thanks for the update.


#9

Hi Scott,

You may wish to try our Alpha version we’ve just made available today in the customer portal. This should include a fix for the issue you are seeing, although if you have any problems please let us know!

Thanks,

Sam