score:4
Accepted answer
You basically have two options here: 1. Munge your data into a format that's easier to deal with 2. Try to deal with your current format.
I think (1) is going to make your life easier in most cases:
data = data.map(function(d) {
// get the date
var date = d3.keys(d)[0];
// put it into the inner object
d[date].date = date;
// return the inner object
return d[date];
});
This gives you rows like
{
"orders": "10",
"revenue": "1000",
"date": "2013-08-21"
}
which are much easier to deal with. Might also be a good idea to parse the date as you do this.
Source: stackoverflow.com
Related Query
- Filtering JSON data for d3.js
- How to load data from an internal JSON array rather than from an external resource / file for a collapsible tree in d3.js?
- Filtering data for d3.js sankey diagrams
- Best practices for filtering data
- Getting data from JSON for D3.js
- Basic JSON Formatting for C3.js when data loaded via URL using Rails
- How to read JSON data from same json for tree layout insteadof reading from other .JSON file?
- How can i bind an json data with a key and Name for display
- trying to get MySQL data into nested json file for d3?
- Node generation from json data for force layout
- What are best practices for JSON data aggregation?
- Prepare nested JSON data for D3 stacked bar chart
- Convert tabular json data to d3 hierarchal data for pack chart
- Time in x-axis and data for the y-axis for line chart in d3.js doesn't match/show with what (data) is on JSON
- Converting data structure of a JSON array for stacked bar chart
- Filtering and matching json data in D3.js hover
- Formatting data for use with JSON and D3.js
- Should I filtering my data for d3 in SQL or JS
- Format of json data for D3 bundle layout
- using json data in a flask endpoint for d3 script
- data not bind from json for d3 chart
- Loading internal JSON data rather than from an external resource / file for a sunburst in d3
- Converting separate data frames to a JSON file for a tidy tree chart
- Load popup on hover data from json file for datamaps
- Requesting embedded JSON data for D3
- How to generate JSON from a pandas data frame for dynamic d3.js tree
- D3 filtering root data from flare.csv for treemap
- Transform sequence of data into JSON for D3.js visualization
- Javascript data structure for json data
- Loading Image till external json data loads for collapsible tree -d3.js
More Query from same tag
- D3 Multi Series Line chart with non time x axis
- D3 Scatterplot: Tooltip appears on initial load, but disappears after filter updated using dropdown
- Building a train movement graph
- D3.js draw each point at a time
- How to change the existing html text in a D3 rect?
- Porting Parallel Coordinates code from d3.js v3.5.16 to 4.0
- Positioning SVG at middle of browser window
- D3 v4 Scatterplot chart data points are not updating on zoom
- D3: Create a continuous color scale with many strings/inputs for the range and dynamically changing values of the domain
- D3 V3 Multi-line Chart - Issues appending lines to svg
- Is it possible to use D3.tree() with a dataset that includes parents instead of children?
- nvd3 - How to redraw axis on windows resize
- Cannot read property 'pack' of undefined
- Why are .domain, tickFormat and tickValues not recognised inside dimensions variable? (d3, parallel coordinates)
- Make SVGs on top of leaflet map not respond to pan events
- Looping over objects in an array in javascript
- How to insert text sibling elements for each existing circle element of svg group?
- D3 Grouped Bar Chart From Arrays
- Passing data for nvd3 chart from Flask as an argument
- How to create sorted square graph using javascript
- Color descendant nodes and links broken after moving to d3 v5
- Triangle scatter plot with D3.js
- NVD3 - Is there a way to increase the size of the bubbles?
- How can I merge or join d3 selections from different d3.selects?
- D3js increase space between X axis
- Convert raw json to d3 compatible dataset
- D3 adding 19 hours when it formats time
- tickSizeOuter not equal zero, but just first and last tick of yAxis shows line
- d3 chart refresh duplicate
- Trouble adding tooltip to my d3 tree nodes