Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何在饼图中添加数据标签以及如何使用core plot为饼图的图例屏幕设置帧/位置_Iphone_Objective C_Core Plot - Fatal编程技术网

Iphone 如何在饼图中添加数据标签以及如何使用core plot为饼图的图例屏幕设置帧/位置

Iphone 如何在饼图中添加数据标签以及如何使用core plot为饼图的图例屏幕设置帧/位置,iphone,objective-c,core-plot,Iphone,Objective C,Core Plot,我通过以下步骤在iPhone应用程序上实现了一个饼图 这里我有一些问题 我需要在图表上添加另一个数据标签(项目名称) 我尝试实现另一种方法,如 -(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index 在CorePlot.h(我在应用程序中只找到一次)和viewcontroller类中的方法定义中 但是额外的数据标签还没有显示出来 我需要将图例表移动到图表下方,而不是图表旁边 我尝试了frame和

我通过以下步骤在iPhone应用程序上实现了一个饼图

这里我有一些问题

我需要在图表上添加另一个数据标签(项目名称)

我尝试实现另一种方法,如

-(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index 
在CorePlot.h(我在应用程序中只找到一次)和viewcontroller类中的方法定义中

但是额外的数据标签还没有显示出来

我需要将图例表移动到图表下方,而不是图表旁边
我尝试了frame和legendDisplacement,但没有找到结果

数据标签与绘图数据关联,饼图中的每个切片对应一个标签。在您的示例图像中,“每周报告”将是图表
标题

graph.title = @"Weekly Report";
CPTMutableTextStyle *textStyle = [CPTMutableTextStyle textStyle];
textStyle.color                = [CPTColor whiteColor];
textStyle.fontName             = @"Helvetica-Bold";
textStyle.fontSize             = 12.0;
graph.titleTextStyle           = textStyle;
graph.titleDisplacement        = 5.0;
graph.titlePlotAreaFrameAnchor = CPTRectAnchorTop;
您可以使用
legendachor
属性移动图例:

graph.legendAnchor = CPTRectAnchorBottom;

与标题位移类似,
legendDisplacement
,设置图例与其在图形上的定位点之间的边距。

是的,这是移动图例的正确方法,但标题框会固定到每个legendAnchor的特定位置。使其与图形重叠我要将图例从图形上整体移动10像素