imaNNeo / imaNNeo/fl_chart

axisNameWidget not centered based on axis/chart height

Open
#1,847 2 comments 2 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
7.6k
Forks
2k
Avg merge
9d 1h
Merged PRs (30d)
2

Description

I am using a simple bar chart with a `leftTitles` configuration that includes an `axisNameWidget`.

The title configuration is as follows:

```
AxisTitles(
axisNameWidget: Text(
axisTitle,
style: axisTitleTextStyle,
),
...
)
```

**Expected Behavior:**
I expected the axisNameWidget (the axis name) to be centered relative to the axis/chart height.

**Actual Behavior:**
The axisNameWidget is centered based on the full chart height, which includes:
- The chart itself
- Bottom side titles
- Bottom axis name

As a result, the axis title (as shown in the screenshot) is positioned between the values 20-40, whereas the expected position is between 40-60 (center of the chart).

EDIT: The same issue occurs on the other axis where the title "Months" is positioned between March and April. However, since the center label is April, the expected title position should be directly below April.

**Screenshot:**
![Screenshot_20250113_151024](https://github.com/user-attachments/assets/f16afa4c-2f48-4bbd-bcb2-e3e1c014cc7b)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the simple bar chart with leftTitles and axisNameWidget, then trace how AxisTitles lays out the axis title relative to the chart and surrounding titles. Confirm the current centering behavior on both axes; done means each axis name is centered over the plotted chart area rather than the full widget height.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.