我在网络应用中使用材料列图。
我已经跟进了
和代码在下面,
private Map<String, BigDecimal> targetMisc;
我想做什么两件事/需要你的手,(在红色圆圈区域的图像。)
提前致谢,
答案 0 :(得分:1)
需要为vAxis
设置configuration options。
vAxis: {
title: 'Hours',
ticks: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
}
title
作为轴标签。ticks
。但是,ticks
似乎不适用于材质图表
请注意,选项也必须转换...
google.charts.Bar.convertOptions
此示例显示核心图表和材料图表...
google.load('visualization', '1', {
packages: ['corechart', 'bar'],
callback: drawBarChart
});
function drawBarChart() {
var data = google.visualization.arrayToDataTable([
['Structure', 'Estimated', 'Actual'],
['hours', 6, 8],
['hours2', 20, 18],
]);
var options = {
chart: {
title: 'Structures by Hours',
subtitle: 'Estimated vs Actual',
},
vAxis: {
title: 'Hours',
ticks: [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
}
};
var chart = new google.visualization.ColumnChart(document.getElementById('columnchart_hours'));
chart.draw(data, options);
var chart2 = new google.charts.Bar(document.getElementById('columnchart_hours2'));
chart2.draw(data, google.charts.Bar.convertOptions(options));
}
<script src="https://www.google.com/jsapi"></script>
<div id="columnchart_hours"></div>
<div id="columnchart_hours2"></div>