核心图:显示数据点标签,或者数据点何时被触摸?

发布于 2024-10-05 16:37:59 字数 196 浏览 0 评论 0原文

有没有办法使用 Core Plot 将周期性标签分配给数据图?例如在我的情节点上列出 10-20 个标签。

这是我希望做的事情的示例(模型): alt text

是否可以在图表加载时执行此操作,或者当您在图表上滑动时您会看到数据点显示他们的呼唤?

Is there a way using Core Plot to have periodic labels assigned to data plots? Such as 10-20 labels listed across my plot points.

Here is an example (mockup) of what I am hoping to do:
alt text

Is it possible to do this when the graph loads, or maybe when you swipe across the graph you see the data points showing their call out?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

落叶缤纷 2024-10-12 16:37:59

您必须自己绘制标注气泡,但可以标记数据点。要进行标注,您可以子类化 CPTextLayer 并让它在文本周围绘制气泡。使用这个新类来制作标签。

您可以实现一个数据源方法来通知 Core Plot 哪些数据点应该被标记,并根据需要提供您自己的标签(这就是您进行标注的方式)。您还可以响应触摸事件(Mac 上的单击事件)并显示触摸点的标签。您必须单独触摸每个点 - 如果您从一个点拖动到下一个点,您将不会收到委托通知。

Core Plot 中包含的示例演示了这两种技术的工作原理。

You'll have to draw the callout bubbles yourself, but it is possible to label data points. To make a callout, you could subclass CPTextLayer and have it draw the bubble around the text. Use this new class to make your labels.

You can implement a datasource method to inform Core Plot which data points should be labeled and provide your own labels if you wish (this is how you'd do the callouts). You can also respond to touch events (click events on the Mac) and show a label for the point that was touched. You have to touch each point individually--you won't get the delegate notification if you drag from one point to the next.

The examples included with Core Plot demonstrate how both techniques work.

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