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.5k stars 9.01k forks source link

BarChart如何设置每个柱状图的宽度 #5467

Open SaiKeiSi opened 1 month ago

SaiKeiSi commented 1 month ago

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Describe alternatives you've considered

Additional context

ADD A REWARD using Speed to SOLVE this issue QUICKLY and SUPPORT this project.

SaiKeiSi commented 1 month ago

相信有遇到和我一样的问题 添加每个柱状图后 宽度会随着减少 设置的宽度并不可用 可以尝试如下解决 原: barWidth = 0.3f 现在: barWidth = if (loadList.size<7) loadList.size * 0.055f else 0.3f

原理 Barchart总宽度为1 设置没个后 总占比0.3 然后 就需要你就算出每个的宽度if (list.size<7) list.size * 0.055f else 0.3f