2013-03-06 45 views
1

在我CorePlot實現我有一個網格線樣式,看起來像這樣:自定義CorePlot gridLineStyle

enter image description here

我實現它那樣簡單:

CPTMutableLineStyle *gridLineStyle = [CPTMutableLineStyle lineStyle]; 
gridLineStyle.lineColor = [CPTColor grayColor]; 
gridLineStyle.lineWidth = 0.6f; 

我想什麼但看起來是這樣的線條樣式:

enter image description here

任何想法如何自定義CPTMutableLineStyle使我的線是這樣的? CorePlot在CorePlotExamples示例項目中沒有找到類似的東西。謝謝。

回答

2

核心繪圖支持大部分內置Core Graphics線條繪圖屬性。 dashPattern是您需要的財產。它支持簡單的虛線或虛線以及更復雜的破折號圖案。

繪圖庫中的「控制圖」示例示例應用程序顯示了幾個示例。

+0

令人驚歎!救了我!我這樣做:'CPTMutableLineStyle * gridLineStyle = [CPTMutableLineStyle lineStyle]; gridLineStyle.lineColor = [CPTColor grayColor]; gridLineStyle.dashPattern = [NSArray arrayWithObjects:[NSNumber numberWithInteger:1],[NSNumber numberWithInteger:5],nil]; gridLineStyle.lineWidth = 0.3f;' – 2013-03-07 11:49:23