Closed mihakosi closed 4 months ago
It seems it is a flutter engine-related issue So, let's wait to see what happens
OK, thank you. Let's hope this gets resolved soon.
For anyone that might be looking for a solution, I have discovered the following workaround: you can use stack to render the same chart twice (one on top of the other), once in the reversed order and once in the original order, like this:
SizedBox(
width: MediaQuery.of(context).size.width,
height: 200,
child: Stack(
children: [
// First chart, drawing in the reversed order
LineChart(
LineChartData(
lineTouchData: const LineTouchData(
enabled: false,
),
lineBarsData: [
LineChartBarData(
spots: chartData.reversed.toList(),
dotData: const FlDotData(
show: false,
),
),
],
),
),
// Second chart, drawing in the original order
LineChart(
LineChartData(
lineTouchData: const LineTouchData(
enabled: false,
),
lineBarsData: [
LineChartBarData(
spots: chartData,
dotData: const FlDotData(
show: false,
),
),
],
),
),
],
),
)
You end up with two charts, on the first one the stroke ends are pointed towards the left side of the screen and on the other one towards the right side of the screen. But because they are displayed in a stack they are perfectly aligned and look like a properly rendered chart.
You can also limit this workaround to iOS to avoid unnecessarily impacting the performance of the app on other devices:
if (Platform.isIOS) {
// Draw two charts in a stack, like in the code above
} else {
// Draw chart normally
}
I am also interested in solving this problem...
Duplicate of https://github.com/imaNNeo/fl_chart/issues/1625
When using line chart on iOS, the chart is not rendered properly. More specifically, each stroke narrows towards the end and looks like a sharp tip. Because of this, the chart looks jagged:
On Android and macOS, on the other hand, the strokes are always of the same width and look perfectly aligned:
Setting
isStrokeCapRound
andisStrokeJoinRound
totrue
doesn't solve the issue.Here is the code that can be used to reproduce the issue:
Versions: