Skip to content
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

Single point line not visible #1438

Closed
DennisNurtio opened this issue Sep 14, 2023 · 8 comments
Closed

Single point line not visible #1438

DennisNurtio opened this issue Sep 14, 2023 · 8 comments
Labels
bug Something isn't working Line Chart

Comments

@DennisNurtio
Copy link

Describe the bug
A line chart with only one point will not show anything. I would expect at least a dot that shows a data point is added to the chart.

Scenario: our customer is setting up sensors. After setup the chart is shown (with a hourly interval) so the first point shows after/while installing. The next point would be visible after an hour. Currently the customer does not see any data in the first hour, and might wonder why the setup failed.

To Reproduce
The following code shows as an empty chart (while there is a data point available).

@override
  Widget build(BuildContext context) {
    return LineChart(
      LineChartData(
        lineBarsData: [
          LineChartBarData(
            color: AppColors.contentColorGreen,
            barWidth: 8,
            isStrokeCapRound: true,
            dotData: const FlDotData(show: false),
            belowBarData: BarAreaData(show: false),
            spots: const [
              FlSpot(1, 1),
            ],
          ),
        ],
        minX: 0,
        maxX: 14,
        maxY: 4,
        minY: 0,
      ),
      duration: const Duration(milliseconds: 250),
    );
  }

Screenshots
image

Versions

  • which version of the Flutter are you using? 3.13.1
  • which version of the FlChart are you using? 0.63.0
@FMorschel
Copy link

In this case, you could do dotData: const FlDotData(show: true) I believe. Tested here and it works just fine. Would this be a problem for you? If so, why?

@DennisNurtio
Copy link
Author

Hello @FMorschel , thanks for the tip. Currently we dont show the dots, because it does not match the styling. For this specific case I will show it, as a good workaround.
dotData: const FlDotData(show: spots.length == 1)

@imaNNeo
Copy link
Owner

imaNNeo commented Nov 11, 2023

In the new versions, it shows. Can you please verify that?

@imaNNeo imaNNeo added question Further information is requested Line Chart labels Nov 11, 2023
@DennisNurtio
Copy link
Author

I don't see a change using 0.64 and the code from the first post.

@imaNNeo
Copy link
Owner

imaNNeo commented Nov 21, 2023

@DennisNurtio Can you please provide a reproducible code?

@DennisNurtio
Copy link
Author

Pasted the original code above into line 12 of lib\presentation\samples\line\line_chart_sample1.dart on commit e3910de.
Same effect as the original post.

@imaNNeo imaNNeo added bug Something isn't working and removed question Further information is requested labels Nov 24, 2023
@imaNNeo
Copy link
Owner

imaNNeo commented Nov 24, 2023

I found the bug, thank you!

@imaNNeo
Copy link
Owner

imaNNeo commented Nov 24, 2023

Landed in 0.65.0
Check it out!

@imaNNeo imaNNeo closed this as completed Nov 24, 2023
OlehSv pushed a commit to Oleh-Sv/fl_chart that referenced this issue May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Line Chart
Projects
None yet
Development

No branches or pull requests

3 participants