我有点卡住 Javascript 来阅读我的 PHP 代码
到目前为止,我需要用脚本顶部的 PHP 变量替换 google 图表的 javascript 中的数字。
任何帮助都会很棒
<?php
$jan = 'SQL Code for Jan';
$feb = 'SQL Code for Feb';
$mar = 'SQL Code for Mar';
$apr = 'SQL Code for Apr';
$may = 'SQL Code for May';
$jun = 'SQL Code for Jun';
$jul = 'SQL Code for Jul';
$aug = 'SQL Code for Aug';
$sept = 'SQL Code for Sept';
$oct = 'SQL Code for Oct';
$nov = 'SQL Code for Nov';
$dec = 'SQL Code for Dec';
?>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Month', '# of Logins'],
['Jan', 999; ],
['Feb', 1170],
['Mar', 660],
['Apr', 660],
['May', 660],
['Jun', 660],
['Jul', 660],
['Aug', 660],
['Sept', 660],
['Oct', 660],
['Nov', 660],
['Dec', 1030]
]);
var options = {
title: 'Number of Logins'
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
<div id="chart_div" style="width: 900px; height: 500px;"></div>