可以从折线图谷歌图表中的点向下画一条线(点线和直线)吗?
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'Sales'],
['2004', 1000],
['2005', 1170],
['2006', 660],
['2007', 1030]
]);
var options = {
title: 'Company Performance',
pointSize: 10
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
chart.draw(data, options);
这个概念是这样的......
最佳答案
您可以通过使用 ComboChart 并使用 DataView 来复制数据系列来伪造这些线条。将第一个系列设置为“线”类型,将第二个系列设置为“条”类型。禁用条形图上的交互性并从图表图例中删除该系列。使用 bar.groupWidth 选项缩小绘制的条形,使其类似于线条:
bar: {
// use this to set the width of the vertical lines
groupWidth: 2
},
series: {
0: {
// this is the line series
type: 'line',
pointSize: 10
},
1: {
// this creates the vertical "lines" down from the points
type: 'bars',
color: '#666666',
enableInteractivity: false,
visibleInLegend: false
}
}
请参阅此处的示例 http://jsfiddle.net/asgallant/TD92C/1/ .
关于javascript - 谷歌图表折线图上的直线向下?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18245595/