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.

Clarify getLegendData when using opacity

See original GitHub issue

It is common to use opacity & ramp and then trying to build a legend. But that can lead to an error, as it is described in this conversation between @ramiroaznar and @elenatorro:

  • User: I am strugging to make getLengendData() work --> viz.color.getLegendData throws ‘getLegendData is not a function’

getLegendData works for ramps, if not, you’d have to use value

  • User: the expression was opacity(ramp(linear($valor, @min, @max), sunsetdark), 0.5)

If it’s inside an opacity, you have to assign the ramp expression to a variable, like this: @myRamp: ramp(linear($valor, @min, @max), sunsetdark), 0.5) and then: opacity(@myRamp) so you can access the ramp through the variable viz.variables.myRamp.getLegendData().

So it would be nice to add this explanation / example to the legends guide somehow

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
makellacommented, Dec 14, 2018

to update, we are in the final steps of adding legend and widget examples to the dev center. we have included steps in the Guide for opacity and also have the same example available in the examples/legend section.

1reaction
makellacommented, Dec 7, 2018

ahhhh, ok! i’ll try this out.

yes, could get the transparency in the map but not the legend which is what i was after. thank you!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Legend examples more easy to find #1176 - GitHub
Clarify getLegendData when using opacity #1177 ... and i agree, i can work on adding the opacity one that's a good tip!
Read more >
opacity - CSS: Cascading Style Sheets - MDN Web Docs
The opacity CSS property sets the opacity of an element. ... Using opacity with a value other than 1 places the element in...
Read more >
Democratizing price transparency data for better, more ...
With Clarify, health plans can seamlessly leverage rate intelligence data combined with provider performance insights to build higher-performing ...
Read more >
CSS Image Opacity / Transparency - W3Schools
When using the opacity property to add transparency to the background of an element, all of its child elements inherit the same transparency....
Read more >
Transparency & Opacity - Adobe Support
"TASTY" becomes transparent when its opacity is set to 50%. Note that "SANDWICHES" opacity is set to 100% so it is opaque, or...
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