This article mainly introduces PHP's dynamic bar chart simplified version, which is an improvement based on the implementation of the bar chart described above. it has some reference value, for more information about how to implement dynamic bar charts in PHP, see the examples in this article. 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.
<? 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);?>