Ios-Charts Set Maximum Visible X Axis Values

IOS-Charts set maximum visible x axis values

I finally got it!

The correct answer is:

chart.setVisibleXRangeMaximum(5)

This however needs to be set after the data has been set in the chart (not in a configure before)

This did the trick for me

How to set minimum and maximum of the x axis using iOS-Charts

I just tried below code, works for me.

lineChartView.xAxis.axisMinValue = 100;
lineChartView.xAxis.axisMaxValue = 200;

iOS Charts - set minimum y axis range

For Charts 3 (tried on Charts 3.0.2), this works:

chartView.leftAxis.axisMinimum = 0

By default there is a rightAxis as well (at least for bar charts) and the grid won't be aligned if you don't also set:

chartView.rightAxis.axisMinimum = 0

Note: I wrote this as a comment initially but I think it should be an answer to be easier to find for people who end up here from Google.

X Axis values being repeated rather than replaced iOS Charts

I fixed the issue myself by adding

   chartContainer.xAxis.granularityEnabled = true
chartContainer.xAxis.granularity = 1.0

Set the maximum of the Y-Axis of a LineChartView | pod 'Charts'

Yes, you can set a maximum for y-axis as below by configuring leftAxis and rightAxis properties of the LineChartView instance.

let chartView = LineChartView()

let maxYVal = 4.0 * 10000
chartView.leftAxis.axisMaximum = maxYVal
chartView.rightAxis.axisMaximum = maxYVal

Sample Image

X axis values are getting overlapped - iOS Charts

Try to use following and try, it will work 100 %

cell.chartViewOutlet.xAxis.labelRotationAngle = -45


Related Topics



Leave a reply



Submit