This is a bar chart with the number of failed banks in the US from 2000 to 2010. I got the idea from Ray Wenderlich's tutorials on the iPhone.
This page describes the class “
FailedBanks” in the PowerPlot demo app.
Creating this chart is very simple with a factory method. However, since the x-axis shows years the default format is not optimal since it has a separator – the year “2000” would be displayed as “2,000” which looks bad for dates. Therefore, we have to manually generate new tick labels with an appropriate
// Create and configure a bar chart. WSChart *barChart = [WSChart barPlotWithFrame:[self.view bounds] data:[DemoData failedBanks] style:kChartBarPlain colorScheme:kColorWhite]; WSPlotAxis *axis = [barChart firstPlotAxis]; NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; [formatter setNumberStyle:NSNumberFormatterDecimalStyle]; [formatter setGroupingSeparator:@""]; [[axis ticksX] setTickLabelsWithFormatter:formatter]; [formatter release]; [barChart setChartTitle:NSLocalizedString(@"Failed banks by year", @"")];
The numbers of bank failures are provided by the
DemoData class. The chart also has a title which is set by the