.range() method in d3 scales accepts an array that defines the output values of the scale.
At this line:
//set the ranges var x = d3.scaleBand().range(0, width); var y = d3.scaleLinear().range([height, 0]);
Notice how the Y scale range is defined correctly, but the X range is missing the
[ ], turning the array into two invalid parameters. Since the output of the scale is invalid, it causes the NaN errors on the path, and the x axis can't render properly.
Declaring the range as an array should fix the error:
var x = d3.scaleBand().range([0, width]);
- Why does my D3js line chart fail to render values and x-axis?
- nvd3.js-Line Chart with View Finder: rotate axis labels and show line values when mouse over
- NVD3.js line graphs fail to scale y axis to max and min values
- Why does the NVD3.js line plus bar chart example render two charts instead of one?
- Why doesn't the same group render a correct line chart and corresponding range chart?
- Show values on Y Axis as it is with Higher and lower limits NVD3 Line Chart
- Multiples with x/y axis and mouseover example - line path shows wrong values
- D3 Line Chart to display first and last point values
- Why does my line chart transition looks laggy?
- How to create Stacked Line Chart D3, Multiple Y Axis and common X Axis
- d3js pie graph from jquery ajax - correlating json keys and values on the chart
- Align lines and dots with x-axis values in line chart
- d3js gantt chart with date/time scale at the top and current day blue line
- d3 bar chart with fixed bar width and fixed spacing to align in center axis line
- Why does this d3 chart render with crosses, then get rid of them upon moving a node?
- D3 line chart does not show tool tip and data points properly
- Why does my bar chart using scaleBand not line up with my tick marks?
- Why animated d3 svg line is not synchronized with the axis shift in IE9 but synchronized in IE11 and Chrome?
- D3js v5 Trying to select multiple bars in bar chart using brush and saving values to variable and table
- Highlight closest point d3js line and dot chart
- Why does d3 date axis fail in Firefox for some particular date domains?
- Why do the y axis values shift up from real point in line chart?
- why d3 line chart and bar chart display in same morment?
- D3.js Line chart with relative min and max in Y axis
- D3js - Line Chart with binary values
- How to put data on line chart when x axis and data has a time range
- d3 v4 Why can't I get my x axis and bars to line up?
- Can't get axis values to render on top of rect d3js v4
- drawing a rectangle on line chart in d3js and nvd3
- dc.js graph won't show line and y axis values
More Query from same tag
- How to draw a chess board in D3?
- How to stop images from rotating in d3.js graph?
- D3 force directed layout is how showing the edges?
- Iterating through multi-dimensional arrays with d3.js
- Binding data in d3 appends too many times
- Passing a function to d3's .data()
- D3 can't draw two brushes together
- How do I take into account scale when getting height/width of a d3 element using bounding rectangle
- Show yearly X labels for June instead of January on d3.js chart
- Assign d3.js Axis a Background Color and Change Layer Ordering
- D3.js Combined Bar and Line Chart x-Axis Misalignement Issue
- Is it possible to use a data.enter() method within a data.enter() method?
- How to add tool-tips in d3 js vertically grouped bar chart
- How to add label above the scatter plot?
- Disable D3 zoom on circle PNG background
- file.json data to be used in d3js?
- In D3 v4, how do I align axes appropriately?
- d3.js circles are not appearing
- Programmatic access of data in d3.js v6 collapsible tree via selectors
- D3 Line Generator Handling Multiple Arrays
- Issue with displaying correct domain values in legend tick
- d3 file not working in chrome but works in firefox
- Drawing simple lines with d3js
- Stop D3 from 'springing' on start
- D3.js graph shows up as text
- How to get data on x-axis and number of times occured on y-axis using crossfilter JS?
- D3 shift ticks to align with axis
- Sankey Diagram in d3
- D3.js force. custom color