如果两个关闭数据点之间的三角洲太高,CorePlot是否已将其断开图?

发布于 2025-02-12 16:30:32 字数 1200 浏览 0 评论 0原文

我正在尝试在图表上的数据链之间创建一个视觉暂停,因为我需要图形能够断开一段时间,然后卷土重来。

它是一个运行的图形,因此我无法指定该图会破裂的确切位置,但是,每当数据点的值在任何索引下达到0时,它都应该破裂。

这就是我设置图的方式:

   notePlot = CPTScatterPlot()
    let notePlotLineStile = CPTMutableLineStyle()
    notePlotLineStile.lineJoin = .round
    notePlotLineStile.lineCap = .round
    notePlotLineStile.lineWidth = 6
    notePlotLineStile.lineColor = CPTColor.orange()
    notePlot.dataLineStyle = notePlotLineStile
    notePlot.curvedInterpolationOption = .catmullCustomAlpha
    notePlot.interpolation = .curved
    notePlot.identifier = "trueNote" as NSCoding & NSCopying & NSObjectProtocol
    notePlot.dataSource = (self as CPTPlotDataSource)
    notePlot.delegate = (self as CALayerDelegate)x
    graph.add(notePlot, to: graph.defaultPlotSpace)

数据由一系列双打表示。

我提出了两个潜在的解决方案,但是在Coreplot中找不到任何可以解决的工具:删除所有数据点,将其设置为零。但是CorePlot仅具有deletebyIndex,因此我需要一种方法来获取所有值的索引,每当使用图样式选项,只要两个点之间的三角洲都过高,则分解图形,但是,该选项不存在。 我提供了下面的外观示例,应该看起来像:

应该

看起来很正确现在

I am trying to create a visual pause between strands of data on my graph, for that I need the graph to be able to break for some duration and then comeback.

It is a running graph, so I cannot specify the exact places where the graph will break, however, it supposed to break whenever the value of the data point reaches 0 at any Index.

This is how I setup my plots:

   notePlot = CPTScatterPlot()
    let notePlotLineStile = CPTMutableLineStyle()
    notePlotLineStile.lineJoin = .round
    notePlotLineStile.lineCap = .round
    notePlotLineStile.lineWidth = 6
    notePlotLineStile.lineColor = CPTColor.orange()
    notePlot.dataLineStyle = notePlotLineStile
    notePlot.curvedInterpolationOption = .catmullCustomAlpha
    notePlot.interpolation = .curved
    notePlot.identifier = "trueNote" as NSCoding & NSCopying & NSObjectProtocol
    notePlot.dataSource = (self as CPTPlotDataSource)
    notePlot.delegate = (self as CALayerDelegate)x
    graph.add(notePlot, to: graph.defaultPlotSpace)

The data is represented by an array of doubles.

I have came up with two potential solutions, but can't find any tools in CorePlot that would address: delete all of the data points, which value is set to zero. But CorePlot only has deleteByIndex, so I need a way to get the indexes of all points which values are 0. Or break off the graph whenever the delta between two points is too high using the graph style options, however, that option does not exist.
I provided the examples of what it looks like and should look like below:

should

looks like right now

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

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

发布评论

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

评论(1

枉心 2025-02-19 16:30:32

要在绘图行中休息,请从数据源返回nil而不是零(0)。不要试图删除数据点 - 它将在整个间隙上连接绘图线。

To get a break in the plot line, return nil instead of zero (0) from the datasource. Don't try to delete the data point—that will connect the plot line across the gap.

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