http://savedbythegoog.appspot.com/?id=d6fd6426f4f93a21e2ef806a2a88e6cc0576434e 请检查上面的链接。我想把最后一列标记为“泥浆重量”的一条直线并保持其他线条平滑但我总是直线或平滑所有线条。
google.load('visualization', '1', {packages: ['corechart']});
function drawVisualization() {
// Create and populate the data table.
var data = google.visualization.arrayToDataTable([
['depth', 'pore pressure', 'pore +SM', 'frac. pressure', 'frac. -SM', 'mud weight'],
[10500, 9.75, 10.25, 16.95, 16.45, 12],
[11100, 11.5, 12, 17.35, 16.85, 12],
[11099, 11.5, 12, 17.35, 16.85, 16.85],
[12000, 15, 15.5, 17.8, 17.2, 16.85],
[13000, 16, 16.5, 18.1, 17.6, 16.85],
[14000, 16.35, 16.85, 18.4, 17.9, 16.85],
[13999, 16.35, 16.85, 18.4, 17.9, 17.9],
[16000, 16.8, 17.3, 18.7, 18.2, 17.9],
[18000, 17.2, 17.7, 18.9, 18.4, 17.9],
[19000, 17.4, 17.9, 19, 18.5, 17.9]
]);
// Create and draw the visualization.
var ac = new google.visualization.ComboChart(document.getElementById('visualization'));
ac.draw(data, {
title : 'pore pressure and fracture pressure',
width: 600,
height: 400,
vAxis: {title: "Cups",direction:-1},
hAxis: {title: "Month"},
orientation: 'vertical',
seriesType: "line",
'smoothLine': true,
series: {5: {type: "line",'smoothLine': false}}
});
}
google.setOnLoadCallback(drawVisualization);
<div id="visualization" style="width: 600px; height: 400px;"></div>
答案 0 :(得分:1)
而不是'smoothLine':true/false
,您应该使用curveType:'function'/'none'
。
此外,您正在错误地为该系列编制索引 - 该系列为零索引,但您的depth
列不计入此索引,因此mud weight
系列实际上是索引4。
以下是更新的代码,应替换您的ac.draw(data, {...})
:
ac.draw(data, {
title : 'pore pressure and fracture pressure',
width: 600,
height: 400,
vAxis: {title: "Cups",direction:-1},
hAxis: {title: "Month"},
orientation: 'vertical',
seriesType: "line",
curveType: 'function',
series: {4: {curveType: 'none'}}
});