SChartDateTimeAxis rangpadding is not working?


#1

This is part of the code

    SChartDateRange* dateRange = [[SChartDateRangealloc] initWithDateMinimum:[selfdateFromString:@“01-01-2007”]

                                                            andDateMaximum:[self dateFromString:@“13-01-2007”]];

    SChartDateTimeAxis *xAxis = [[SChartDateTimeAxisalloc] initWithRange:dateRange];

 xAxis.rangePaddingLow = [SChartDateFrequencydateFrequencyWithDay:3];

    xAxis.rangePaddingHigh = [SChartDateFrequencydateFrequencyWithDay:3];


#2

Hi supuniresh,

We currently don’t support axis padding when a range has been set.

If you wish to add padding to your chart you must add it to the SChartDateRange you initialise your axis with.

Let me know if you have any questions.

Kind regards,
Andrew Polkinghorn


#3

Hi Andrew,

Can you please let us know how to add axis padding as part of the initialization of the SChartDateRange ?


#4

Hi, sim777

Don’t know is this would help

I found this on shinobi chart sample - Multiple axis

//initialize date range

SChartDateRange* dateRange = [[SChartDateRange alloc] initWithDateMinimum:[self   
                                                    dateFromString:@"01-01-2010"]
                                                     andDateMaximum:[self dateFromString:@"01-06-2010"]];

//initialize axis with date range

 SChartDateTimeAxis *xAxis = [[SChartDateTimeAxis alloc] initWithRange:dateRange];



//custom method to Convert NSString to NSDate

- (NSDate*) dateFromString:(NSString*)date {
    static NSDateFormatter *dateFormatter;
    if (!dateFormatter) {
        dateFormatter = [[NSDateFormatter alloc] init];
        [dateFormatter setDateFormat:@"dd-MM-yyyy"];
    }
    return [dateFormatter dateFromString:date];
}