-(void)showPieChart:(Layer *)layer{
PieChart *piechart = [[PieChart alloc] initWithFrame:(CGRectMake(SCREEN_WIDTH-120, SCREEN_HEIGHT-150, 120, 150))];
[piechart setTitle:@"土地规划占比"];
[piechart setBackgroundColor:[UIColor blueColor]];
[piechart setRadious:10.0f];
[piechart setAlpha:0.6];
UIColor *co0 = [UIColor colorWithRed:205.0f/255.0f green:107.0f/255.0f blue:121.0f/255.0f alpha:1.0f];
UIColor *co1 = [UIColor colorWithRed:247.0f/255.0f green:254.0f/255.0f blue:143.0f/255.0f alpha:1.0f];
UIColor *co2 = [UIColor colorWithRed:251.0f/255.0f green:255.0f/255.0f blue:96.0f/255.0f alpha:1.0f];
UIColor *co3 = [UIColor colorWithRed:231.0f/255.0f green:145.0f/255.0f blue:143.0f/255.0f alpha:1.0f];
UIColor *co4 = [UIColor colorWithRed:202.0f/255.0f green:162.0f/255.0f blue:126.0f/255.0f alpha:1.0f];
UIColor *co5 = [UIColor colorWithRed:143.0f/255.0f green:222.0f/255.0f blue:251.0f/255.0f alpha:1.0f];
UIColor *co6 = [UIColor colorWithRed:60.0f/255.0f green:109.0f/255.0f blue:39.0f/255.0f alpha:1.0f];
NSNumber *num1 = [NSNumber numberWithFloat:0.0716f];
NSNumber *num2 = [NSNumber numberWithFloat:0.0858f];
NSNumber *num3 = [NSNumber numberWithFloat:0.1572f];
NSNumber *num4 = [NSNumber numberWithFloat:0.1662f];
NSNumber *num5 = [NSNumber numberWithFloat:0.1666f];
NSNumber *num6 = [NSNumber numberWithFloat:0.1762f];
NSNumber *num7 = [NSNumber numberWithFloat:0.1764f];
NSArray *va0 = [NSArray arrayWithObject:num1];
NSArray *va1 = [NSArray arrayWithObject:num2];
NSArray *va2 = [NSArray arrayWithObject:num3];
NSArray *va3 = [NSArray arrayWithObject:num4];
NSArray *va4 = [NSArray arrayWithObject:num5];
NSArray *va5 = [NSArray arrayWithObject:num6];
NSArray *va6 = [NSArray arrayWithObject:num7];
ChartPieData *piedata1 = [[ChartPieData alloc] initWithItemName:@"城镇建设用地" value:va0 color:co0 ID:234];
ChartPieData *piedata2 = [[ChartPieData alloc] initWithItemName:@"一般农用地" value:va1 color:co1 ID:2];
ChartPieData *piedata3 = [[ChartPieData alloc] initWithItemName:@"基本农田保护区" value:va2 color:co2 ID:3];
ChartPieData *piedata4 = [[ChartPieData alloc] initWithItemName:@"村镇建设用地" value:va3 color:co3 ID:4];
ChartPieData *piedata5 = [[ChartPieData alloc] initWithItemName:@"独立工矿用地区" value:va4 color:co4 ID:5];
ChartPieData *piedata6 = [[ChartPieData alloc] initWithItemName:@"其它用地区" value:va5 color:co5 ID:6];
ChartPieData *piedata7 = [[ChartPieData alloc] initWithItemName:@"生态环境安全控制区" value:va6 color:co6 ID:7];
NSArray *dataset = [NSArray arrayWithObjects:piedata1, piedata2, piedata3, piedata4, piedata5, piedata6, piedata7, nil];
[piechart addChartDatas:dataset];
[layer addChart:piechart];
[piechart startPlay];
}
以上为我写的显示饼状图的方法,参数为layer,不报错,但是也没有显示出来饼状图。
怎么解决问题???