- Google 图表教程
- Google 图表 - 主页
- Google 图表 - 概览
- Google 图表 - 环境设置
- 配置语法
- Google 图表 - 区域图表
- Google 图表 - 条形图表
- Google 图表 - 气泡图表
- Google 图表 - 日历图表
- Google 图表 - K 线图
- Google 图表 - 柱形图
- Google 图表 - 组合图表
- Google 图表 - 直方图图表
- Google 图表 - 折线图
- Google 图表 - 地图
- Google 图表 - 组织结构图
- Google 图表 - 饼状图
- Google 图表 - 桑基图
- Google 图表 - 散点图
- 阶梯区域图表
- Google 图表 - 表格图表
- Google 图表 - 时间线图表
- Google 图表 - 树状图图表
- Google 图表 - 趋势线图表
- Google 图表实用资源
- Google 图表 - 快速指南
- Google 图表 - 实用资源
- Google 图表 - 讨论
直方图图表多重序列
以下是一个包含多重序列的直方图图表的示例。我们已经看到Google 图表配置语法章节中用来绘制此图表的配置。因此,让我们来看一个完整的示例。
示例
googlecharts_histogram_multiple.htm
<html>
<head>
<title>Google Charts Tutorial</title>
<script type = "text/javascript" src = "https://www.gstatic.com/charts/loader.js">
</script>
<script type = "text/javascript">
google.charts.load('current', {packages: ['corechart']});
</script>
</head>
<body>
<div id = "container" style = "width: 550px; height: 400px; margin: 0 auto">
</div>
<script language = "JavaScript">
function drawChart() {
// Define the chart to be drawn.
var data = google.visualization.arrayToDataTable([
['Student Roll No', 'Height', 'Weight'],
['1', 80, 40],['2', 55, 30],['3', 68, 34],['4', 80, 40],['5', 54, 27],
['6', 70, 35],['7', 85, 42],['8', 78, 40],['9', 70, 35],['10', 58, 28],
['11', 90, 45],['12', 65, 33],['13', 88, 50],['14', 82, 41],['15', 65, 30],
['16', 86, 43],['17', 45, 30],['18', 62, 30],['19', 84, 42],['20', 75, 40],
['21', 82, 41],['22', 75, 40],['23', 58, 30],['24', 70, 35],['25', 85, 40]
]);
// Set chart options
var options = {
title: 'Students Height and Weight',
legend: { position: 'bottom' }
};
// Instantiate and draw the chart.
var chart = new google.visualization.Histogram(document.getElementById('container'));
chart.draw(data, options);
}
google.charts.setOnLoadCallback(drawChart);
</script>
</body>
</html>
结果
验证结果。
googlecharts_histogram_charts.htm
广告