核心图:如何设置不同尺度的xRange/yRange?

发布于 2024-10-05 22:16:16 字数 644 浏览 0 评论 0原文

我想使用海拔高度作为我的 Y 范围,使用距离作为我的 X 范围。目前,这就是我正在使用的:

plotSpace.xRange = [CPPlotRange 
                        plotRangeWithLocation:CPDecimalFromFloat(0.0) 
                        length:CPDecimalFromUnsignedInteger(sortedArray.count)];
plotSpace.yRange = [CPPlotRange 
                        plotRangeWithLocation:CPDecimalFromFloat(min) 
                        length:CPDecimalFromFloat((max - min))];

这没有正确设置 X 范围,因为它只是将其设置为数组中的点数,约为 2500。我尝试将 xRange 设置为我的最大值距离数组,但这确实把图表弄乱了。

我怎样才能有两个不同的 x 和 y 比例并且仍然使图形正确?

当我将 xRange 更改为我的距离时,图表会变平: 替代文本

I am wanting to use Altitude for my Y range and Distance for my X range. Currently this is what I am using:

plotSpace.xRange = [CPPlotRange 
                        plotRangeWithLocation:CPDecimalFromFloat(0.0) 
                        length:CPDecimalFromUnsignedInteger(sortedArray.count)];
plotSpace.yRange = [CPPlotRange 
                        plotRangeWithLocation:CPDecimalFromFloat(min) 
                        length:CPDecimalFromFloat((max - min))];

That doesn't set the X range correctly, because it just sets it to the number of points in the array, which is about 2500. I have tried setting the xRange to to the max value in my distance array, but that really screws up the graph.

How can I have two different scales for x and y and still have the graph be correct?

Here is what it looks like when I change the xRange to be my distance, the graph goes flat:
alt text

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

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

发布评论

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

评论(1

小清晰的声音 2024-10-12 22:16:16

计算您的最小和最大距离,并使用它们来设置 xRange,计算您的最小和最大高度,并使用它们来设置 yRange。

Calculate your min and max distance and use those to set the xRange and calculate your min and max altitude and use those to set the yRange.

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