score:1
There is a lot of missing element in your code. The selection is not defined. You have to call the data function with data. There must be an enter section with append.
I created a fiddle with some made up parameter from your code. It works more or less.
var data =[1];
var sel = d3.select("svg")
.selectAll("rect")
.data(data)
.enter()
.append("rect")
.attr("width",10)
.attr("height",40)
.attr('x', 1.5)
.attr('y', 1.5)
.transition().duration(500)
.attr("width", function(d) { return wScale(Math.abs(d))});
Source: stackoverflow.com
Related Query
- Absolute value for width of shape in svg for d3
- Auto width and height for SVG image
- D3.js enter() broken for svg shape animation but updates and removes them fine
- Convert the height value in percents to the width value in percents in svg using d3.js
- D3.js: How to get the computed width and height for an arbitrary element?
- How do I get the width of an svg element using d3js?
- Title Attribute not working for an SVG Rect on Safari
- D3 how to change the width and length of SVG
- Get width of d3.js SVG text element after it's created
- CSS padding property for svg elements
- Making SVG container 100% width and height of parent container in D3 v4 (instead of by pixels)
- Invalid value for <path> attribute
- how to use svg file for image source in D3
- D3 force directed graph, different shape according to data and value given?
- maximum number of svg elements for the browser in a map
- How to calculate y value for given x using d3.js
- D3 multi-line tooltip for SVG element
- dagre-d3 IE workaround for SVG foreignObject element?
- Maximum width for column in bar chart
- IE11 does not accept SVG height and width when using D3
- How to display the value for the final tick on axis in D3?
- Javascript event listener for SVG transform
- d3.js Error : Invalid value for <g> attribute transform="translate(NaN,5)"
- Using d3 to create a density & value heatmap layer for leaflet
- Clip SVG text to width of rectangle in a D3 treemap
- How to show a tooltip with value when mouseover a svg line graph using d3.js?
- Add region around SVG path for mouseover
- Error: Invalid value for <rect> attribute width="NaN"
- Invalid value for <circle> attribute cx=“NaN” using D3.js
- How can I set the each line color or width in SVG path
More Query from same tag
- Drawing links that do not affect the physics of a force directed graph
- How to integrate `d3js` graph with angular directive
- D3.js error using timescale (path is NaN)
- How to create an y axis containing hours from noon to noon on the next day
- d3.js data join shows strange result
- Positioning of canvas after the conversion from D3
- Code doesn't work when upgrading from v3 to v5
- How do I modify the D3.js script to show my json's (contains SAP CDS Views) data correctly?
- d3js v4 Overlapping Bar Chart
- D3js v3 to v5 upgrade: unable to convert strings to integers
- Bar graph bleeding below y axis D3.js
- D3 js hexagon progress animation start point
- Problem with label position with more than one nvd3 graph on one site
- d3 update paths and circles in Graph
- Query SQL data in Flask to use for charting without using the app.route decorator
- D3 transition from stacked bar to bar chart only works the first time
- Markers not removed when updating data on a Dimple area chart
- Just Change Tick labels
- d3.js: Pie Chart Layout - Adjusting the Angle to Create Shutter Effect
- How to pan on scroll in d3 v4/v5 with Canvas
- Can't transpile typescript due to d3 event error
- Add a property to an element with D3 .datum()
- Why does this code work for counting one item in a list but not the others?
- d3 not showing added html elements
- How to build stacked bar chart overlapping with d3js
- D3js map marker collision detection
- D3: Stacked bar chart exit().remove() not removing bars
- Replacing d3.csv to d3.csv.parse
- Setting Initial D3 Transform Properties
- A few bars in the wrong place in a bar graph after sorting in ascending order