Seems like you are working with TypeScript.
You might need to provide the generics for
d3.scaleThreshold() in order for it to accept strings.
As mentioned on the DefinitelyTyped TypeScript type definitions for D3.js,
- Constructs a new threshold scale. The domain and range must be set corresponding to the type of the corresponding generic.
- The first generic corresponds to the data type of domain values.
- The second generic corresponds to the data type of range values.
Since you are using strings for both
range, we can specify both types as
- d3 v5 scaleThreshold not accepting array of string colors on range?
- d3: Color Range with an array with more than 2 colors
- Month Path only calculating month, not actual date range
- dc.js line chart with range of colors
- How to generate random colors in an specific range using D3?
- shp2json produces GeoJSON with bounding and coordinates not in (-180,180) range
- D3 bar chart not showing first element in array
- pie() does not accept an array of objects
- D3.js v5 Domain() not taking variable for array
- D3.js: "On the fly" added elements to array are not refreshing the svg graphic
- D3.js bar chart colors not shown in print out but displayed on browser
- Multiple classes assigned via D3's .attr are not in the serialized (serializeToString) string
- D3 create buttons from an array of string containing names
- d3 line and area charts not updating with new data array
- D3--How to iterate through an array of colors
- d3 enter().append() not appending all elements of my array
- Given a range of date intervals, create an array of all 1440 minutes in a day with the frequency each minute appears in the source intervals
- String does not match expected pattern d3 select
- Chart is not showing the data array of objects
- Bisecting an array of objects: are not all of them enumerated?
- elasticY(true) with rangeChart does not adapt to new range
- d3.js Color range for map not displaying as per domain range
- dc.js bubblechart colors scale is not working
- Argument of type is not assignable to string
- d3 js transition over the array of rectangles does not work
- Day hour Heatmap - Colors not showing
- D3 scale: mapping string to colors
- Json D3 array contents not working
More Query from same tag
- How to choose which JSON file to use in your D3 force directed graph
- Density plot using a list of integers
- Cant access fetched elements of an array
- Updating bar chart with a button press
- Why is scale a function of pi in D3's Mercator projection?
- D3 tickValues not working
- dc.js calculate averages with multi column rowchart
- How can I fix my chart so that the scale of the x axis is defined by a group of labels?
- How can I disable panning on left click in d3
- what's wrong with my label update selection
- Can't translate by vh/vw - I need this to be responsive, how can I convert the vh/vw to px?
- How to stop D3.js from creating infinite areas from linear polygons
- D3js value of .data(...) field does not change on window resize. Is there a way to change it?
- Missing data after adding the time range
- SVG - rect with left rounded corners
- Color svg paths based on position along gradient in D3
- How do I get an object from d3.data()?
- c3 click and highlight multiple selections
- Error from d3 library?
- <circle> attribute transform: Expected number, "translate(NaN,NaN)" in D3 legend of Covid data tracker legend
- What is the difference between D3.js and Cytoscape.js?
- Transitions using line graph and Rickshaw
- Change elements of page with .on change event in an elegant way
- Changing d3 bullet chart range
- Call Django View from D3.js onclick event on Heatmap
- networkD3 package: show node names of all connected nodes when hovering over
- What is the best way to find the nearest scatter plot point (circle) relative to a given coordinate set?
- D3 Y Scale, y vs height?
- can a div be .appended by calling "outside" function?