PHP dynamic bar chart ultimate version, php bar chart ultimate version
This article provides an example of PHP's ultimate version for implementing dynamic bar charts. Share it with you for your reference. The specific analysis is as follows:
I have already written about the principle of making only dynamic column charts. Because there was a new demand yesterday afternoon, I modified it again this morning and displayed the data in the table according to the number.
The following code is pasted out to facilitate future display. The idea is just a spark. Today I want to do this, and I don't have to think about it next time, therefore, writing notes is a good form.
<! DOCTYPE html> <? Php // calculate the function last_month_today ($ time) {$ last_month_time = mktime (date ("G", $ time), date ("I ", $ time), date ("s", $ time), date ("n", $ time), 0, date ("Y", $ time )); $ last_month_t = date ("t", $ last_month_time); if ($ last_month_t <date ("j", $ time) {return date ("Y-m-t H: i: s ", $ last_month_time);} return date (" Y-m ", $ last_month_time ). "-d", $ time) ;}?> <? Php include dirname (_ FILE __))). '/config. php '; $ endDate = date ('Y-m-d'); $ date = strtotime ($ endDate); $ beginDate = last_month_today ($ date ); $ SQL = 'select count (*) from newpro where p_date> \''. $ beginDate. '\' and p_date <\''. $ endDate. '\ '''; $ d = db ()-> query ($ SQL)-> fetch (PDO: FETCH_NUM); $ sql2 = $ SQL. 'and is_pa_check_first = 1 and is_pa_check_second = 1 and is_pa_check_third = 1'; $ D2 = db ()-> query ($ sql2)-> fetch (PDO: FETCH_NUM); $ sql3 = $ SQL. 'and is_pa_check_first = 1'; $ d3 = db ()-> query ($ sql3)-> fetch (PDO: FETCH_NUM); $ sql4 = $ SQL. 'and is_pa_check_first = 1 and is_pa_check_second = 1'; $ d4 = db ()-> query ($ sql4)-> fetch (PDO: FETCH_NUM ); // query the situation where each person passes the review: $ sqlab = 'select d_m, sum (sroce) as total_score, count (d_m) as total_number from newpro where is_pa_check_first = 1 and is_pa_c Heck_second = 1 and is_pa_check_third = 1 group by d_m'; $ row = db ()-> query ($ sqlab)-> fetchAll (PDO: FETCH_ASSOC);?> <Html>
The database is easy to avoid. In fact, it is easy to create a test data table based on the queried table name and field name. The key is the idea. No matter how it changes, the idea is the key.
To better understand the code effect, cut a picture.
I hope this article will help you with php programming.