I would like bar width equal to 30 pixels.
barData.barWidth let me change it but this is proportional to chart width and number of bars to display, which display a big bar on iPad for only one element.
Do you have an idea?
Thanks.
You Can not fix BarSize
directly in ios-charts but you can change the default ratio width of the bar.
By default barWidth
ratio is 0.85 so based on this it will cover 85% area of the chart if you have only 1 Bar on the chart and if you have 2 it will calculate the ratio based on Bar count so you can set approximate bar width with this property.
Default value:
/// **default**: 0.85
open var barWidth = Double(0.85)
You can set:
let chartData = BarChartData(dataSet: chartDataSet)
chartData.barWidth = Double(0.01)
chartData.barWidth = Double(0.10)
chartData.barWidth = Double(0.25)
chartData.barWidth = Double(0.30)
chartData.barWidth = Double(0.50)
like that you will achieve your fix width between 0.01 to 1.00.
Hope this will helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With