在CorePlot中定制显示横轴X的label
来源:互联网 发布:手机安装电视软件 编辑:程序博客网 时间:2024/04/29 18:32
在项目需求中。要画一个点线图。横坐标是 288个数值。代表:每5分钟一个值。每天产生 288个值。
在图表中,只需要显示 4,6,8,10,12,14,16,18,20,22,24 ,这几个整数的label,并且要转换成 文字描述。
参考文章
http://stackoverflow.com/questions/2904562/how-do-you-provide-labels-for-the-axis-of-a-core-plot-chart
注意 这句话:
x.labelingPolicy = CPTAxisLabelingPolicyNone;
First, you set the axis labeling policy to CPTAxisLabelingPolicyNone
to let the framework know you will be providing custom labels, then you create an array of labels with their corresponding locations, and finally you assign that array of labels to the axisLabels
property on the X axis.
// 设置X轴label x.labelingPolicy = CPTAxisLabelingPolicyNone; NSMutableArray *labelArray=[NSMutableArray arrayWithCapacity:288]; for ( int i = 1 ; i<=288 ;i++) { CPTAxisLabel *newLabel ; if(i == 48) { newLabel=[[CPTAxisLabel alloc] initWithText:@"4点" textStyle:x.labelTextStyle]; }else if (i== 72){ newLabel=[[CPTAxisLabel alloc] initWithText:@"6点" textStyle:x.labelTextStyle]; }else if (i== 96){ newLabel=[[CPTAxisLabel alloc] initWithText:@"8点" textStyle:x.labelTextStyle]; }else if (i== 120){ newLabel=[[CPTAxisLabel alloc] initWithText:@"10点" textStyle:x.labelTextStyle]; }else if (i== 144){ newLabel=[[CPTAxisLabel alloc] initWithText:@"12点" textStyle:x.labelTextStyle]; }else if (i== 168){ newLabel=[[CPTAxisLabel alloc] initWithText:@"14点" textStyle:x.labelTextStyle]; }else if (i== 192){ newLabel=[[CPTAxisLabel alloc] initWithText:@"16点" textStyle:x.labelTextStyle]; }else if (i== 216){ newLabel=[[CPTAxisLabel alloc] initWithText:@"18点" textStyle:x.labelTextStyle]; }else if (i== 240){ newLabel=[[CPTAxisLabel alloc] initWithText:@"20点" textStyle:x.labelTextStyle]; }else if (i== 264){ newLabel=[[CPTAxisLabel alloc] initWithText:@"22点" textStyle:x.labelTextStyle]; }else if (i== 288){ newLabel=[[CPTAxisLabel alloc] initWithText:@"24点" textStyle:x.labelTextStyle]; } else{ newLabel=[[CPTAxisLabel alloc] initWithText:@"" textStyle:x.labelTextStyle]; } newLabel.tickLocation=[[NSNumber numberWithInt:i] decimalValue]; newLabel.offset=x.labelOffset+x.majorTickLength; [labelArray addObject:newLabel]; [newLabel release]; } x.title = @"时间"; x.axisLabels=[NSSet setWithArray:labelArray];
- 在CorePlot中定制显示横轴X的label
- coreplot 1.2 中固定x,y轴的位置
- 在Label中显示表情
- JFreechart 时序图 显示x轴数据 横轴数据显示
- Qt中在label中显示不同颜色的字符
- iOS在一个label中显示不同颜色的字体
- CorePlot学习三---自定义CorePlot label及majorGridLine莫名其妙消失的Bug
- 自定义CorePlot label及majorGridLine莫名其妙消失的Bug
- 母版页label值在内容页label中显示
- iOS在label中显示表情
- ASP.NET 在Label中显示换行
- 如何在Label中显示图片
- 在iOS项目中使用CorePlot框架
- powerbuilder的dw中使用graph风格,当横轴是日期时,如何显示才能完整显示日期?
- ZedGraph横轴显示时间
- Ext-JS中Label的style阴影在chrome中汉字显示不正确处理方法
- WinForm中Label控件的换行显示
- label中不同颜色字体的显示
- 启动Eclipse未加载插件,解决方法
- ajax-XHR对象
- Immunity Debugger软件介绍
- 怎么在电脑上安装Android虚拟机
- ADODB入门手册
- 在CorePlot中定制显示横轴X的label
- Excel散点图 如何用平滑线 连接 不连续的点
- 开机自动启动 Ubuntu iBus 输入法
- Storm中Stream的Tuple的几种分发方式
- 项目中的java集锦
- IT编程好书推荐
- Ubuntu 12.04 启动时停在Checking battery state……
- 《驯服烂代码》第一章
- web.xml 中的context-param 、listener、 filter、servlet 加载顺序及其详解