FlowFuse / FlowFuse/node-red-dashboard

chart-UI graphing error if X-Axis data point limit > 50% of available data points

Open
#1,287 0 comments 0 reactions 0 assignees View on GitHub
needs-triage type:bug
Dominant language
HTML
Stars
355
Forks
82
Avg merge
4d 23h
Merged PRs (30d)
24

Description

### Current Behavior

Charts appear to have a straight line joining the first and last datapoints if the X Axis limit value for points is more than half of the available points.

![Screenshot 2024-09-11 at 19-06-20 Solar Graphs](https://github.com/user-attachments/assets/26577d71-d1e8-44ea-a43b-1eee74db4bc8)
Graph above with database query returning 100 data points, and the X Axis limit set to 2 Days or 51 points.

![Screenshot 2024-09-11 at 19-07-05 Solar Graphs](https://github.com/user-attachments/assets/e31209b2-d6de-4736-acc2-c630802213f6)
Graph above with database query returning 100 data points, and the X Axis limit set to 2 Days or 50 points.

![Screenshot 2024-09-11 at 19-05-12 Solar Graphs](https://github.com/user-attachments/assets/97a226b0-eaab-4515-9868-4ab8b4835a46)
Graph above with database query returning 3200 data points, and the X Axis limit set to 2 Days or 1601 points.

![Screenshot 2024-09-11 at 19-03-57 Solar Graphs](https://github.com/user-attachments/assets/d6486f2f-0ed1-49d0-a247-59047b857978)
Graph above with database query returning 3200 data points, and the X Axis limit set to 2 Days or 1600 points.

### Expected Behavior

Chart should not have a straight line joining the first and last datapoints unless there are only 2 datapoints.

### Steps To Reproduce

Write a query to generate some data from a database, in that query apply a limit of any figure.
On the chart X axis limit, set the Or number of datapoints to be (the query limit/2) +1
OR any point limit of more than half of the datapoints available

eg

![Screenshot 2024-09-11 at 19-06-20 Solar Graphs](https://github.com/user-attachments/assets/26577d71-d1e8-44ea-a43b-1eee74db4bc8)
Graph above with database query returning 100 data points, and the X Axis limit set to 2 Days or 51 points.

![Screenshot 2024-09-11 at 19-07-05 Solar Graphs](https://github.com/user-attachments/assets/e31209b2-d6de-4736-acc2-c630802213f6)
Graph above with database query returning 100 data points, and the X Axis limit set to 2 Days or 50 points.

![Screenshot 2024-09-11 at 19-05-12 Solar Graphs](https://github.com/user-attachments/assets/97a226b0-eaab-4515-9868-4ab8b4835a46)
Graph above with database query returning 3200 data points, and the X Axis limit set to 2 Days or 1601 points.

![Screenshot 2024-09-11 at 19-03-57 Solar Graphs](https://github.com/user-attachments/assets/d6486f2f-0ed1-49d0-a247-59047b857978)
Graph above with database query returning 3200 data points, and the X Axis limit set to 2 Days or 1600 points.

### Environment

- Dashboard version:2.0 (1.16)
- Node-RED version:4.02
- Node.js version: v20.17.0
- npm version:10.8.2
- Platform/OS: Linux/Debian
- Browser: Firefox

### Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.