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.

Set null legend values per series?

See original GitHub issue

Hi, is there any way to set a custom null legend value for a series? If the mouse is not hovering over the chart, the legend shows -- which, as far as I can tell, is hard coded here:

https://github.com/leeoniya/uPlot/blob/d12f84b9daf770ea9b04d42e04ee9738ca055024/src/uPlot.js#L556

I would like the legend to show a different default value that is different per series. In my case for example I would like to render the sum of all data for a series. I can calculate the value myself of course, I’m just not sure how to render it in place of the -- while keeping the mouse over live legend functionality.

Thank you very much!

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
leeoniyacommented, Jan 4, 2022

ah, ok.

i’ll see about adding something that invokes series.value() with a null idx during data updates and cursor hiding events.

0reactions
mxljecommented, Jan 4, 2022

Thank you for your quick reply. I tried that and as far as I can tell it only is called when actually hovering, not for the case where the user is not hovering, which is the “null legend” case I tried to describe. Maybe my question wasn’t clear though so I’ll try to rephrase:

When the mouse is not over the chart, the value in the legend for every series is shown as -- (see screenshot below). Returning a value from the value: function does influence the legend, but only when hovering over a specific x point. The hovering already works fine without customization though.

What I would want is a function on the series that gets all data points for the currently visible part of the x axis (which can change when the user zooms in) and whatever it returns is rendered in the legend when the user is not hovering the chart, replacing the --. In this specific case I would use it to sum the value of all points.

Bildschirmfoto 2022-01-04 um 17 55 47

Thank you again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Null values are displayed in the legend if there a... - 1668361
Hi All,. I have a Bar chart in that having 3 Dimensions and measure. If values are null then display the Null values...
Read more >
Hiding "Series1" from chart legend when values are null
Any NULL values for the column "Type" are showing on the legend as "Series1" while the other values show as they should
Read more >
How to hide zero or null values in Legend in Grafana 8?
Hide null values and zero values from Legend in my Panel How are you ... hide series with 0/null values sort tooltip entries...
Read more >
Option to hide zero values in legend and tooltip · Issue #1381
The new options to hide null values in the legend and 'all series' tooltip are excellent but I run into a problem when...
Read more >
Metrics Dashboard: Hide series with only nulls/zeros in legend
Summary Grafana charts have an option to hide charts that have null or zero values. This is especially useful in cases...
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