Posts

Showing posts from March 22, 2019

How to convert D3js V2 to V4?

Image
0 1 I tried to migrate D3js V2 to V4 of below example: https://jasonneylon.wordpress.com/2013/09/05/two-sided-horizontal-barchart-using-d3-js/ But getting error while migrating: Error: attribute y: Expected length, "NaN". at line no 201: .attr("y", function(d, z){ return y(z) + y.bandwidth()/2; } ) and line no 223: .attr("y", function(d){ return y(d) + y.bandwidth()/2; } Please advice. <!DOCTYPE html> <html> <head> <title>Bar Chart</title> <script src="http://d3js.org/d3.v4.js"></script> <style type="text/css"> .chart { background: #00ccff; margin: 10px; padding-top: 10px; } .chart .right { stroke: white; fill: indianred; } .chart .left { stroke: white; fill: steelblue; }