Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.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
Ios 设置核心打印图表图例项的样式_Ios_Objective C_Xcode_Charts_Core Plot - Fatal编程技术网

Ios 设置核心打印图表图例项的样式

Ios 设置核心打印图表图例项的样式,ios,objective-c,xcode,charts,core-plot,Ios,Objective C,Xcode,Charts,Core Plot,我刚开始使用CorePlot库,到目前为止,我正在设法完成一些工作 我正在尝试创建一个带有一些虚拟数据的piechart,或多或少一切都按照预期进行,但就我而言,我找不到如何设置图例项的样式,使它们看起来像这样: theLegend.numberOfColumns = 1; theLegend.fill = [CPTFill fillWithColor:[CPTColor whiteColor]]; theLegend.borderLineStyle = [CPTLineStyle lineSt

我刚开始使用CorePlot库,到目前为止,我正在设法完成一些工作

我正在尝试创建一个带有一些虚拟数据的piechart,或多或少一切都按照预期进行,但就我而言,我找不到如何设置图例项的样式,使它们看起来像这样:

theLegend.numberOfColumns = 1;
theLegend.fill = [CPTFill fillWithColor:[CPTColor whiteColor]];
theLegend.borderLineStyle = [CPTLineStyle lineStyle];
theLegend.cornerRadius = 5.0;
theLegend.swatchSize = CGSizeMake(7, 50);
theLegend.rowMargin = 5.0;
我可以用背景色、边框设置整个图例的样式,如下所示:

theLegend.numberOfColumns = 1;
theLegend.fill = [CPTFill fillWithColor:[CPTColor whiteColor]];
theLegend.borderLineStyle = [CPTLineStyle lineStyle];
theLegend.cornerRadius = 5.0;
theLegend.swatchSize = CGSizeMake(7, 50);
theLegend.rowMargin = 5.0;
以及样本大小和行边距,如下所示:

theLegend.numberOfColumns = 1;
theLegend.fill = [CPTFill fillWithColor:[CPTColor whiteColor]];
theLegend.borderLineStyle = [CPTLineStyle lineStyle];
theLegend.cornerRadius = 5.0;
theLegend.swatchSize = CGSizeMake(7, 50);
theLegend.rowMargin = 5.0;
等等,但是有没有办法设计图例背景和边框的单行样式

如果没有,你会建议我如何解决这个问题


谢谢您的帮助,干杯您可以使用
-attributedLegendTitleForPieChart:recordIndex:
饼图数据源方法为每个图例条目提供标签文本。属性化字符串可以表示文本颜色、粗体文本和不同的文本大小。有关演示,请参见Plot Gallery示例应用程序中的“简单饼图”。在字符串中插入换行符(
\n
)以生成第二行文本

当前无法将图例条目背景与整个图例的背景分开设置样式。请在核心图中添加增强请求


您可以使用注释构建自己的自定义图例。使用
CPTBorderedLayer
作为背景,并为每个图例条目添加图层注释。使用
CPTBorderedLayer
绘制样例,使用
CPTTextLayer
绘制文本标签。

非常感谢,现在使用带有换行符的
-attributedLegendTitleForPieChart:recordIndex:
效果很好,但我想在某个时候,我会按照您的建议尝试创建自己的图例。再次感谢您的回答和一个很好的工作库。干杯