萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> php編程 >> highchats與php結合生成動態統計圖

highchats與php結合生成動態統計圖

   series: [{

  type: 'pie',

  name: 'Browser share',

  data: [

  ['Firefox', 45.0],

  ['IE', 26.8],

  {

  name: 'Chrome',

  y: 12.8,

  sliced: true,

  selected: true

  },

  ['Safari', 8.5],

  ['Opera', 6.2],

  ['Others', 0.7]

  ]

  }]

  主要看這段:

  {

  name: 'Chrome',

  y: 12.8,

  sliced: true,

  selected: true

  }

  '上海', 'y'=>28.2),

  array('name'=>'北京', 'y'=>48.2),

  array('name'=>'廣東', 'y'=>18.2),

  );

  $data = json_encode($b);

  echo($data);

  }

  ?>

  以下是php輸出json數據,供js使用:

  輸出:

  {"2":{"name":"lo","data":[0,0]},"3":{"name":"eth0","data":[0.40377,0.00353]}}

  js調用:

  series: [

  ds[2], ds[3]

  ]

copyright © 萬盛學電腦網 all rights reserved