-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Line chart is not rendered properly on iOS #1690
Comments
It seems it is a flutter engine-related issue |
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 #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:
The text was updated successfully, but these errors were encountered: