我正在繪製使用核心繪圖的繪圖。我試圖在繪圖區域繪製我的圖形,但它包含白色背景。但我想用我自己的背景來繪製圖。這是我的代碼。如何在圖中自定義CorePlot的繪圖區域
// 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;
在上面的代碼中,我試圖改變顏色,但我想繪製y軸上每個刻度的水平虛線。
您對繪圖區域的填充(你有什麼應該工作)疑問或網格線? – 2012-01-07 20:38:34
嘿!埃裏克我想爲y軸上的每個tickMark繪製水平虛線。 – 2012-01-08 13:37:54