我想顯示一個圖表與2軸Y軸,但我總是得到一個圖表與1 Y軸。我正在閱讀不同的解決方案,但沒有工作......我認爲問題是我有一個JSON數據表。這個數據的格式是:多個Y軸谷歌與Json數據圖表
{"cols":[{"label":null,"type":"number"},{"label":"I rated max","type":"number"},{"label":"Rdc max","type":"number"}],"rows":[{"c":[{"v":1},{"v":0.5},{"v":0.32}]},{"c":[{"v":1.5},{"v":0.63},{"v":0.76}]},...
我試着用vAxes選項,但它沒有工作......一些想法?
謝謝!
編輯:我完整的代碼是這樣的:
// Load the Visualization API and the piechart package.
google.load('visualization', '1', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
function drawChart() {
// Create our data table out of JSON data loaded from server.
var data = new google.visualization.DataTable(<?=$jsonTable?>);
var options = {
title: 'I/R-L chart',
hAxis: {title: 'L value [µH]', titleTextStyle: {color: 'red'} },
//vAxis: {
// title: "I rated max/ Rdc max",
// maxValue:1.5
//},
vAxes: { 0: {logScale: false}, 1: {logScale: false}},
series:{
0:{targetAxisIndex:0},
1:{targetAxisIndex:0}},
pointSize:8
}
// Instantiate and draw our chart, passing in some options.
// Do not forget to check your div ID
var chart = new google.visualization.ScatterChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
這是不太可能的數據表是你的問題。我需要看到你的整個圖表代碼,以幫助你弄清楚這一點。 – asgallant
我編輯了我的帖子並添加了代碼。我嘗試使用vAxes但不起作用,它只顯示一個軸(左側) – Mastor