2
sliceWasSelectedAtRecordIndex:
メソッドがコアプロットで呼び出されたときに円グラフのスライスカラーと同じUILabel
オブジェクトの色を設定するにはどうすればよいですか?この方法でグラデーションカラーでスライスを塗りつぶしています。Objective C Core Plot:円グラフの凡例
-(CPTFill *)sliceFillForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)index
{
sectorColour=[[[CPTFill alloc]init]autorelease];//creating a sector color object
if (index == 0) {
//creating cptcolor
CPTColor *areaColor1 = [CPTColor colorWithComponentRed:0.0
green:0.7
blue:1.0
alpha:1.0];
CPTColor *areaColor2 = [CPTColor colorWithComponentRed:0.0
green:0.1
blue:0.2
alpha:1.0];
UIColor *color1=[UIColor colorWithRed:0.0 green:0.7 blue:1.0 alpha:1.0];
UIColor *color2=[UIColor colorWithRed:0.0 green:0.1 blue:0.2 alpha:1.0];
//filling with gradient color with CPTColor
CPTGradient *areaGradientUI = [CPTGradient gradientWithBeginningColor:(CPTColor *)color1 endingColor:(CPTColor *)color2];
sectorColour=[CPTFill fillWithGradient:areaGradientUI];
}
}