Displaying data visualizations with REST API
This example collects data for display in third-party visualization code using an chart data object of strings, arrays, and dictionaries. When a user makes a selection from a list of locations, the chart data object and user interface update with data about the selected location.
The following overview describes this functionality in the iOS example application:
*An object of strings, arrays, and dictionaries is defined in BIRTChartData.h. This object contains values associated with the user selection.
*User makes a selection from the list of locations and triggers an update to the chart data object. The user selection calls updateView.
*The updateView function creates a new BIRTChartData object and loads it with data about the selected location.
*The BIRTChartData object is passed to each of the chart view controllers for display, as shown in the following code:
The following Objective-C code shows the BIRTChartData object used in a chart:
-(void) updateView {
_titleLabel.text = self.userData[@"name"];
 
BIRTChartData *chartData = [[BIRTChartData alloc] init];
[chartData setWorldData:self.worldData];
[chartData setSelectedYear:@"2000"];
[chartData setUserName:self.userName];
[chartData setPassword:self.password];
[chartData setDataObjectId:_dataObjectId];
[chartData setContAbb:self.userData[@"Cont_Abb"]];
[chartData setRegAbb:self.userData[@"Reg_Abb"]];
[chartData setCountAbb:self.userData[@"Count_Abb"]];
[chartData setAuthId:self.authId];
[chartData setUserData:self.userData];
[chartData setContAbbs:self.contAbbs];
for (UIViewController *child in self.childViewControllers) {
if ([child isKindOfClass:[BIRTColumnChartViewController class]]) {
BIRTColumnChartViewController *chart = (BIRTColumnChartViewController *)child;
[chart setChartData:chartData];
[chart setRefreshView:TRUE];
[chart viewWillAppear:YES];
}
 
if ([child isKindOfClass:[BIRTBarChartViewController class]]) {
BIRTBarChartViewController *chart = (BIRTBarChartViewController *)child;
[chart setChartData:chartData];
[chart setRefreshView:TRUE];
[chart viewWillAppear:YES];
}
if ([child isKindOfClass:[BIRTPieChartViewController class]]) {
BIRTPieChartViewController *chart = (BIRTPieChartViewController *)child;
[chart deleteValues];
[chart setChartData:chartData];
[chart setRefreshView:TRUE];
[chart viewDidAppear:YES];
}
}
}
See the source code for the complete example.