score:3
Accepted answer
.data()
expects to be given an array of objects to be matched against the selection. You're passing a single object, so it doesn't work. You can either use .datum(d)
or .data([d])
to make it work.
Quick and dirty demo here.
Source: stackoverflow.com
Related Query
- Drawing states separately with d3 js and country topojson file
- Plotting topojson file with d3.js (NYC boroughs and census tracts)
- How do I save/export an SVG file after creating an SVG with D3.js (IE, safari and chrome)?
- Difficulty accessing json file with d3 and flask
- Drawing voronoi diagram from a csv file with d3.js
- Put markers to a map generated with topoJSON and d3.js
- Creating .exe file with pyinstaller and Matlab engine
- d3 world map with country click and zoom almost working not quite
- Let's make a TopoJSON map and view it with D3.js
- how to start drawing a line with a space between y-axis and it using d3js
- Displaying place (city) data with D3 and TopoJson
- Using d3 in meteor on windows 8.1, how can I display a world map, zoomed in on the US, with country borders and US state borders?
- Trying to Refactor Codebase with NY topojson file
- Aligning topojson file with preset projection with points with point locations loaded via an api
- SVG path drawing and filling with image
- Drawing 100 circles with IDs and associating mouse events with them
- "Cannot read property 'length' of null" with Angular-cli and a json file
- D3 JSON file with source and index as strings rather than indices
- Mapping data with topojson and D3
- Drawing an error ellipse in javascript with d3 and numericjs
- D3.js scope issue with external data.json file and brush
- Draw a map with d3 and topojson
- Reload a csv file and call the same view with it
- How do I create and write to a new file (csv) and have the browser download it with javascript or D3.js?
- how to load csv file with vue.js and d3.js
- Drawing circles with D3 from TSV file
- How do I get my topojson file to work with datamaps?
- Drawing link with d3 and d3-flextree plugin
- (Javascript with D3) Data from CSV file only being used once and returning undefined or NaN second time
- Javascript File Reading and Parsing Only Working with Breakpoints
More Query from same tag
- Why is data not updating correctly on this D3.js barchart?
- How to watch an attribute in an angularjs directive?
- D3 treemap for very large dataset
- How to update variable in d3 chart using ajax in django
- D3.js : Line Generation with dates
- d3fc - Crosshair with snapping using latest version 14
- D3 append div with id
- Create relation with existing nodes Cypher Neo4j
- SVG with Horizontal Scrolling
- d3js open a new tab with the country id in map chart
- Proper data structure for d3 nodes
- D3.js table with an associative-array dataset
- How to draw dots in the coordinates of slices in a d3 pie chart?
- D3 Line with JSON Data, Not Rendering
- d3's selection.text() is expensive
- Export standalone offline html plot of matplotlib figures using mpld3
- Placement of SVG circle that lacks center coordinates
- Export a set of svg image tags as a single png
- Change curved lines to straight lines
- Bar Chart With View Finder d3.js
- D3 scatter plot - visible points outside the chart after zoom
- D3 4.9.1 returns different value for .style("transform")
- build specific icon from data
- Sort JSON by a given order via Array (JavaScript, D3)
- Group nodes by connections
- what is the d3 default key function?
- Howto set custom ticks and labels on Y axis in nvd3
- How to add a (custom) thousand separator in D3?
- d3js - line chart adding `circles` throw errors
- Les Miserables Co-occurrence