Charts: How do i set

Created on 10 Nov 2016  路  5Comments  路  Source: danielgindi/Charts

previously (2.2.5?) i was using the code below to set my labels at the bottom with dates. how can i do this with 3.0?

NSMutableArray<NSString *> *dates = [NSMutableArray array];
divChartData = [[CombinedChartData alloc] initWithXVals:dates];

Most helpful comment

The reasoning is that you don't pass the x values you want on the axis anymore. You pass the x values in the entry and then format the axis to show the value. The reason was to better handle floating point values.

All 5 comments

i figured it out

- (NSString *)stringForValue:(double)value axis:(ChartAxisBase *)axis{
    return dates[(int)value % dates.count];
}

and

cell.chartView.xAxis.valueFormatter = self;

Previously i was able to get my data, put them into entries, entries into dataset all in one method, now with stringForValue:axis: my dates array has to be an instance variable. Is there any specific reason for such a change?

If you look at the release notes for 3.0 there might be the reasoning there. I don't remember off the top of my head.

Theres no reasoning for this on the release notes. Though I'm sure there was good reason for this, it'd be nice to know what that is because from a user standpoint, it's kind of a head ache.

The reasoning is that you don't pass the x values you want on the axis anymore. You pass the x values in the entry and then format the axis to show the value. The reason was to better handle floating point values.

ah ok, that does make sense i guess. thanks for the explanation

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PrashantKT picture PrashantKT  路  3Comments

Bharati555 picture Bharati555  路  4Comments

deepumukundan picture deepumukundan  路  3Comments

JW00332 picture JW00332  路  4Comments

coop44483 picture coop44483  路  3Comments