Time axis not updating between 24 and 12 hour time settings for US region


#1
  1. on ipad (ios 7.1) , go to settings, international, region format, change to US

  2. go general , time and date, set 24-hour time to on

  3. run example project ‘TimeSeriesChart’ and expand time axis until you see time, such as 10:35:00

  4. go general , time and date, set 24-hour time to off

  5. close and open the app and zoom in on axis

  6. see time axis is not changed.

  7. on ipad (ios 7.1) , go to settings, international, region format, change to Italy

  8. go general , time and date, set 24-hour time to on

  9. close and open the app

  10. go general , time and date, set 24-hour time to off

  11. see time axis shows something like 06:00 pm where it did not with the US region


#2

Hello,

Just checking to see a fix for this issue is possible. Thanks.


#3

Hi foobar,

I am not sure why you are seeing updates when changing to Italy vs US, but I’ve had some thoughts on how are labels are formatted on a date time axis that may help us work towards a solution.

The labels on our time axis are formatted using the labelFormatter property. You could try altering this by assigning a label formatter that uses 12 hour formatting when needed.

A more general soltution may be to attempt to setup a label formatter that uses the users settings. Given that we initialise our formatter with a default NSDateFormatter internally I would have thought that this was already the case, but perhaps the problem is that the original formatter is created with the original 24 hr setting and is not mutated by the user updating their settings, but remains in place on the axis. If that really is the problem then the solution would probably be to create a new formatter each time the user changes their settings (so that the new settings are incorporated into the underlying default NSDateFormatter).

I am not sure if changed user settings are something you can detect in an iOS app - if so you can respond in the way described above. If not then assigning a new date formatter to the axis each time the app becomes active may work (as presumably the app is being exited in order to change the settings and then returned to later).

I hope I’ve understood your problem properly and that my suggestions are useful! Please don’t hesitate to update us on this issue and let us know how you get on with the above info.

Thanks

Ryan


#4

Thanks for responding RGrey. Can you give an example of setting up my own formatter?  When looking here

http://www.shinobicontrols.com/docs/ShinobiControls/ShinobiCharts/2.6.0/Premium/Normal/html/Classes/SChartDateTimeAxis.html

I don’t see where I can add a formatter.


if you look here, you can see how to set a formatter based on a local

https://developer.apple.com/library/ios/documentation/cocoa/Conceptual/DataFormatting/Articles/dfDateFormatting10_4.html


#5

hello RGrey, just following up to see if you know of an example for setting up my own formatter.


#6

Hi foobar,

The labelFormatter is defined on the superclass SChartAxis - http://www.shinobicontrols.com/docs/ShinobiControls/ShinobiCharts/2.7.0/Premium/Normal/html/Classes/SChartAxis.html#//api/name/labelFormatter

You should just be able to do “dateAxis.labelFormatter = yourAppropriateFormatter;” whenever your app’s settings change to see if this fixes the issue.

Thanks

Ryan


#7

worked great. thanks.