Timezone formatting for timeaxis


#1

Hello,

I have a time series chart. So my X axis is a SChartDateTimeAxis.

The NSDate objects I provide as x values are in the GMT zone but the chart displays them in my locale zone.

How do I change the formatting of the tick marks in order to choose in which timezone I want the time to be displayed ?

Thank you,

Jean Michel LECONTE


#2

Hi Jean,

You will need to configure the NSFormatter of your axis to set the timezone. You can get at this through the labelFormatter property as follows;

NSDateFormatter *formatter = (NSDateFormatter*)chart.xAxis.labelFormatter.formatter;
//Set timezone to GMT
[formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
[chart redrawChart];

This will set the timezone of the chart to be in GMT, to match your data.