我需要使用基于 1 周、2 个月、4 个月、8 个月和 12 个月的产品的平均评分来可视化谷歌图表,所以我尝试使用谷歌可视化工具将其可视化,所以我得到了下面的代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>
Google Visualization API Sample
</title>
<script type="text/javascript" src="//www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart']});
</script>
<script type="text/javascript">
function drawVisualization() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
['Duration', 'rating'],
['1 week', 1],
['2 Months', 2],
['4 Months', 3],
['8 Months', 4],
['1 Year', 5],
]);
// Create and draw the visualization.
new google.visualization.ColumnChart(document.getElementById('visualization')).
draw(data,
{title:"Yearly Coffee Consumption by Country",
width:600, height:400,
hAxis: {title: "Year"}}
);
}
google.setOnLoadCallback(drawVisualization);
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="visualization" style="width: 600px; height: 400px;"></div>
</body>
</html>
在这里它将输出显示为
我需要 y 轴必须是 1 到 5,并且 x 轴必须具有基于时间范围的平均评分,这可能吗?我必须做什么?