Search code examples
iosswiftios-charts

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


I am using ios-charts library to draw charts on a swift2 app. 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.

If this is not possible on this library, is it possible to do such a thing using another library?


Solution

  • 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.

    It has two parts:

    In computeAxisValues in y axis renderer, the y axis labels(values) are determined. Then in renderAxisLabels, it is drawn using the calculated values.

    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.