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.85k stars 1.78k forks source link

Vertical grid lines in bar graphs #1149

Open noinskit opened 2 years ago

noinskit commented 2 years ago

BarCharts seem to ignore vertical lines set up in their FlGridData.

I understand from https://github.com/imaNNeoFighT/fl_chart/issues/92 that this was removed on purpose:

we decided to remove the horizontal value concept from the BarChart. That's why we don't show anything.
Feel free to make a new issue to follow up on this decision. I need to understand the use case (Because I think in the barChart the only yAxis is important).

So here's my use case: I've got a screen with several graphs, line and bar, and they all describe the same time range, e.g. last quarter with one datapoint per week. I'd like to put vertical lines in the grid separating months which do not always fall between weeks. It works great in LineChart, but it does not with a BarChart using identical FlGridData.

imaNNeo commented 1 year ago

The problem is that we cannot decide whether to show the bars on the axis values (1, 2, 3, ...) or show them independently on the chart because we support BarChartData.alignment (BarChartAlignment) that is works independently from axis values.

I think we need to support two types of BarCharts

  1. BarChart that is independent of axis values (works with alignment and does not work with the x-axis, they just work with alignment and available space on the screen)
  2. BarChart that is dependent on axis values (we have an x-axis and bars can be aligned with x-axis values and the developer is responsible to take care of showing them)

What do you think?

BTW it is somehow related to #709

Finni123 commented 1 year ago

Are vertical extra lines in bar graph still impossible?

imaNNeo commented 1 year ago

Are vertical extra lines in bar graph still impossible?

Yes, you can follow the thread for the future releases, I will notify you here when we implemented it.

KerimYilPROCON commented 6 months ago

Any updates on this yet? @imaNNeo

pedrostick3 commented 4 months ago

I just came to say that I need this feature too and unfortunatily I'll need to try to make some unnecessary workaround on this...

Iridescentangle commented 4 months ago

I just came to say that I need this feature too and unfortunatily I'll need to try to make some unnecessary workaround on this...

I also found this problem...I thought it was my incorrect settings so I tried so many times but finally found that's a known problem😭 Now I have to put the BarChart into a Stack and use a Positioned widget to achieve the target

jfr3000 commented 1 day ago

Just to +1 the need for this, we have bars based on dates and want to place a dashed line to indicate where a certain key date occured.