Google chart problem
official document https://google-developers.app.
$.getJSON("XXX&m=" + m, function(json) {
var data = new google.visualization.DataTable(json);
data.addColumn("string", "");
data.addColumn("number", "");
data.addRows(json);
console.log(json);
php
$chartData = $pdo->query(
"SELECT DISTINCT
FROM_UNIXTIME(add_time, "%m/%d") as add_time,
count(view_id) as viewTime
FROM `view`
GROUP BY `add_time` "
);
foreach ($chartData as $key) {
if (substr($key["add_time"] ,0 ,2) == $_GET["m"]) {
$data[] = array(
$key["add_time"], (int) $key["viewTime"]
);
}
}
echo json_encode($data ,JSON_UNESCAPED_SLASHES);
every view I have has a add_time
timestamp
above I convert the timestamp to mm/dd
format, and then through $_ GET ["m"]
, for example, 05
output [["11Univer 01", 1], ["11Uniqp02", 1], [" 11pin03", 1], ["11pin05", 1]]
but in fact 11App 01
, 11max 02
, 11max 03
, 11max 05
are all multiple strokes
through count (view_id) as viewTime), it is all a sum.
so I can"t figure out how to figure out how many strokes there are for each date.