Hi,
I'm just in the learning phase of using ios-charts. I like to change the x-axis grid to fixed values.
My plotted y-values are just int numbers like 1, 2, 3,..., 10. Nevertheless the left y-axis shows values like 6.3, 9.1, etc., depending on my zoom level.
The second question is, how to setup the x-axis in order to show the labels 1,5,10,15,....40?
Is there any way to influence the step size like e.g. in Excel?
// zoom y-axis to min/max value
lineChart.leftAxis.customAxisMin = max(0.0, lineChart.data!.yMin - 1.0)
lineChart.leftAxis.customAxisMax = min(10.0, lineChart.data!.yMax + 1.0)
lineChart.leftAxis.startAtZeroEnabled = false
Chart (min = 6.0 and max = 10.0):

The arrangement strongly depends on the min and max value.
Chart (min = 3.0 and max = 10.0):

Thanks for your support.
I identified that something goes wrong in the function internal func computeAxisValues(#min: Double, max: Double) in the class ChartYAxisRenderer. But I do not understand the source code. The function is called 5 times.
What are the following lines exactly doing? Where is the labelCount defined?
var rawInterval = range / Double(labelCount)
var interval = ChartUtils.roundToNextSignificant(number: Double(rawInterval))
var intervalMagnitude = pow(10.0, round(log10(interval)))
var intervalSigDigit = (interval / intervalMagnitude)
You can specify customAxisMin/customAxisMax to whatever values you want
What do you mean with whatever values you want? Are these values ignored?
How can I achieve a well aligned grid?
It means that you specify the minimum/maximum for the Y axis like you want. I'm kind of short on time right now but I wanted to give you an answer anyway, so you should just look at the axis features, or look at the demos :-)
If I have the time later I'll try to give you a more detailed answer
Hi,
I solved the issue by analysing your source code. I forgot to set the labelCount.
lineChart.leftAxis.customAxisMin = max(0.0, lineChart.data!.yMin - 1.0)
lineChart.leftAxis.customAxisMax = min(10.0, lineChart.data!.yMax + 1.0)
lineChart.leftAxis.labelCount = Int(lineChart.leftAxis.customAxisMax - lineChart.leftAxis.customAxisMin)
lineChart.leftAxis.startAtZeroEnabled = false
My issue is that few cases y axis labels are not showing. (for bar and line graphs)
please help me to resolve this.
@ramkrishna880 setLabelsToSkip(0) in your Axis
@danielgindi cant seem to access customAxisMin/customAxisMaxfor combined charts. Is there a way to fixate on the maximum and minimum values for Y-axis in Combined Chart?
Hi again never mind figured this out..
axisMaximum/axisMinimum did the trick.
Such a marvellous plugin. You have no idea how easy you guys have made life for us developers.
A Massive Thank you!!
you can set axis : MinValue="0" in xaml

Hi, Can any body tell me how to specify fixed intervals for y axis. I am using positive negative bar chart.
charts 3.1.1
like 1.1, 1.3, 1.5 intervals for y axis in positive negative bar chart. see the attached image
Thanks

You can specify
customAxisMin/customAxisMaxto whatever values you want
Hi Daniel will these properties also work for Bar chart?
Most helpful comment
Hi again never mind figured this out..
axisMaximum/axisMinimumdid the trick.Such a marvellous plugin. You have no idea how easy you guys have made life for us developers.
A Massive Thank you!!