You are missing a
.selectAll('svg') after selecting the
var svg = d3.select("#chart") .selectAll('svg') // <-- You want to operate on set of SVG elements .data(d3.range(2013, 2015)) .enter().append("svg")
Working demo: http://plnkr.co/edit/2SwqI8gW2UaGIdlHvX2Y?p=preview
script tag which ran your code to the bottom of the
body tag so that the
div#chart has been put into the DOM for
d3.select('#chart') to find.
- d3.js - Why does my SVG tags get added inside the HTML tag
- Why does the text not appear inside the svg rects
- Why does this D3 code add the <p> element outside the body, instead of inside it?
- get the position details of a div inside an svg
- SVG tag defined in HTML vs Added by D3
- Why does D3 not insert elements inside the selected element, when using data().enter()?
- SVG ds.js - why does an append operation on defs modifies the data binding of svg selectAll
- Why does the whole SVG disappear when I set map opacity to 0 in D3?
- Why are HTML elements appending after the <script> tag
- Why does a <h2> Header clip the succeeding SVG element?
- How do I get the width of an svg element using d3js?
- In d3, how to get the interpolated line data from a SVG line?
- mouseout/mouseleave gets fired when mouse moves INSIDE the svg path element
- Append foreignObject containing some HTML inside an SVG element
- HTML element inside SVG not displayed
- Why can't I get the Bounding Box of this d3.js text?
- d3.event.x does not get the x cursor's position
- Does the d3 treemap layout get cached when a root node is passed to it?
- How can I get the natural width and height of an svg image element?
- Why does event listener callback function only work inside function scope?
- How can I get access to the current selection inside a D3 callback?
- Selecting g inside SVG tag in selenium
- Why does this SVG graphic bog down Webkit only when it's large?
- Why does this syntax work over the other one with d3.json requests?
- Why does a CSS transform,translate change the rotation for rotated elements?
- How do I get the d3 svg points to stay in their correct position on the leaflet map when zooming?
- What is the fastest way to get SVG element given a position (x,y)?
- D3.js: "On the fly" added elements to array are not refreshing the svg graphic
- Why is my SVG rendered by D3 inside a Polymer component unstyled?
- D3.js Right click opens popup but does not affect the source svg when pop up closed
More Query from same tag
- Drawing a graph with images and arrows with d3 issues
- SVG generated with D3 doesn't scale like seemingly identical static SVG content
- How to simplify this D3 code?
- JSON keys for x axis, values for y
- Displaying certain data that of a query D3
- Drawing rectangular labels in d3
- Add text on top of bar in d3js chart -- no <text> elements added
- How to assign random colors to D3 bar chart?
- D3, Flask, Pythonanywhere, problems with csv files
- Far side of the Globe
- Convert spreadsheet to nested dictionary form for D3
- d3.js onclick event uses the value of variable at time of click instead of at time of drawing
- Animated Path multi series line chart in D3.Js
- d3.js stacked bar chart custom height for Category
- d3.js creating text arcs
- Group bar chart data not working as expected
- d3 line chart coloured by a factor
- Grid lines not showing in D3 histogram
- d3 units formatting SI with rounding (nvd3 charts)
- Line Graph using D3 is not starting from the date i want it to
- Call function when d3 add method will finish execution
- How to calculate SVG Linear Gradient
- How can i group elements that are bound to different data (to be used with forcesimulatoin) in D3 so that I can sort them
- Confusion over TopoJSON Format
- Multi-layer SankeyNetwork (NetworkD3) does not plot in R
- Creating Multiplie Pie Charts in a same page using d3 with JSON data
- How to update the axis scale on change events in cubism/d3
- d3.js Sankey diagram: rectangles fill color