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.

Question: Line Graph with Different data model

See original GitHub issue

Is it possible to get an example with a nested set of data?

My data for example is formatted as follows: {reportData: [{ key: 2010, values: [{ reportMonth: 1, data: value }, { reportMonth: 2, data: value2 }...]},{ key: 2011, values: [{ reportMonth: 1, data: value }...]} ]

Where I want to display a LineChart with a line corresponding to each key. and the XAxis spanning the 12 months of the year. Been struggling to figure out how to pass the data / dataKey into the library.

I have also tried with my data formatted like: {reportData: [{reportMonth: 1, data: value1, reportYear: 2010}, {reportMonth: 2, data: value2, reportYear: 2010}..., {reportMonth: 1, data: value1, reportYear: 2011}...,]}

But was unable to get the graph to display as I desired…

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
Eric24commented, Mar 15, 2017

In our use of ReCharts, we have always “massaged” the data before passing it in. ReCharts has a simple, if not super-flexible, expectation of what it wants to see, but that isn’t much different than any other charting package we looked at. But we’ve always found that doing that extra step was fairly straightforward, since you can easily insert a “transform” function in between ReCharts and the underlying data.

0reactions
Eric24commented, Mar 15, 2017

Yes, but it will require a custom label function that returns the value of labelx.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Complete Guide to Line Charts | Tutorial by Chartio
Line charts are a fundamental chart type generally used to show change in values across time. Learn how to best use this chart...
Read more >
How To Create A Line Graph In Excel (With Multiple Lines)
... I will show you how to create a line graph in Excel. I will firstly show you how to create a simple...
Read more >
Graphing two data sets on the same graph with Excel - YouTube
Show how to use MS Excel 2013 to plot two linear data sets on the same graph so that they can be visually...
Read more >
Combining chart types, adding a second axis - Microsoft
Combining different chart types · 1. Click the Total Transactions data column in the chart. · 2. Once you have selected the Total...
Read more >
How to Make A Line Graph In Excel With Two Sets Of Data
It can help analyze future trends. Using line graphs in MS Excel, you can determine future trends and predictions using different models.
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