CPTBarPlot(Core-Plot)上的定位标签 [英] Positioning label on CPTBarPlot (Core-Plot)

查看:133
本文介绍了CPTBarPlot(Core-Plot)上的定位标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Core-Plot更改条形图中标签的默认位置. 我正在使用这种方法:

I am trying to change default position of labels in Bar chart with Core-Plot. I am using this method:

-(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)idx;

然后我返回:

return textLayer = [[CPTTextLayer alloc] initWithText:@"2222" style:textStyle];

我得到这个结果:

但我想显示如下:

有什么主意吗?我试图找到有关文档的答案,但是我不可能.

Any idea? I tried to find answer on documentation, but I has been impossible.

推荐答案

对条形图使用负数labelOffset.默认值为+10,这会将标签置于条形上方10个像素.此属性是从CPTPlot继承的,因此它适用于所有绘图类型,尽管默认值和行为有所不同.

Use a negative labelOffset for the bar plot. The default is +10 which puts the labels 10 pixels above the bars. This property is inherited from CPTPlot so it works for all plot types, although the default value and behavior varies somewhat.

这篇关于CPTBarPlot(Core-Plot)上的定位标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆