score:1
Accepted answer
It's pretty straight forward. Just create an array in PHP with the same leves and keys:
$data = [
'2016' => [
[
"date" => "2016/01/01",
"close" => 837
],
[
"date" => "2016/12/01",
"close" => 769
],
],
'2015' => [
[
"date" => "2015/01/01",
"close" => 637
],
[
"date" => "2015/12/01",
"close" => 669
],
],
// ... and so on
];
Demo: https://3v4l.org/cfHqs
Source: stackoverflow.com
Related Query
- How do I structure data in php to get the correct json result?
- How do I get D3 Data Driven Document to display a moment.js datetime in the correct time zone?
- Reading JSON data into the correct data structure
- d3 graph - How do I make the JS get the JSON from PHP script and then select axes and plot?
- In d3, how to get the interpolated line data from a SVG line?
- how to encode this data to parent / children structure in JSON
- How to get the total depth of an unknown JSON hierarchy?
- dc.js - how to get the average of a column in data set
- How to get the data from the c3.js
- how can i group JSON data into the weeks according to calender?
- How to get the specific JSON array from a value in that array
- How do I get the d3 svg points to stay in their correct position on the leaflet map when zooming?
- How to get SVG path data of TopoJSON feature without adding it to the DOM?
- How to get the index of the data element in a histogram on mouseover?
- Passing JSON from Grails Controller to d3 - how to get the .gsp side working?
- How to use the quantize function with my json data file
- How to get the minimum and maximum value between a given range in data set in d3.js
- How do you get JSON data and create a line chart with d3.js?
- How to get a data from an analysis in R in Json file format to get D3 visualisations?
- D3 how to properly get the key value INSIDE of a json object
- Unable to get the correct index of node that was clicked in d3 and update the JSON at that location
- How to extract json data of the selected nodes using d3.js?
- d3.js how to append the json data as tool tip on the circles
- How do I structure the Data array for the following d3 chart, in order to populate with real data
- How to get json data from controller in jsp?
- I can not get php produced json data with d3.json
- In d3 4.0, how can I get extra data from the stratified object?
- D3.js: How to get the selection index, instead of the data index?
- How to get the JSON path from element
- How to parse to get the data in d3.js
More Query from same tag
- d3 callback function after .remove()
- Can we change the padding property of pack layout with a transition?
- exploding the pie slice on hovering the legend in D3 pie chart
- Why is the histogram not displaying if I read the data from a mysql database
- d3 collapse tree - semantic zoom and pan example - problems
- Javascript - array.map returns several arrays, why?
- d3-force - Nodes are dragged away from links, ticks not run
- How to make a flat line in D3.js (version 3.x)
- Confused with selection of d3.js version 3
- d3 data binding not creating child elements using join
- D3.JS V4 update chart elements after adding/updating data
- D3JS how to get the y postition with bisector?
- Calm down initial tick of a force layout
- Stroke-dasharray tween on multiple paths
- How can I split an ordinal axis in d3?
- d3.js label graph edges [when edge values not numeric]
- D3 canvas globe mouse events
- D3.js (Wilkinson type) Dot Plot Example
- How to reject promise on d3 xhr request timeout?
- Update d3.js data with setInterval, not xAxis labels update
- D3 v4 force directed graph with rectangles
- d3 v4 adding new nodes to force directed graph
- End points of the links of the force directed graph always stuck to left corner of the rectangular node
- d3.selectAll to change styles by class in v4
- d3.js brushable choropleth
- Clean way to find associated values of a stacked bar graph
- D3 bar graph does not re-size correctly
- Searchable collapsible tree using D3.js in google sheet
- Circles disappear on mobile, when map is zoomed
- Dots with old data points do not get removed