question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'key' issue in Line graph with null values in data

See original GitHub issue

Commit #81 was intended to enable linecharts with missing data points (nulls). It works but there are certain conditions that create duplicate keys which leads to a lot of these errors: image Because of the flattening of children the line between dots is not being drawn even though it should. image If animate={true} there is a ‘runaway’ error condition and errors go into the thousands within seconds, with animate={false} errors only occur on prop change. Again, it only happens if multiple lines are drawn i.e. [ { id: 19, data: [{x: ....., y: .....}, .....], {id: 30. data: [....]} ] I’m fairly certain I’m passing the correct props and I believe that passing null as certain y’s leads to the duplicate key issue.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ahtohbi4commented, Dec 7, 2017

I have found a difference of x values in your data. For example item with value { x: "10-10-00", y: <any value> } exist in the first collection, but was missed in the second one.

How I understand the ideology of the library, dataset for each Line should have the same length and should consist of the identical sets of x values.

Wrong (your case):

[
  {
    "id": "15",
    "data": [
      { "x": "01-01-00", "y": 5 },
      { "x": "03-01-00", "y": 3 },
      { "x": "04-01-00", "y": null }
    ]
  },
  {
    "id": "30",
    "data": [
      { "x": "01-01-00", "y": 7 },
      { "x": "02-01-00", "y": 12 },
      { "x": "04-01-00", "y": 2 }
    ]
  }
]

Correct:

[
  {
    "id": "15",
    "data": [
      { "x": "01-01-00", "y": 5 },
      { "x": "02-01-00", "y": null },
      { "x": "03-01-00", "y": 3 },
      { "x": "04-01-00", "y": null }
    ]
  },
  {
    "id": "30",
    "data": [
      { "x": "01-01-00", "y": 7 },
      { "x": "02-01-00", "y": 12 },
      { "x": "03-01-00", "y": null },
      { "x": "04-01-00", "y": 2 }
    ]
  }
]

So, you should fill missed values of x in each dataset with { "x": <missed value>, "y": null }.

@plouc, correct me, please.

0reactions
plouccommented, Dec 8, 2017

@ahtohbi4, you’re right 👍, thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to deal with missing data in line charts
Sometimes, missing values in a line chart will create a gap in the line. In this tutorial, you'll learn how to draw an...
Read more >
Display empty cells, null (#N/A) values, and hidden worksheet ...
Go to Chart Tools on the Ribbon, then on the Design tab, in the Data group, click Select Data. ... Click Hidden and...
Read more >
How do I show null values on my Line chart? - RGraph
You won't see anything displayed on your chart. This is because for a line to be drawn you need at least two consecutive,...
Read more >
How do I represent null values in a line chart?
My chart does have dots to represent the data points. The issue is that I don't know where in the chart to place...
Read more >
Null values are shown as 0 on a line chart
When plotting time series data (or other data too) with Null values on a series, the line chart forces missing values to be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found