PHP Outputing JSON file -
i trying accomplish next json format:
function generatepieticket(data) { $('#piecharts').highcharts({ ..... series: [{ type: 'pie', name: 'ticket share team', data: [ ['technical', 45.0], ['logistic', 26.8], { name: 'others', y: 28.2, sliced: true, selected: true }, ] }] so later phone call asynchronously this:
function generatepieticket(data) { $('#piecharts').highcharts({ .... series: info this effort generate desired json
function getpiedata(){ $data = array( array( 'type' => 'pie', 'name' => 'sample pie chart', 'data' => array( array('technical', 45.0), array('logistics', 26.8) ), '' => array( 'name' => 'others', 'y' => 28.2, 'sliced' => 'true', 'selected' => 'true' ) ) ); header('content-type: application/json'); homecoming json_encode($data); } and result
[ { "type": "pie", "name": "sample pie chart", "data": [ [ "technical", 45 ], [ "logistics", 26.8 ] ], "": { "name": "others", "y": 28.2, "sliced": "true", "selected": "true" } } ] i confused how part:
data: [ ['technical', 45.0], ['logistic', 26.8], { name: 'others', y: 28.2, sliced: true, selected: true }, ] could tell me how right this?
the inner array belongs data.
function getpiedata(){ $data = array( array( 'type' => 'pie', 'name' => 'sample pie chart', 'data' => array( array('technical', 45.0), array('logistics', 26.8), array( 'name' => 'others', 'y' => 28.2, 'sliced' => 'true', 'selected' => 'true', ), ) ) ); header('content-type: application/json'); homecoming json_encode($data); } php json highcharts
No comments:
Post a Comment