Clarify getLegendData when using opacity
See original GitHub issueIt 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 variableviz.variables.myRamp.getLegendData()
.
So it would be nice to add this explanation / example to the legends guide somehow
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:8 (8 by maintainers)
Top 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 >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
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.
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!!