score:2
Accepted answer
not directly, but you can expand your array
For example:
jj = [{ genre: ['thriller', 'comedy'], title: 'foo'}, { genre: ['thriller', 'action'], title: 'papa'}]
to expand your array:
jj2 = []
jj.forEach(function(movie) { movie.genre.forEach( function(single_genre) { jj2.push({ language: movie.language, genre: single_genre, title: movie.title } ); } ); })
Then you can perform your nesting as normal:
d3.nest().key(function(d) { return d.genre; }).entries(jj2)
Source: stackoverflow.com
Related Query
- Can an array be used as a d3 nest key?
- How can d3.transform be used in d3 v4?
- Can D3 library be used with the Electron (Atom shell)?
- D3: use nest function to turn flat data with parent key into a hierarchy
- How can I use D3.js to take an array of Javascript objects use them in a line graph?
- Javascript: Array of dictionaries, get all key value pairs from one dictionairy with condition
- Can d3's key function handle a list element?
- d3.selectAll enter exit of nested key value pairs -- aka: how do array selections work?
- D3.js-How can I get the maximum value of a specified key in an object
- How can I draw an arc with array of points in d3 v4
- How to get a value from a stylesheet into the code so that it can be used programmatically?
- How can i bind an json data with a key and Name for display
- d3 join on object key within array
- Rearranging an array with key value
- How can i process huge javascript array (array of 20 mil coordinates) in browser side efficiently?
- How can I sum an array with D3?
- How can I bind an array of objects to arcs in a D3 pie chart?
- Object key value destructuring in array arguments
- How can I Loop through array to assign html to tooltip
- Javascript - Can not access array elements of an array created from a csv file
- How to filter a featurecollection to an object that can be used with path.bounds()
- How can D3js pack layout use data join by key for updates?
- how can i prevent d3.behavior.zoom().on("zoom", redraw) from being used when i mousedrag on my nodes?
- How can I access all keys and values in an array of objects without looping
- How can i group elements that are bound to different data (to be used with forcesimulatoin) in D3 so that I can sort them
- D3.js - can clipping paths be used with d3.svg.symbol?
- Cannot get d3 selection's updated data when key is used
- How can I skip an element of an array when I perform a .data (data) in d3.js
- Javascript compute percentages totals on array of objects by key
- Can I get a value returned from a $.Deferred() that can be used in the display?
More Query from same tag
- Draw a map with d3 and topojson
- Transform label in reverse order d3 radial chart
- d3 tree - parents having same children
- Get array of interested values from d3.nest() - D3JS
- How to show circles (created using JSON data) in reverse order using a delay function?
- Add legend to chart with D3 V4 Angular-cli
- Why is my D3 zoom transform not centering properly?
- Show a D3 SVG Within a Tooltip
- Select and append a single element in a node with D3
- Display alternative images / tiles where tile display fails (D3 Geo Tiles)
- legend placement issue in D3 Bar chart
- d3, transitioning a scatterplot into a bar graph
- Fetch API cannot load and Uncaught (in promise) TypeError: Failed to fetch Errors in d3.js
- c3 graph in a dark background; how to change axis and tick value color
- How do projects like d3 get all of their source into one large javascript file?
- D3 responsive line chart display no lines
- D3.js JSON parse error
- How do I filter data in D3 based on several variables within JSON data?
- D3js filter selection
- How do I count distinct values in d3 nest rollup?
- In d3 selection method chaining, how can I reference the values of the selected element?
- Can enter() selection be reused after append/insert?
- d3js bar chart upside-down and sliding brushes
- Custom colors in C3.js timeseries chart
- Overlay d3 paths onto Google Maps?
- cal-heatmap - How to change text color based on rect .q1{} color?
- d3 bar chart with brush
- bar chart not updating after drop down selection - d3.js
- Creating a d3 selection over an existing, detached SVG element
- Interactive SVG / control through links