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

Suggestion: don't render null data #11

Open
jwhazel opened this issue Jul 23, 2018 · 2 comments
Open

Suggestion: don't render null data #11

jwhazel opened this issue Jul 23, 2018 · 2 comments

Comments

@jwhazel
Copy link

jwhazel commented Jul 23, 2018

Use case: rendering a fixed set of time series data where you may be lacking some future data but need the graph to maintain a consistent width. E.g. here's a graph of today's data viewed at 2pm since future data in each interval isn't available and is null, it gets coerced to 0 on the y-axis:

graph1

That looks kind of ugly and possibly misleading. Here is the desired look of this graph where nulls don't get rendered but interval width is still maintained:

graph2

I accomplished that by simply adding this test on line 113:

if(value !== null){
    pathCoords += ` L ${x} ${y}`;
}

I didn't want to make a PR yet because I haven't had a chance to write any tests nor am I sure this is a use case you even want to support. Just thought I'd throw it out there as a suggestion.

@fnando
Copy link
Owner

fnando commented Oct 18, 2018

In this case, what happens if you have [1, 2, null, null, 3, 5]? How should this be handled?

@phil-w
Copy link

phil-w commented Apr 25, 2021

Below is how it looks in the real world when there's null data and this change is made. This is monthly data where there are nulls in zero-indexed months 2,3 and 7. It's not ideal as arguably the stroke should not be drawn each side of the nulls, but I think it's clear that there's no data in those gaps because there's no line there.. Contrast that with the top example here, which implies there's data (with value zero) where in fact there is no data.

ml1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants