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
You can make use of IGChartViewDelegate. It has the method chartView:labelForAxis:withItem: that you can use to customize the string used on a specific axis. I've reattached the project to include the usage of this method. As before, add your copy of IGChart.framework.
Hi Torrey,
I implemented your code snippet but getting error when transforming the data for line series & column series by interchanging as i want to implement Years in X-Axis and countries in Y-Axis.The code you sent me is perfect for bar series.Could u please help me in this regard.
Regards,
kaushik.
Thank u very much Torrey.What i expected is the same you have posted in the sample code.Many Thanks for quick reply.
Hi Kaushik,
Attached you'll find an example project that wires up JSON data to the IGChartView. The requirements for using the JSON API's is iOS 5+. In addition, you will need to add the IGChart.framework to the project. I have removed it from this example, so you can reference your copy.
To summarize what is necessary to connect JSON data to the IGChartView, you take the returned JSON dictionary and get the array of data records by key lookup. By iterating through this array, we create a business class object that represents the data record and add it to a mutable array. It's this array that will be referenced when using a data source helper.
If you have any questions about the source code, let me know.
Thanks for the sample project: It helped to isolate the issue.
To view the issue, please make the following additions to the sample project:
1) Switch back to to 5.1
2) Allow igViewController to rotate its orientation.
3) Inside of the (IGDataPoint *)series:pointAtIndex: method, force the label to be pinned to a value of length > 20.
The issue seems to lie with the label associated with the datapoint.
If the label is "long", in my case the longest label length is 33 (customer specified labels), then the graph will not render any bars in a portrait orientation (iPhone).
Rotating the orientation to landscape, will render the bars, but they will not be accurate to the scale.
The same behaviour is exhibited with both iPad and iPhone form factors.