@PhilJay thank your awsome chart project! recently I am studying your project in order to apply some features in my project,I meet some problems, it makes me confused.
①:whether barchart support set max scale? it seems barchart can be scaled infinite,
②:can I set a fixed bar width? as the first question
③:I want to display bar start from Y axis edge,so I modified the demo project BarChartActivity,original in the demo the code in function setData
float mult = (range + 1);
float val = (float) (Math.random() * mult);
yVals1.add(new BarEntry(i+1f, val));I just modified to
float mult = (range + 1);
float val = (float) (Math.random() * mult);
yVals1.add(new BarEntry(i, val));
here is comparison result




We can clearly see that if let bar display from Y axis edge(yVals1.add(new BarEntry(i, val)); ) ,the first bar seems only display half of itself,so what is this problem? is there some more attribute need to set?I would be grateful if you can answer me!
try this.
chart.setFitBars(true)
@BottleTasteApp but I have already set it! because I tried various ways,but not working,so I raised the issue,I don't konw how to make it working!
fuck! finally I found a perfect way to solve this issue! just setAxisMinimum and setAxisMaximum it work perfectly!
mChart.getXAxis().setAxisMinimum(-data.getBarWidth()/2);
mChart.getXAxis().setAxisMaximum(count-data.getBarWidth()/2);
remember you must set it after BarData instantiation to let it work!
horizontal bar same issue
fuck! finally I found a perfect way to solve this issue! just setAxisMinimum and setAxisMaximum it work perfectly!
mChart.getXAxis().setAxisMinimum(-data.getBarWidth()/2); mChart.getXAxis().setAxisMaximum(count-data.getBarWidth()/2);
remember you must set it after BarData instantiation to let it work!
This is also useful if you have less bars than the expected, but still want them to have a set width, instead of the bars spreading across the original chart width
@PhilJay i think if this is resolved with the previous comment shall we close this issue?
Most helpful comment
fuck! finally I found a perfect way to solve this issue! just setAxisMinimum and setAxisMaximum it work perfectly!
mChart.getXAxis().setAxisMinimum(-data.getBarWidth()/2); mChart.getXAxis().setAxisMaximum(count-data.getBarWidth()/2);remember you must set it after BarData instantiation to let it work!