我有一個谷歌圖表實施的小問題。按照要求,我應該有雙Y軸和Y軸的條應該重疊。我實現了下面的輸出與我的代碼:谷歌圖表中的酒吧重疊問題 - 組合圖表
通告最後兩根棒的兩個藍色箭頭。藍色酒吧隱藏在紅色酒吧後面,因爲它更小。它實際上應該是這個樣子:
這是我的js文件代碼:
var chart, data;
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawChart);
function drawChart()
{
// Create the data table.
data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addColumn('number', 'pieces');
data.addColumn('number', 'ratio');
data.addColumn('number', 'ratio2');
data.addRows([
['Mushrooms', 300, 200, 50, 1],
['Onions', 100, 244, 4, 3],
['Olives', 100, 400, 56, 10]
]);
// Set chart options
options = {
chartType:"ComboChart",
containerId:"visualization",
stackSeries: true,
isStacked : true,
seriesDefaults: {
rendererOptions: {
barPadding: 0,
barMargin: 10
},
pointLabels: {
show: true,
stackedValue: true
}
},
grid: {
background: '#272424',
drawGridlines: false
},
seriesType: "bars",
series: {
0: {
targetAxisIndex: 0
},
1: {
targetAxisIndex: 1
},
2: {
targetAxisIndex: 1,
type: "line"
},
3: {
type: "line"
}
},
hAxis:{
},
vAxes: {
0: {
title: "Slices",
label:'Slices',
type:'bars'
},
1: {
title: "pieces",
label:'pieces',
type:'bars'
},
2: {
title: "ratio,",
label:'ratio',
type:'line'
},
3: {
title: "ratio2,",
label:'ratio2',
type:'line'
}
}
};
// Instantiate and draw our chart, passing in some options.
chart = new google.visualization.ComboChart(document.getElementById('chart_div'));
chart.draw(data, options);
google.visualization.events.addListener(chart, 'select', selectionHandler);
}
function selectionHandler() {
var selectedData = chart.getSelection(), row, item;
if(selectedData != '')
{
row = selectedData[0].row;
item = data.getValue(row,3);
alert("You selected :" + item);
}
}
任何人都可以給我建議,我怎麼能去呢?任何幫助,將不勝感激。
感謝您的幫助。我不希望他們並排!我只想要他們堆疊!到目前爲止,我的老大對你提供的解決方案沒問題!我希望將來也不需要SVG編輯! +1。再次感謝! –
這裏有沒有使一組酒吧變薄,然後其他人呢?所以說藍色的那個更薄,那麼紅色? – Gillardo