score:0
I think I figured it out. d3.scaleQuantize() returns a value if you input a number in parentheses. However, just doing color like it was a regular array gave me each color individually, which could be fed into the legend.
.style("fill", function (d, i) {return d};)
score:1
you can use function variable of i, these i variable follows the sequence. For example
.style("fill", function (d,i) {
return color(i);//or color.range(i);
Source: stackoverflow.com
Related Query
- Return individual value from a D3 color range to create legend
- How to color SVG image based on value from color range using d3?
- Displaying values associated with each color gradient mapped from range in D3 legend
- D3: Create a continuous color scale with many strings/inputs for the range and dynamically changing values of the domain
- Creating choropleth map legend that correctly displays quantile class range values and associated color in color scheme?
- Return value from JSON, not the children count
- How to change table cell color based on numeric value from .csv report AND when tables are dynamically created?
- Return RGB object instead of string from d3 scale and color interpolation
- How do I change color of path element when its value is selected from dropdown
- How to return only unique value from array objects bound to an element in d3.js
- d3.max doesn't return highest value from csv file
- Heatmap color range based on max & min value
- How can we add legend's value beside of legend with proper alignment and different color in dc.js
- D3 JavaScript return data value plus variable from anonymous function
- Create d3 linear color legend using d3 colors
- my own d3 custom color scale - interpolate a range from one given HEX to another
- nvd3.js - display specific color for each bar in multibar vertical chart depending on range of value
- Return value from d3 angular directive to controller
- Updating map polygons and map legend with selected color option from dropdown menu?
- How to return a value from a function, which is generated inside a callback function within?
- How to return a value from a promise which isn't a pending promise: d3.js, Javascript?
- How to use my own color table instead of using d3 color set ( interpolateviridis ) to create legend
- Why is there a triangle missing from the return value of d3.voronoi.triangles?
- Create color range with radial gradients using d3.js
- d3 function(d) return value from object not from the first index(0)
- How do I remove all children elements from a node and then apply them again with different color and size?
- NVD3 chart fails to calculate legend text length in Chrome, since Window.getComputedStyle does not return font-size correctly
- How to get maximum value from an array of objects to use in d3.scale.linear().domain()
- Continuous color scale from discrete domain of strings?
- D3.js Selecting min/max value from an array of arrays (nesting d3.extent)
More Query from same tag
- What is the default representation of date in d3.js?
- d3js tick function definition
- Can multiple "d3.js Dendrogram" nodes point to the same leaf node?
- d3.js not able to parse json data
- Calculate the exact size of a font glyph
- How to apply drag behavior to a d3.svg.arc?
- Assigning variable with $.getJson
- Angular 2 D3 tree is not rendering correctly
- Pan canvas to Reveal Elements when added using D3.js
- d3 get attribute with special character
- How do I smooth out the edges of a closed line similar to d3's curveCardinal method implementation?
- d3.js Tree Node Layout remove root node
- D3 adds extra lines between points
- Real time data graphing on a line chart with the help of rickshaw and d3.js
- How to render a bar chart based on a selection from dropdown menu?
- jQuery: event delegation between different parents
- d3 js - loading json without a http get
- d3 treemap make each rectangle size represent it's value
- convert multilevel nested array using into json using javascript
- How to use d3.domain/range to have a custom domain
- In d3js, how to plot line chart from csv file, taking data from seperate columns for each row
- How to prevent a d3.geo map to pan, but keep zoom
- drag svg element onto HTML element
- D3.js code not rendering in browser when loaded from file, but works fine in console
- Display an svg image on Google Chrome
- Problems in rendering multiline Time series graph in D3
- D3.js cannot render my circles from a json file
- D3.js -- How do I update dataset via Javascript?
- How to capture and display d3.json http status code 500
- How can I create a xy line chart with c3?