Is it possible to load graph with no animations?
Neilfau opened this issue · comments
Is it possible to instantly load the graph rather than using the animations? Im using the graphs with a large dataset and it takes too long to animate the graph... ive tried setting .shouldAnimateOnStartup to false but then nothing loads.
This is definitely possible. Take a look at the example project, in particular you will want to check out this graph: https://github.com/philackm/ScrollableGraphView/blob/master/graphview_example_code/GraphView/ViewController.swift#L350
This graph loads the points instantly without using the animations. Check that you've set a suitable range using rangeMin and rangeMax as well.
Ok great thank you! Do I have to set the range manually then instead of using shouldAdaptRange?
Okay, yep. I just looked into this and there is a bug.
To do what you want you will need to specify the range manually. Something like:
graphView.shouldAdaptRange = false
graphView.shouldAnimateOnAdapt = false
graphView.shouldAnimateOnStartup = false
graphView.rangeMax = 50
graphView.rangeMin = 0
You should be able to automatically detect the range AND have no animations by doing this:
graphView.shouldAdaptRange = true
graphView.shouldAnimateOnAdapt = false
graphView.shouldAnimateOnStartup = false
However, by setting shouldAnimateOnStartup
to false
whilst shouldAdaptRange
is true
results in the points on the graph not having their correct locations. A strange bug that I don't know when it got introduced. I'll have a look into it. For now, as a workaround, you just need to set the range manually.
Ok great... yeah tested it out and all seems to work when manually setting the range. Thanks for your help!