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
235
IGBarSeries xAxis scale doesn't match data
posted

I have a data point at 4212 yet the graph implies a value < 3000

self.chart = [[IGChartView alloc] init];
self.chart.frame = CGRectMake(0, 0, self.displayView.frame.size.width, self.displayView.frame.size.height);
self.chart.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleBottomMargin;
self.chart.theme = [IGChartDefaultThemes IGTheme];
self.displayView.backgroundColor = [UIColor blackColor];
self.chart.crosshairsVisibility = IGCrosshairsVisibilityVertical;
self.chart.tooltipPinLocation = IGTooltipPinLocationTop;
self.chart.delegate = self;

[self.view addSubview:self.chart];

IGBarSeries *barSeries1 = (IGBarSeries *)[self.chart addSeriesForType:[IGBarSeries class]
usingKey:@"seenSeries"
withDataSource:self
firstAxisKey:@"xAxis"
secondAxisKey:@"yAxis"];
barSeries1.title = @"Seen";
barSeries1.xAxis.extent = 45;
barSeries1.xAxis.interval = 1000;

graph image

The data points (as rendered bottom to top) are:

0.000000
1797.000000
977.000000
2172.000000
1520.000000
4212.000000
971.000000
352.000000

Parents
No Data
Reply
  • 4940
    Offline posted

    How are you creating these values, and what is the code used? I recreated a sample and used the values you specified and get a correct view of the chart. Here's the code I used in the viewDidLoad method:

    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        NSMutableArray *data = [[NSMutableArray alloc] init];
        [data addObject:[NSNumber numberWithDouble:0.0]];
        [data addObject:[NSNumber numberWithDouble:1797.0]];
        [data addObject:[NSNumber numberWithDouble:977.0]];
        [data addObject:[NSNumber numberWithDouble:2172.0]];
        [data addObject:[NSNumber numberWithDouble:1520.0]];
        [data addObject:[NSNumber numberWithDouble:4212.0]];
        [data addObject:[NSNumber numberWithDouble:971.0]];
        [data addObject:[NSNumber numberWithDouble:352.0]];
    
        IGCategorySeriesDataSourceHelper *source = [[IGCategorySeriesDataSourceHelper alloc] initWithValues:data];
    
        IGChartView *chart = [[IGChartView alloc] init];
        chart = [[IGChartView alloc] init];
        chart.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
        chart.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
        chart.theme = [IGChartDefaultThemes IGTheme];
    
        [self.view addSubview:chart];
    
        IGBarSeries *barSeries1 = (IGBarSeries *)[chart addSeriesForType:[IGBarSeries class]
                                                                     usingKey:@"seenSeries"
                                                               withDataSource:source
                                                                 firstAxisKey:@"xAxis"
                                                                secondAxisKey:@"yAxis"];
        barSeries1.title = @"Seen";
        barSeries1.xAxis.extent = 45;
        barSeries1.xAxis.interval = 1000;
    }
    
Children