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;
The data points (as rendered bottom to top) are:
0.0000001797.000000977.0000002172.0000001520.0000004212.000000971.000000352.000000
I plugged in your latest code and tested with the trial and retail versions NucliOS. Both times the chart rendered correctly. I've attached a test project you can try out. You will need to add the IGChart framework to the project before running.
- (IGDataPoint *)series:(IGSeries *)series pointAtIndex:(int)index{ IGCategoryPoint *dataPoint = nil; if ([series.key isEqualToString:@"seenSeries"]) { if ( (nil != self.dataPointsSeen) && (index < [self.dataPointsSeen count])) { ATActivityTypeDataItem *dataItem = [self.dataPointsSeen objectAtIndex:index]; dataPoint = [[IGCategoryPoint alloc] initWithValue:dataItem.dataPointValue andLabel:dataItem.label]; } } else if([series.key isEqualToString:@"notSeenSeries"]) { if ( (nil != self.dataPointsNotSeen) && (index < [self.dataPointsNotSeen count])) { ATActivityTypeDataItem *dataItem = [self.dataPointsNotSeen objectAtIndex:index]; dataPoint = [[IGCategoryPoint alloc] initWithValue:dataItem.dataPointValue andLabel:dataItem.label]; } } return dataPoint;}
-(int)numberOfPointsInSeries:(IGSeries *)series
{ int count = 0; if ([series.key isEqualToString:@"seenSeries"]) { count = [self.dataPointsSeen count]; } else if([series.key isEqualToString:@"notSeenSeries"]) { count = [self.dataPointsNotSeen count]; } return count;
}
@interface ATActivityTypeDataItem : NSObject
@property (nonatomic, retain) NSString *activityUuid;@property (nonatomic, retain) NSString *label;@property (nonatomic) double dataPointValue;@property (nonatomic) int16_t displayOrder;@end
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; }