zemirco / swift-linechart

Line Chart library for iOS written in Swift
602 stars 68 forks source link

Y-Axis-Labels doesn't doesn't show max value, and can't determine values manually #17

Open MarkLyck opened 9 years ago

MarkLyck commented 9 years ago

I'm drawing the line-Charts shown below.

However, the y-values are not very useful in light of my dataset: lineChart.addLine([0, -2, 1, 7, 9])

It shows 0 and 5? In this case, the logical numbers to show would be -2, 0 and 9

img_0066_2

(To make it only show 2 numbers. I had to decrease the grid size with: lineChart.y.grid.count = 3) What I was hoping to happen is to see 3 numbers. Not 2...

I also tried changing it to 4, but the numbers are way to close together, and it still only goes up to "8" not 9, making the chart more misleading than the last one.

If I don't specify the y.grid.count at all. There's way too many y labels overlapping each other.

I tried adding the values manually with: lineChart.y.labels.values = ["-2","0","9"] but that does nothing at all?

Also enhancement ideas.

Make the x axis, the lowest number in the array. (it's hardcoded to 0 right now), I had to change it manually to make it work for me.

Add an optional line at 0, and make an option for dashing it.

Make the font,size and color of the labels customisable.