PhilJay / MPAndroidChart

A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.
Other
37.52k stars 9k forks source link

Barchart get resize on every scroll as labels are of different sizes #4049

Open miracledrd opened 6 years ago

miracledrd commented 6 years ago

Summary I am using BarChart by MPAndroidChart in my project. I have long labels in X Axis, so rotating it to 90 degree with setLabelRotationAngle(90f) to show it vertical. And have set mChart.setVisibleXRangeMaximum(5f), to view first 5 bars initially and more on horizontal scrolling. Issue is that long labels get cut off initially and on scrolling chart horizontally, chart will get resize on every scroll as labels are of different sizes. Let me know if code is require to attach here.

Device

Thank you very much.

chenyy0708 commented 5 years ago

I also met the same problem. Have you solved it?

StyZZy commented 5 years ago

Hi, I had the same problem. This fixed it for me (You have to translate it to java, because I´m using the Swift-version): chartView.setViewPortOffsets(left: 0, top: 0, right: 0, bottom: 30) You have to try for yourself what fits best. (I have my x-labels shown at the bottom that´s because I need space at bottom)