2014-02-08 2 views
0

분산 플롯에 CorePlot을 사용하고 있으며 여기에있는 색상 효과로 분산 플롯의 원을 얻는 방법을 알고 싶습니다. http://i.stack.imgur.com/7ZcqY.jpg 색상은 CPTXYScatterPlot - Can I set the Z order of plot symbols?입니다. iOS 코어 플롯 - 분산 플롯 기호 색상 모양

CPTPlotSymbol *circlePlotSymbol = [CPTPlotSymbol ellipsePlotSymbol]; 

// Obviously for a real bubble chart you'll want to get the color from somewhere so they're not all the same 
CPTColor *endColor = [CPTColor redColor]; 
CPTColor *startColor = [endColor colorWithAlphaComponent:0.4f]; 
CPTGradient *gradient = [CPTGradient gradientWithBeginningColor:startColor endingColor:endColor]; 

그런 다음 방사형으로 그라데이션 유형을 설정하고 plotSymbol에 채우기로 그라데이션을 설정하여 symbolForScatterPlot 구현에서

답변

0

는,과 같이, 그라데이션 채우기와 circlePlotSymbol를 만들 수 있습니다. 이 각도에서 조명처럼 당신이보고 싶을 경우, 포인트 서비스 센터에 startAnchor을 설정할 수 있습니다

gradient.gradientType = CPTGradientTypeRadial; 
graphGradient.startAnchor = CGPointMake(0.35, 0.75); 
circlePlotSymbol.fill = [CPTFill fillWithGradient:gradient]; 

이 서클 주변에 테두리를 원하지 않는 경우, 취소, 이는 linestyle 색상을 설정하고 플롯 기호를

// For a real bubble chart, you'll need to calculate this from your data 
circlePlotSymbol.size = CGSizeMake(50.0f, 50.0f); 

반환 :

CPTMutableLineStyle *lineStyle = [[CPTMutableLineStyle alloc] init]; 
lineStyle.lineColor = [CPTColor clearColor]; 
lineStyle.lineWidth = 0.0f; 
circlePlotSymbol.lineStyle = lineStyle; 
[lineStyle release]; 

이 거품의 크기를 설정합니다/또는 0.0f로의 너비를 설정 (아마 모두를 수행 할 필요가 없습니다)

return circlePlotSymbol; 

그렇게해야합니다. 나는 내 앞에서 내 코드가 없으므로 여기에서 메모리로 갈 것이다. (그리고 컴파일러에 접근 할 권한이 없기 때문에 오타 나 잘못된 구문을 용서해 주길 바란다.) 그러나 잘하면이게 가까이있을 것이다. 당신을 올바른 방향으로 인도 할 수있을만큼 충분합니다.

+0

하지만 당신이 얻는 효과를 얻을 수 없습니다. 플롯에서 각 원에 대해 가장 밝은 점은 중심에 있지 않고 상단으로 기울어 져 있습니다. – Dinesh

+0

@Dinesh - 단계를 잊어 버렸기 때문에 ... 그라디언트의 startAnchor 속성을 중심에서 벗어난 값으로 설정하십시오. 위에서 편집 한 코드. –