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

[charts] Allows to connect nulls #10803

Merged
merged 18 commits into from
Nov 2, 2023
Merged

Conversation

alexfauquette
Copy link
Member

@alexfauquette alexfauquette commented Oct 25, 2023

Follow up of #10801

Most of the files modified are demos added to reproduce the recharts examples and be sure it works as expected.

Idea

The overall idea is that if connectNulls is used by the user, instead of using the d3 function defined, we filter the data to remove all the null elements. Such that d3 sees only the valid one and then does the interpolation between them.

Test

No idea why argos fails. I copy/paste the HTML of the legend from the preview and from the master deployment. It's exactly the same 🤷‍♂️

image

alexfauquette and others added 15 commits October 25, 2023 12:05
Co-authored-by: Lukas <llukas.tyla@gmail.com>
Signed-off-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
Co-authored-by: Flavien DELANGLE <flaviendelangle@gmail.com>
Signed-off-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
Co-authored-by: Lukas <llukas.tyla@gmail.com>
Signed-off-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
Signed-off-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
@alexfauquette alexfauquette added enhancement This is not a bug, nor a new feature component: charts This is the name of the generic UI component, not the React module! labels Oct 25, 2023
@mui-bot
Copy link

mui-bot commented Oct 25, 2023

Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvement! 💙 💯
Some other thoughts:

  1. I'm not sure if this is the best prop name, but maybe you have already done competitor analysis and this is also used by some other libraries
  2. Wouldn't having connectNulls opt-out instead of opt-in make more sense? Or are others also approaching this behavior the same? 🤔

No idea why argos fails

Just ignore those silly pixel diffs. IMHO, it's mainly a problem, because we are making quite low-quality screenshots and in this case, it's SVG, rather than regular HTML elements, maybe that has extra rendering inaccuracy issues. 🤷

docs/data/charts/lines/lines.md Outdated Show resolved Hide resolved
docs/data/charts/lines/lines.md Outdated Show resolved Hide resolved
packages/x-charts/src/models/seriesType/line.ts Outdated Show resolved Hide resolved
docs/data/charts/lines/lines.md Outdated Show resolved Hide resolved
docs/data/charts/lines/ConnectNulls.tsx Show resolved Hide resolved
@alexfauquette
Copy link
Member Author

I'm not sure if this is the best prop name, but maybe you have already done competitor analysis and this is also used by some other libraries

I picked connectNulls from Rechart. For me it makes sense since it's connecting points that are set to null by the developer.

Seems echarts has the same naming: https://echarts.apache.org/en/option.html#series-line.connectNulls

Wouldn't having connectNulls opt-out instead of opt-in make more sense? Or are others also approaching this behavior the same? 🤔

From what I see others are doing the same. The reason is that if you provide null it should be visible in the graph by default.

Co-authored-by: Lukas <llukas.tyla@gmail.com>
Signed-off-by: Alexandre Fauquette <45398769+alexfauquette@users.noreply.github.com>
@LukasTy
Copy link
Member

LukasTy commented Nov 2, 2023

From what I see others are doing the same. The reason is that if you provide null it should be visible in the graph by default.

Thanks for the reply.
Hearing the arguments, your chosen API makes sense. 👍 💯

@alexfauquette alexfauquette merged commit 2ecb3c2 into mui:master Nov 2, 2023
18 checks passed
alexfauquette added a commit to alexfauquette/mui-x that referenced this pull request Nov 6, 2023
Co-authored-by: Lukas <llukas.tyla@gmail.com>
Co-authored-by: Flavien DELANGLE <flaviendelangle@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: charts This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants