-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[charts][LineChart] unwanted horizontal line when rendering 100 data points #13253
Comments
Hey @szszoke I can confirm the bug and will add this to the board for the team to have a look! |
The issue is not about going from 97 to 100 points. It's because after 19:30 you get A solution could be to use https://codesandbox.io/p/sandbox/eager-thompson-jnd8ft?file=%2Fsrc%2FDemo.tsx%3A217%2C20 |
Making sure to not pass in duplicate values for the x axis solved the issue. I was under the assumption that it is only the index that ties data points together. |
I already cot triked by this issue. Could worth a warinig in the docs, but I don't know where to put it |
@alexfauquette we could maybe warn of duplicate data in development mode? Might not be very performant though 🤔 |
I got a quick look, but I don't see a place in the codebase where we could do this check without looping over the data. Btw for later reader finding this issue, if you really need multiple points with the same value, the solution is to use an array of index for the axis data an override it with the correct labels. const dayFirstLetter = ['M', 'T', 'W', 'T', 'F', 'S', 'S']
const getDayFirstLetter = (v: number) => dayFirstLetter[v]
// ...
{
scaleType: 'point',
data: [0, 1, 2, 3, 4, 5, 6],
valueFormatter: getDayFirstLetter
} |
That is exactly what I ended up doing. |
We are going to test adding a duplicate check and see how it affects development performance. Then decide on adding it or not. |
Steps to reproduce
Link to live example: https://codesandbox.io/p/sandbox/little-water-qygylh
Steps:
Current behavior
An extra horizontal line is rendered. See screenshot below.
Expected behavior
No extra horizontal line is rendered.
Context
I am trying to render 100 data points. When I get up to 97, I get an extra horizontal line. It doesn't seem to matter what data points are rendered as long as there are at least 97.
Tested in latest Chrome and Firefox and got the same result.
Your environment
Tested with the browsers below:
npx @mui/envinfo
Search keywords: line charts horizontal line
The text was updated successfully, but these errors were encountered: