Home>Article>Backend Development> How to use Echarts to generate statistical reports in PHP
echarts statistics, simple example
Recommended: "PHP Video Tutorial"
Look at the renderings first
Look at the code
HTML page Prepare a Dom for ECharts, customize the width and height
js file can refer to the official website, or download it here and introduce
The following is the specific method
Query the data you need in the controller (the date queried here and the corresponding quantity)
//折线统计 public function getRes(){ $user = M('account'); $sql = "SELECT date(createTime) AS date,count(*) as count FROM t_account GROUP BY date "; $result = $user->query($sql); $this->ajaxReturn(array('code'=>200,'result'=>$result)); }
At this point, a simple echarts statistical chart comes out
If you don’t understand some parameters in echarts, you can refer to the official website https://www.echartsjs.com/option.html#title
The above is the detailed content of How to use Echarts to generate statistical reports in PHP. For more information, please follow other related articles on the PHP Chinese website!