Bes*_*der 4 iphone graph objective-c core-plot ios
我正在使用核心情节绘制图表.我试图在绘图区域绘制我的图形,但它包含白色背景.但我想用我自己的背景绘制图形.这是我的代码.
// setting frame of graph
CGRect frame = [self.hostingView bounds];
self.graph = [[[CPTXYGraph alloc] initWithFrame:frame] autorelease];
// Add some padding to the graph, with more at the bottom for axis labels.
self.graph.plotAreaFrame.paddingTop = 10.0f;
self.graph.plotAreaFrame.paddingRight = 10.0f;
self.graph.plotAreaFrame.paddingBottom = 25.0f;
self.graph.plotAreaFrame.paddingLeft = 30.0f;
// set background color of plot area by fill property and CPTColor
self.graph.plotAreaFrame.plotArea.fill=[(CPTFill *)[CPTFill alloc] initWithColor: [CPTColor colorWithComponentRed:0.8 green:0.8 blue:0.8 alpha:1.0]];
// add graph to hosting view by hostedGraph property of hostingView
self.hostingView.hostedGraph = self.graph;
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,我试图改变颜色,但我想在y轴上绘制每个刻度线的水平虚线.
这是我上面用过的代码....
// create an object of CPTMutableLineStyle and set property of it.
CPTMutableLineStyle *dottedStyle=[CPTMutableLineStyle lineStyle];
dottedStyle.dashPattern=[NSArray arrayWithObjects:[NSDecimalNumber numberWithInt:1,[NSDecimalNumber numberWithInt:2],nil];
dottedStyle.patternPhase=0.0f;
// set the majorGridLinestyleProperty by this line as.
axisSet.yAxis.majorGridLineStyle=dottedStyle;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4701 次 |
| 最近记录: |