Santosh Singh
Santosh Singh

Reputation: 887

Make barWidth fix in barchart

I am using Charts library. I want to keep chart max width fix. I didn't find any way to restrict to some width.

enter image description here

Upvotes: 3

Views: 2190

Answers (2)

Santosh Singh
Santosh Singh

Reputation: 887

Finally, I am able to find the problem in my code. I was adding long value for X, which was creating the problem. I corrected the X value and everything is perfect :)

BarChartDataEntry(x: Double(x_Value), y: Double(y_Value))

Upvotes: 1

DevB2F
DevB2F

Reputation: 5095

There is a way to make sure the width of a bar is never more than a certain proportion of the screen width. For example setting the setVisibleXRangeMinimum to 10 means each bar will be around 1/10 of the screen width

barChart.setVisibleXRangeMinimum(10.0)

You can also set the maximum:

barChart.setVisibleXRangeMaximum(10.0)

Upvotes: 1

Related Questions