코어 그래픽을 사용하여 고전적인 선 그래프를 생성하고 있습니다. 코어 그래픽이 포함 된 리본 그래프 (차트)
(나는 내가 위해 사용하고있는 코드를 게시 할 수 있습니다 : "layer.zPosition"
이-(void)drawRect:(CGRect)rect {
float colorChange = (0.1 * [self tag]);
theFillColor = [UIColor colorWithRed:(colorChange) green:(colorChange*0.50) blue:colorChange alpha:0.75f].CGColor;
CGContextRef c = UIGraphicsGetCurrentContext();
CGFloat white[4] = {1.0f, 1.0f, 1.0f, 1.0f};
CGContextSetFillColorWithColor(c, theFillColor);
CGContextSetStrokeColor(c, white);
CGContextSetLineWidth(c, 2.0f);
CGContextBeginPath(c);
//
CGContextMoveToPoint(c, 0.0f, 200-[[array objectAtIndex:0] floatValue]);
CGContextAddLineToPoint(c, 0.0f, 200-[[array objectAtIndex:0] floatValue]);
//
distancePerPoint = (rect.size.width/[array count]);
float lastPointX = 750.0;
for (int i = 0 ; i < [array count] ; i++)
{
CGContextAddLineToPoint(c, (i*distancePerPoint), 200-[[array objectAtIndex:i] floatValue]);
lastPointX = (i*distancePerPoint);
}
//
CGContextAddLineToPoint(c, lastPointX, 200.0);
CGContextAddLineToPoint(c, 0, 200);
CGContextClosePath(c);
//
//CGContextFillPath(c);
CGContextDrawPath(c, kCGPathFillStroke);
//CGContextDrawPath(c, kCGPathStroke);
}
(위의 코드는 다음과 같은 결과를 생성하는)를 사용하여 차례로 쌓아 여러 줄이 있습니다 필요,하지만 난 그것을 할 방법이 CATransform3D rotationAndPerspectiveTransform = CATransform3DIdentity에 의해 일반적으로 경우 3D 효과)
질문 : 가 어떻게 TRAN 수 내 선 그래프에 깊이가 있는지 확인 하시겠습니까? I는 나중에 내가 그들 (위 언급 한 바와 같이) 회전과 관점이
감사합니다. 귀하의 질문이 모두 동일하면 조금만 더 열어 둡니다. 나는 주변에 다른 방법이 있을지도 모른다는 느낌이 들었다. - 그래도 고마워, – chewy