我有一个 plist(比如列表date and distance
)。现在我希望将此 Plist 值填充到..但是Bar Graph
从ECGraph
ECGraph 的示例代码..打印我需要每次分配ECGRaphItem
但 Plist 值正在变化。它可能会有所不同在数字中......我无法分配 ECGRaphItem
......bcz plist值每次都会增加......
ECGraph 代码取自 http://code.google.com/p/ecgraph/downloads/detail?name=ECGraphSample.zip
那么如何处理ECGraphItem *item1 = [[ECGraphItem alloc] init];
plist 值...
-(void)ViewDidLoad{
CGContextRef _context = UIGraphicsGetCurrentContext();
ECGraph *graph = [[ECGraph alloc] initWithFrame:CGRectMake(10,10, 480, 320)
withContext:_context isPortrait:NO];
ECGraphItem *item1 = [[ECGraphItem alloc] init];
item1.isPercentage = YES;
item1.yValue = 80;
item1.width = 35;
item1.name = @"A";
ECGraphItem *item2 = [[ECGraphItem alloc] init];
item2.isPercentage = YES;
item2.yValue = 35.3;
item2.width = 35;
item2.name = @"B";
ECGraphItem *item3 = [[ECGraphItem alloc] init];
item3.isPercentage = YES;
item3.yValue = 45;
item3.width = 35;
item3.name = @"C";
NSArray *items = [[NSArray alloc] initWithObjects:item1,item2,item3,item4,item5,nil];
[graph setXaxisTitle:@"name"];
[graph setYaxisTitle:@"Percentage"];
[graph setGraphicTitle:@"Histogram"];
[graph setDelegate:self];
[graph setBackgroundColor:[UIColor colorWithRed:220/255.0 green:220/255.0 blue:220/255.0 alpha:1]];
[graph drawHistogramWithItems:items lineWidth:2 color:[UIColor black]}