旋转饼图,它是带有触摸事件的 CALayer

发布于 2024-11-25 18:33:46 字数 503 浏览 3 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最后的乘客 2024-12-02 18:33:46

我在使用 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 the transform property.

See: http://groups.google.com/group/coreplot-discuss/browse_thread/thread/4372a7590c474c85

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文