这是我的代码,我想在图表中创建一条类似于目标的连续线,我遵循了Google Charts中发布的示例。我需要创建一个函数来做到这一点吗?
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Task', 'Hours per Day'],
['Work', 8],
['Eat', 2],
['TV', 4],
['Gym', 2],
['Sleep', 8]
]);
var options = {
title:'My Average Day',
vAxis: {title: 'Tasks'},
hAxis: {title: 'Hours per Day'},
seriesType:'bar',
series:{4:{type:'line'}}
};
var chart = new google.visualization.ComboChart(document.getElementById('chart1'));
chart.draw(data, options);
}
答案 0 :(得分:0)
foreach()
应该是“ bars”而不是“ bar”,并且您的数据应像这样为'Sleep'画线:
while ($row = sqlsrv_fetch_array($getResults,SQLSRV_FETCH_ASSOC))
{
$sql[] = "('".$row['ReportName']."'),"; // Add apostrophes, change to comma
$test = "INSERT INTO PublishedComments (ReportName) VALUES ".implode(",",$sql) . ';'; // Add semicolon
echo $test;
echo "<br />...........<br />";
}
seriesType