score:1
Accepted answer
what you have...
properties: 'name': 'my region'
... is not a valid javascript object. it should be:
var region1 = {
type: "featurecollection",
name: 'my region',
features: counties.filter(function(d) {
return set1.has(d.id);
})
};
or, if you want them inside the properties
property:
var region1 = {
type: "featurecollection",
properties: {
name: 'my region',
features: counties.filter(function(d) {
return set1.has(d.id);
})
}
};
also, the convention in javascript is using lowercase for property names, so i advise you to use name
, not name
.
here is a bostock's bl.ocks with your object, look at the console: https://bl.ocks.org/anonymous/3fb65e6b6204e5731afc4152a35a0179/0d579d98e599cef73284c5e89b92e7fe94be42ab
Source: stackoverflow.com
Related Query
- D3 Topojson Adding Name Property to FeatureCollection
- D3.js: Adding class whose name is based on data
- Adding multiple class name to an element D3
- How to get SVG path data of TopoJSON feature without adding it to the DOM?
- Tree not expanding if I change the children's property name in data
- Getting Cannot read property 'type' of null topojson
- TopoJSON - adding properties to a topoJSON file
- Adding a dynamic attribute name to a selection
- Conditional color of countries selecting word in name of Topojson
- combining multiple geojson files w tsv and preserving property with topojson
- Difference between GeoJSON and TopoJSON
- Adding new nodes to Force-directed layout
- Uncaught TypeError: Cannot read property 'linear' of undefined
- Adding FontAwesome icons to a D3 graph
- Adding a chart legend in D3
- d3 adding data attribute conditionally
- d3.js: tickformat - adding a % sign without multiplying by 100
- d3.svg.line() error: Uncaught TypeError: Cannot read property 'line' of undefined
- C3JS - Cannot read property 'category10' of undefined
- D3.js - Cannot read property 'axis' of undefined
- Adding an image within a circle object in d3 javascript?
- Plotly.js Adding markers adds padding to x-axis
- d3.js: "Cannot read property 'weight' of undefined" when manually defining both nodes and links for force layout
- IE10 d3.v3.js error: Unable to get property 'prototype' of undefined or null reference
- D3 force layout - linking nodes by name instead of index
- Sorting objects based on property value in D3
- How can I use d3 classed selection to have name as function
- CSS padding property for svg elements
- d3.nest() key and values conversion to name and children
- Adding drop down menu using d3.js
More Query from same tag
- d3.js brushed area map to domain values
- d3 - change path value when equals infinity
- How to stop force-directed graph simulation
- d3js force directed - On hover to node, highlight/colourup linked nodes and links?
- Plot d3 chart on to Leaflet / Mapbox map
- d3 svg rect does not render in chrome
- D3.js clip paths cut off the edge of my graph
- How to show multiple lines in a d3 line graph?
- d3 — Progressively draw a large dataset
- Overflow with LineWithFocusChart when interpolating nvd3
- Are there any alternatives to .append() in D3.js?
- Convert Clusterfck array to JavaScript InfoVis Toolkit json hierarchical
- How to prevent default sorting of children nodes in d3.layout.partition?
- Replace the last bit of jQuery with d3.js - a selection with css-attribute change
- Resizing rectangle on Pan & Zoom Axes
- Introduce gap in path in d3
- Create an Animated Pulsing Circle with D3
- Why copy D3 source into an Angular Service?
- Detect clicked element on mousedown
- Ajax retrieve Json string but can not loop the success data as object
- D3 scatter chart dynamic axis positions
- d3.js Multi-series line chart interactive (tsv into literal data)
- How to add a single data point to a line graph in D3 without redrawing
- Button doesn't work when updating cards category
- Calling a custom function in d3
- arrows and text following click and hover
- d3.js Subtransition with exit() and enter()
- D3.JS 'zoom' undefined
- Add Icons next to SVG Text
- Trouble passing in additional parameters in function