Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
5020
Chart yAxis Precision and Scale for Marginal Value Changes
posted

Check out the yAxis on the scale.  Notice how there are 3 points for 136.6 and 3 points for 136.4... but only one point for 136.5.

These kinds of situations tend to correct themselves over time, but it would be nice if they didn't show up.

Here is the yAxis formatter...

-(NSNumberFormatter*)yAxisLabelFormatter

{

    if(!_yAxisLabelFormatter)

    {

        _yAxisLabelFormatter = [[NSNumberFormatter alloc] init];

        _yAxisLabelFormatter.numberStyle = NSNumberFormatterDecimalStyle;

        _yAxisLabelFormatter.groupingSize = 0;

        _yAxisLabelFormatter.maximumFractionDigits = 1;

        _yAxisLabelFormatter.minimumSignificantDigits = 1;

        _yAxisLabelFormatter.minimumFractionDigits = 0;

    }

    

    return _yAxisLabelFormatter;

}

And it's being used as you'd expect...

-(NSString*)chartView:(IGChartView*)chartView

         labelForAxis:(IGAxis*)axis

             withItem:(NSObject*)item

{

    NSString *label = nil;

   

    if ([axis isKindOfClass:[IGNumericYAxis class]])

    {

        label = [self.yAxisLabelFormatter stringFromNumber:((NSNumber*)item)];

    }

.....

Parents Reply Children
No Data