Why are tooltips/legends ordered opposite to input data?
See original GitHub issueI haven’t been using Nivo long, so forgive my ignorance if the answer should be obvious.
The Nivo Line docs use input data that looks like this:
[
{ "id": "japan", "data": [] },
{ "id": "france", "data": [] },
{ "id": "us", "data": [] },
{ "id": "germany", "data": [] },
{ "id": "norway", "data": [] }
]
However, the legend on the right (and the tooltip, when setting enableSlices
to x
) reverses the input order, listing norway first.
Digging in, I found the useSlices hook currently includes a slicePoints.reverse() when building the array of points for each slice. I’m guessing that has something to do with it.
That .reverse()
must have a purpose, but I can’t figure out what it is. Does it make more sense for other chart types? It’s not hard to reverse the input to get the desired legend/tooltip order, but just felt odd.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:6
Top Results From Across the Web
Why are tooltips/legends ordered opposite to input data?
I haven't been using Nivo long, so forgive my ignorance if the answer should be obvious. The Nivo Line docs use input data...
Read more >Stacked Area Chart Legend & Tooltip Order - Reversed
However, in the legend and tooltip, the order is reversed. Customer with biggest volume appared at the top of the list and that...
Read more >Highcharts - Change legend index order - Stack Overflow
The items in the shared tooltip will be sorted reversely. ... After applying some CSS it will reverse the order of legends.
Read more >Displaying tooltips - Cloudera Documentation
Displaying tooltips. CDP Data Visualization allows you to enable tooltips in Sparklines visuals. This setting is available on all visuals.
Read more >Format Titles, Captions, Tooltips, and Legends - Tableau Help
A legend card appears in the worksheet when you encode marks by dropping them on the Color ... You can enter a new...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just experienced this as well. It seems rather counter intuitive especially given how some of the other graphs such as Bar does not reverse them.
Experienced this as well, It’s not hard to reverse the input to get the desired legend/tooltip order, but i have to also change the color of the graph to align with bar chart in the same page