chart js data from mysql vanila javscript

Solutions on MaxInterview for chart js data from mysql vanila javscript by the best coders in the world

showing results for - "chart js data from mysql vanila javscript"
Tim
23 Jun 2017
1var randomScalingFactor = function(){ return Math.round(Math.random()*100)};
2var lineChartData = {
3    labels : <?=json_encode($months);?>,
4    datasets : [
5        {
6            label: "My First dataset",
7            fillColor : "rgba(220,220,220,0.2)",
8            strokeColor : "rgba(220,220,220,1)",
9            pointColor : "rgba(220,220,220,1)",
10            pointStrokeColor : "#fff",
11            pointHighlightFill : "#fff",
12            pointHighlightStroke : "rgba(220,220,220,1)",
13            data : <?=json_encode(array_values($monthvalues));?>
14        }
15    ]
16}
Eleana
05 Nov 2016
1$months = array("january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december");
2$monthvalues = array();
3foreach ($months as $month) {
4    $monthvalues[$month] = 0;
5}
6
7$result = mysql_query("SELECT month, count(*) FROM customer group by month") or die(mysql_error());
8while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
9    $monthvalues[$row[0]] = (int)$row[1];
10}