Detailed explanation of using Echarts to generate statistical reports with PHP

小云云
Release: 2023-03-19 09:12:01
Original
8006 people have browsed it

This article mainly introduces the implementation code of PHP using Echarts to generate data statistical reports. Friends who need it can refer to it. I hope it can help everyone.

echarts statistics, simple example

Look at the renderings first

##Look at the code

HTML page is ECharts Prepare a Dom, custom width and height

  

    

  

Copy after login

js file can refer to the official website, or download it here, introduce

The following is the specific method

Copy after login

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)); }
Copy after login

At this point, a simple echarts statistical chart has come out

If you don’t understand some parameters in echarts, you can refer to the official website Echarts Documentation

Related recommendations:

Detailed explanation of the correct posture of using Echarts in React components

HTML5, JS, JQuery, ECharts asynchronous loading

ECharts3 implements the operation of dynamic data + time axis

The above is the detailed content of Detailed explanation of using Echarts to generate statistical reports with PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!