MPAndroidchart two Axes overlapping

与世无争的帅哥 提交于 2021-01-29 16:01:03

问题


I have a chart with two datasets displayed on both yAxes. However these datasets overlap each other. Is there a way to display them like a grouped chart side by side over one label

If i use chart.groupBars(0f, 0.8f, 0.1f) the chart gets cut off because the bar width does not scale correctly.


回答1:


OK After a bit more digging around and reading the docs more carefully i found the answer. The sum of your barWidth, barSpace and groupSpace have to be zero, eg in my case with two bars per group:

val barWidth = 0.3
val groupSpace = 0.3
val barSpace = 0.05
val offsetForFirstX = -0.5 // for three bars 0.33 etc
chartView.groupBars(-0.5, groupSpace, barSpace)



回答2:


For any problem on this charts lib

Download & run https://github.com/PhilJay/MPAndroidChart/tree/master/MPChartExample

Make changes to the sample chart you wish to implement with view as required.

Sounds long cut, but we get to understand the working of library with help of documentation and don't get stuck in issues



来源:https://stackoverflow.com/questions/54195298/mpandroidchart-two-axes-overlapping

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!