旋转饼图,它是带有触摸事件的 CALayer
我正在使用 core-plot 来绘制饼图。我在 CPTPieChart.h 的触摸拖动事件中使用此代码。
-(BOOL)pointingDeviceDraggedEvent:(id)event atPoint:(CGPoint)interactionPoint{
int x = self.anchorPoint.x;
int y = self.anchorPoint.y;
float dx = interactionPoint.x - x;
float dy = interactionPoint.y - y;
double a = atan2(dx,dy);
self.transform = CATransform3DMakeRotation(a, 0, 0, 1);
return YES;
}
饼图正在轻微旋转,但顶部和底部在旋转时会被剪裁。 任何帮助将不胜感激。谢谢!
Iam using core-plot for drawing pie charts. I am using this code in the touch drag event of the CPTPieChart.h.
-(BOOL)pointingDeviceDraggedEvent:(id)event atPoint:(CGPoint)interactionPoint{
int x = self.anchorPoint.x;
int y = self.anchorPoint.y;
float dx = interactionPoint.x - x;
float dy = interactionPoint.y - y;
double a = atan2(dx,dy);
self.transform = CATransform3DMakeRotation(a, 0, 0, 1);
return YES;
}
The piechart is rotating mildly but the top and bottom portion are clipping upon rotating.
Any help will be greatly appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在使用
transform = CATransform3DMakeRotation(a, 0, 0, 1)
旋转 CPTPieChart 时遇到了相同的裁剪问题。不太确定是什么原因造成的。我通过更改
startAngle
属性而不是transform
属性来解决这个问题。请参阅:http://groups.google.com/group/coreplot-discuss /browse_thread/thread/4372a7590c474c85
I encountered the same clipping problem when rotating a CPTPieChart using
transform = CATransform3DMakeRotation(a, 0, 0, 1)
. Not exactly sure what's causing it.I worked around it by altering the
startAngle
property instead of thetransform
property.See: http://groups.google.com/group/coreplot-discuss/browse_thread/thread/4372a7590c474c85