问题
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