Comments (7)
Hmm interesting okay these last two examples make more sense to me than the original one. Will think about how this should be implemented. Thanks for the feedback. Feel free to post a pull request if any of you think of a way to implement this.
from d3-legend.
Here's a simpler prototype with a function to generate a continuous color legend from a D3 color scale: http://bl.ocks.org/syntagmatic/e8ccca52559796be775553b467593a9f
var colorScale = d3.scaleSequential(d3.interpolatePlasma)
.domain([0, 20]);
continuous("#legend", colorScale);
from d3-legend.
+1 Example use case:
from d3-legend.
I have been studying this D3 Heatmap example, which also uses a continuous color scale. I was confused by the legend there because it shows discrete values for colors, but the actual scale is a continuous interpolation between two colors. A better legend representation would be exactly what you describe here - a continuously varying color ramp with tick marks.
from d3-legend.
Some sample D3 code for a similar color scale as the heatmap @letmaik posted:
from d3-legend.
Awesome, thank you Kai!
from d3-legend.
I won't be adding this feature into d3 legend however in the latest version (2.24.0) you can use d3.scaleSequential to create a legend with steps in this scale. Here's an example: http://d3-legend.susielu.com/#color-sequential
from d3-legend.
Related Issues (20)
- label color remains black in dark mode
- Last threshold's "more than x" label should be "x or more" HOT 2
- Library is not included in webpack bundle HOT 9
- ENH: labelFormat to support numeraljs format HOT 1
- NS_ERROR_FAILURE errors HOT 15
- help wanted: irregular patch legend HOT 5
- Custom Color and Shape? HOT 2
- legend size defaults to 5 when data has length of 1 HOT 2
- Feature Request: Vertical legend text alignment options HOT 6
- cellclick and "#tag"+d.key.replace(/\s+/g, '') HOT 4
- Support for d3.scaleTime() HOT 2
- legend with clamp values HOT 1
- Scrollable Legend HOT 1
- import problems d3 version 5 HOT 5
- Property 'labelWrap' does not exist on type 'LegendColor' HOT 1
- Legend not showing up properly if hidden using jQuery
- Interface LegendColor, issues with cellFilter method, argument type is missing
- labelWrap only wraps white space
- .on functions don't work with d3 v6 HOT 2
- please upgrade to d3 v6 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d3-legend.