imaNNeo / fl_chart

FL Chart is a highly customizable Flutter chart library that supports Line Chart, Bar Chart, Pie Chart, Scatter Chart, and Radar Chart.
https://flchart.dev
MIT License
6.7k stars 1.73k forks source link

Specify GraphArea height for barChart #1611

Open Priyantha-Kingslake opened 5 months ago

Priyantha-Kingslake commented 5 months ago

There are times where I need my bottom titles to be tilted because they are too long. when I tilt them, they occupy a vertical space that otherwise would be used to draw the graph. This causes the vertical space of the drawn graph to differ when the bottomTitles are dynamic.

I want to be able to fix a vertical height for the drawn graph EXCLUDING space occupied by titles. I am fine with the user having to scroll down if they need to read the titles. I just need the visual graph to be consistent.

example images image image

imaNNeo commented 4 months ago

If you're okay with letting users scroll more, then you can increase the whole height of your chart. This way, you have more space for the bars. Have you tried this approach?

Priyantha-Kingslake commented 4 months ago

I kinda ended up with doing something like that. Here the reserved size for my bottomTitles is dynamically calculated depending on the length of the text that needs to be displayed. I set the height for the parent of the graph to be (required GraphArea constant + calculated bottomTitles-size)