简体   繁体   English

ios图表-通过拖放更改Y轴值

[英]ios-charts - Changing Y axis value by a drag and drop

I am using ios-charts library to draw charts on a swift2 app. 我正在使用ios-charts库在swift2应用上绘制图表。 I am wondering if, for a given X value, I can change its Y associated value by a drag and drop gesture on the chart. 我想知道对于给定的X值,是否可以通过在图表上进行拖放手势来更改其Y关联值。

If this is not possible on this library, is it possible to do such a thing using another library? 如果在该库上无法做到这一点,是否可以使用另一个库来做这样的事情?

technically you can. 从技术上讲您可以。 Every time you scroll/zoom the chart, it will trigger a redraw, so everything is redrawing, you can decide your own logic how you want the y axis value changed. 每次滚动/缩放图表时,都会触发重绘,因此一切都在重绘,您可以决定自己的逻辑来更改y轴值。

It has two parts: 它分为两个部分:

In computeAxisValues in y axis renderer, the y axis labels(values) are determined. 在y轴渲染器中的computeAxisValues中,确定y轴标签(值)。 Then in renderAxisLabels , it is drawn using the calculated values. 然后在renderAxisLabels ,使用计算出的值对其进行绘制。

So you can take a look at these functions and implement your logic. 因此,您可以看一下这些功能并实现您的逻辑。 Note, it's your responsibility to make sure what you are doing is valid in your scenario, because if something weird happens, you may not get support on github, because it's not a bug, and sometimes not easy to answer. 请注意,确保您的工作在您的情况下有效是您的责任,因为如果发生奇怪的事情,您可能不会在github上获得支持,因为它不是bug,有时也不容易回答。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM