Open ghost opened 9 years ago
Is there a way to get the data for the Y-Axis to start from a certain number in the dataset ?
What do you mean? You have an array [1, 2, 3, 4, 5, 6]
and you only want to draw [4, 5, 6]
? That is not possible.
Currently it's just starting from 0 making large numbers essentially a flat horizontal line at the top of the chart.
Did you try the latest version? It goes from the min up to the max value of your data.
https://github.com/zemirco/swift-linechart/blob/master/linechart/linechart/LineChart.swift#L112
I tried adjusting various draw parts of the code with a getMinimumValue func but it still didn't work.
That's now included. https://github.com/zemirco/swift-linechart/blob/master/linechart/linechart/LineChart.swift#L376
Thanks for the new version.
You have to use latest beta version.
I think I am seeing a related issue. When I create the chart and initially display it there are only a few Y values and they are small (including 0). As data comes in I populate the array and then I do a clear, and redisplay the chart. At some point the array that I am using only contains very large values, but the Y axis is not scaling, resulting in all the values looking like a flat line as in the attached screen capture.
Same issue here. Any update with this? Btw. thank you very much for this library!
I fixed that. Check my pull request please. Thank you.
Unable to set max and min for Y-Axis.
Is there any update for Y-Axis values?
I submitted a PR which addresses this issue. Feel free to use my fork if desired.
I submitted a PR which addresses this issue. Feel free to use my fork if desired.
Still, the number and label value for the y-axis are not set. Is there a way to solve it?
I submitted a PR which addresses this issue. Feel free to use my fork if desired.
Still, the number and label value for the y-axis are not set. Is there a way to solve it?
The vertical axis labels are based on value ranges and will only show value if the range extends below/above the closest "label". You may try to set min/max values to you graph. If that still gives you trouble more information about your data set may be required, like what are the sample values, what are the parameters used for the chart, etc.
func getMinimumValue() -> CGFloat { var minimum = Int.max for data in dataStore { var newMin = data.reduce(Int.max, { min(Int($0), Int($1)) }) if newMin < minimum { minimum = newMin } } return CGFloat(minimum) }