我尝试了许多用PHP生成“Line Google Chart”的方法,有或没有json我每次尝试都会得到“没有列”错误。只想做几个月的笔记。我想做Counts /一个月的天数图。我怎么能解决它?
代码;
.
.
.
$google_array = array();
foreach($column_day_names["Jan"] as $key => $value) {
$google_array[] = array($key => $value);
}
$json_first=json_encode($google_array);
echo $json_first . "\xA";
$json = json_encode($google_array);
$json = str_replace("{", "[", $json);
$json = str_replace("}", "]", $json);
echo $json;
Jan Array的First_json输出:
[{ “01”:1},{ “02”:1},{ “03”:6},{ “04”:1},{ “05”:3},{ “08”:1 },{ “10”:1},{ “11”:1},{ “12”:1},{ “13”:1},{ “16”:1},{ “17”:1}, { “18”:2},{ “20”:1},{ “21”:2},{ “22”:2},{ “23”:1},{ “25”:1},{” 27 “:2},{” 28 “:1},{” 29 “:1},{” 30 “:3},{” 31" :1}]
Jan Array的第二个Json输出:
[[ “01”:1],[ “02”:1],[ “03”:6],[ “04”:1],[ “05”:3],[ “08”:1 ],[ “10”:1],[ “11”:1],[ “12”:1],[ “13”:1],[ “16”:1],[ “17”:1], [ “18”:2],[ “20”:1],[ “21”:2],[ “22”:2],[ “23”:1],[ “25”:1],[” 27 “:2],[” 28 “:1],[” 29 “:1],[” 30 “:3],[” 31" :1]
主阵列($ column_day_names)
Array (
[Jan] => Array
(
[01] => 1
[02] => 1
[03] => 6
[04] => 1
[05] => 3
[08] => 1
[10] => 1
[11] => 1
[12] => 1
[13] => 1
[16] => 1
[17] => 1
[18] => 2
[20] => 1
[21] => 2
[22] => 2
[23] => 1
[25] => 1
[27] => 2
[28] => 1
[29] => 1
[30] => 3
[31] => 1
)
[Feb] => Array
(
[01] => 1
[03] => 2
[09] => 1
[11] => 2
[12] => 1
[13] => 1
[16] => 2
[17] => 1
[18] => 1
[22] => 1
[24] => 1
)
[Mar] => Array
(
[01] => 2
[02] => 2
[07] => 1
[09] => 1
[10] => 2
[11] => 2
[16] => 2
[18] => 1
[21] => 1
[25] => 3
[29] => 1
[30] => 1
[31] => 1
)
[Apr] => Array
(
[04] => 2
[06] => 1
[08] => 1
[11] => 3
[12] => 1
[16] => 1
[18] => 1
[20] => 2
[22] => 1
[27] => 1
[29] => 2
[30] => 1
)
[May] => Array
(
[02] => 1
[06] => 2
[07] => 1
[08] => 1
[12] => 1
[21] => 2
[23] => 2
[30] => 1
)
[Jun] => Array
(
[01] => 1
[03] => 3
[05] => 2
[06] => 1
[17] => 2
[20] => 2
[24] => 1
[26] => 1
[30] => 1
)
[Jul] => Array
(
[10] => 1
[12] => 2
[20] => 1
[22] => 1
[31] => 1
)
[Aug] => Array
(
[04] => 2
[06] => 3
[10] => 2
[21] => 1
[26] => 1
)
[Sep] => Array
(
[06] => 6
[08] => 1
[14] => 3
)
[Oct] => Array
(
[08] => 1
[14] => 2
[20] => 1
[21] => 1
[23] => 1
[24] => 2
[28] => 1
)
[Dec] => Array
(
[20] => 1
[21] => 1
[22] => 1
[26] => 1
[31] => 4
)
)
一个月的数组($ column_day_names [“Jan”]);
Array
(
[01] => 1
[02] => 1
[03] => 6
[04] => 1
[05] => 3
[08] => 1
[10] => 1
[11] => 1
[12] => 1
[13] => 1
[16] => 1
[17] => 1
[18] => 2
[20] => 1
[21] => 2
[22] => 2
[23] => 1
[25] => 1
[27] => 2
[28] => 1
[29] => 1
[30] => 3
[31] => 1
)