8000 Suggestion: don't render null data · Issue #11 · fnando/sparkline · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Suggestion: don't render null data #11
Open
@jwhazel

Description

@jwhazel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0