preventCurveOverShooting troubles
- Dominant language
- Dart
- Stars
- 7.6k
- Forks
- 2k
- Avg merge
- 9d 1h
- Merged PRs (30d)
- 2
Description
Hey,
Thanks for a great chart package, which I really enjoy using.
But I'm encountering troubles with the preventCurveOverShooting option.
My Graphs with curving:
My Graphs with curving and preventCurveOverShooting:
As you can see in the middle graph, there is an overshooting around 12/27, which is gone with preventCurveOverShooting=true.
Unfortunately, the graph has now curves where there is no need (e.g. black line between 12/06 an 12/11) and spaces between the line and the BetweenBarsData.
Code:
Widget build(BuildContext context) {
if (values.isEmpty) {
return SizedBox(height: thirdHeight);
}
Map newValues = _calculateData(values);
double maxY = _getExtreMax(newValues);
return SizedBox(
height: thirdHeight,
child: Column(
children: [
_titleRow(title),
SizedBox(
height: 8,
),
SizedBox(
height: thirdHeight - 42,
child: LineChart(
LineChartData(
lineTouchData: LineTouchData(
enabled: true,
touchTooltipData:
LineTouchTooltipData(fitInsideVertically: true)),
betweenBarsData: [
BetweenBarsData(
fromIndex: 0,
toIndex: 1,
color: colorListShort[1].withOpacity(.6),
),
BetweenBarsData(
fromIndex: 1,
toIndex: 2,
color: colorListShort[2].withOpacity(.6),
)
],
backgroundColor: stodiaWeiss,
minX: 0,
maxX: chartLength,
maxY: maxY,
minY: 0,
gridData: FlGridData(
verticalInterval: vertInterval,
horizontalInterval: gridIntervalHoriz,
),
borderData: FlBorderData(
border: const Border(
bottom: BorderSide(),
left: BorderSide(),
right: BorderSide())),
lineBarsData: _lineList(newValues, maxY),
titlesData: FlTitlesData(
bottomTitles: AxisTitles(
sideTitles:
_getBottomTitles(bottomType, chartLength, context)),
leftTitles: AxisTitles(sideTitles: _leftTitles()),
topTitles:
AxisTitles(sideTitles: SideTitles(showTitles: false)),
rightTitles: AxisTitles(sideTitles: _rightTitles(maxY / 100)),
),
),
),
),
],
),
);
}
Is there a way to fix that which I have not found so far?
Thanks in advance
Contributor guide
Research direction
Start with the provided LineChartData configuration, especially preventCurveOverShooting, lineBarsData from _lineList, and the BetweenBarsData entries. Reproduce the chart with and without the option, then trace the curve and filled-area rendering; done means overshooting is prevented without unwanted curves or gaps between lines and filled areas.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- data-visualization, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100