imaNNeo / imaNNeo/fl_chart

TitlesData disappears on LineChartData if minY is greater than maxY

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

Description

My LineChart is correctly drawn when using maxY greater than minY:

```
LineChart(
LineChartData(
minX: 1,
maxX: 18,
minY: 3,
maxY: -3,
borderData: FlBorderData(show: false),
lineTouchData: const LineTouchData(enabled: false),
titlesData: FlTitlesData(
show: true,
topTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
getTitlesWidget: (value, meta) {
return Center(
child: Text(
value.toInt().toString(),
style: const TextStyle(
fontSize: 8,
color: Colors.black,
),
textAlign: TextAlign.center,
),
);
},
),
),
bottomTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
leftTitles: AxisTitles(
sideTitles: SideTitles(
showTitles: true,
getTitlesWidget: (value, meta) {
final formattedValue =
(-3 - value).toInt().toStringAsFixed(2);

return Text(
formattedValue,
style: const TextStyle(
fontSize: 8,
color: Colors.black,
),
);
},
),
),
rightTitles: const AxisTitles(
sideTitles: SideTitles(showTitles: false),
),
),
lineBarsData: [
LineChartBarData(
color: Colors.green,
spots: [
const FlSpot(5, -2),
const FlSpot(6, -3),
const FlSpot(7, 0),
const FlSpot(8, 1),
const FlSpot(9, 2)
],
),
],
),
)
```
![bug](https://github.com/user-attachments/assets/5d6a289b-f66d-445c-9ced-5bf9816de9c2)

Flutter v3.24.2
fl_chart v0.69.0

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided LineChart and LineChartData example with minY greater than maxY, then trace how FlTitlesData renders axis titles. Done means TitlesData remains visible for this range while the chart continues to render correctly.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.