2011-08-24 4 views
1

나는 방금 1 시간의 수업을 탐색하고 있었고 그것을 찾을 수 없다! 나는 AAPLot 프로젝트의 예제를 검색했다.배경색을 설정할 위치는?

그래프를 조금 바꿔서 CPTTradingRangePlot 클래스의 모든 설정을 찾으려고했지만 거기에 있지 않습니다.

내가 변경할 수있는 많은 속성이 있지만 어떤 클래스에서도 배경 설정을 찾을 수 없습니다.

누구든지 내게 힌트를 줄 수 있습니까? 핵심 플롯에서

// OHLC plot 
CPTMutableLineStyle *whiteLineStyle = [CPTMutableLineStyle lineStyle]; 
whiteLineStyle.lineColor = [CPTColor whiteColor]; 
whiteLineStyle.lineWidth = 1.0f; 
CPTTradingRangePlot *ohlcPlot = [[[CPTTradingRangePlot alloc] initWithFrame:graph.bounds] autorelease]; 
ohlcPlot.identifier = @"OHLC"; 
ohlcPlot.lineStyle = whiteLineStyle; 
ohlcPlot.barWidth = 4.0f; 
ohlcPlot.increaseFill = [(CPTFill *)[CPTFill alloc] initWithColor:[CPTColor greenColor]]; 
ohlcPlot.decreaseFill = [(CPTFill *)[CPTFill alloc] initWithColor:[CPTColor redColor]]; 
    CPTMutableTextStyle *whiteTextStyle = [CPTMutableTextStyle textStyle]; 
whiteTextStyle.color = [CPTColor whiteColor]; 
    whiteTextStyle.fontSize = 12.0; 
    ohlcPlot.labelTextStyle = whiteTextStyle; 
    ohlcPlot.labelOffset = 5.0; 
ohlcPlot.stickLength = 2.0f; 
ohlcPlot.dataSource = self; 
ohlcPlot.plotStyle = CPTTradingRangePlotStyleCandleStick; 
[graph addPlot:ohlcPlot]; 

답변

0

나는 결국 혼자서 그것을 발견했습니다. 차트의 배경은 테마로 관리됩니다. 코어 플롯 라이브러리의 폴더 테마에는 여러 테마 파일이 있으며 그 중 하나는 CPTStocksTheme입니다. CPTStocks 테마는 변경할 수있는 파란색 그라디언트 배경을 만듭니다.

+0

Chris Hodges 예제와 같이 작동하는 것이 가장 쉽고 쉬운 방법입니다. – Reimius

2

배경은 CPTFill이 코드 샘플에서 increaseFilldecreaseFill와 유사한 개체를 사용하여 설정된다. 달성하고자하는 모양에 따라 , graph.plotAreaFrame 및/또는 graph.plotAreaFrame.plotArea의 채우기를 설정해야합니다. CPTTestApp의 Mac 버전의 축 데모는 세 부분 모두에서 채우기를 사용하므로 다른 부분을 볼 수 있습니다.

1

CPTColor를 사용하여 xAxis 또는 yAxis에서 설정할 수 있습니다.

축 배열. 매개 변수 : [CPTColor redColor]

14

다음은 아주 간단한 예입니다. 이 :

CPTColor *your_color = [CPTColor colorWithComponentRed:1 green:0 blue:0 alpha:1]; 
your_graph.fill = [CPTFill fillWithColor:your_color]; 

그래프 배경을 빨간색으로 바꿉니다. 에릭 Skroch 말했듯이, 당신은 당신이 달성하고자하는 결과에 따라 ... 이렇게

your_graph.plotAreaFrame.fill = [CPTFill fillWithColor:your_color]; 

및/또는이 ...

your_graph.plotAreaFrame.plotArea.fill = [CPTFill fillWithColor:your_color]; 

을 할 수 있습니다.

관련 문제