2014-02-14 117 views
0

在這裏,我創建儀表盤http://jsbin.com/OJAnaji/27/edit(GOOGL可視化):谷歌可視化的ColumnChart數據

data = google.visualization.arrayToDataTable([ 
     ['Name', 'Gender', 'Age', 'Donuts eaten'], 
     ['Michael' , 'Male', 12, 5], 
     ['Elisa', 'Female', 20, 7], 
     ['Robert', 'Male', 7, 3], 
     ['John', 'Male', 54, 2], 
     ['Jessica', 'Female', 22, 6], 
     ['Aaron', 'Male', 3, 1], 
     ['Margareth', 'Female', 42, 8], 
     ['Miranda', 'Female', 33, 6] 
    ]); 

和除的ColumnChart becouse那裏我得到的一切工作正常誤差: 所有在給定軸系列絕具有相同的數據類型的×

的ColumnChart代碼:

var wrapper = new google.visualization.ChartWrapper({ 
    chartType: 'ColumnChart', 
    containerId: 'chart3' 
    }); 

和借鑑作用:

// Create a dashboard 
    new google.visualization.Dashboard(document.getElementById('dashboard')). 
    // Establish bindings, declaring the both the slider and the category 
    // picker will drive both charts. 
    bind([slider, categoryPicker, stringFilter], [pie, table, wrapper]). 
    // Draw the entire dashboard. 
    draw(data, {'allowHtml':true, 'cssClassNames': 'cssClassNames'});  
} 
google.load('visualization', '1', {packages:['controls'], callback: drawVisualization}); 

和HTML:

  <div class="col-md-4" style="float: left;" id="chart3"></div> 

有什麼辦法,我展示(過濾器數據)等對Y軸列「名稱」和X軸「年齡」或Y軸上的「名稱」列和X軸上的「甜甜圈吃掉」?

UPDATE:我試試這個:

'觀看':{ '列':[0,3]}

,但沒有happend

回答

0

你指定的視圖包裝器?

var wrapper = new google.visualization.ChartWrapper({ 
    chartType: 'ColumnChart', 
    containerId: 'chart3', 
    view: { 
     columns: [0,3] 
    } 
}); 

順便說一句,傳遞第二個參數來調用Dashboad#draw不會做任何事情 - 它不接受任何選項:

new google.visualization.Dashboard(document.getElementById('dashboard')). 
// Establish bindings, declaring the both the slider and the category 
// picker will drive both charts. 
bind([slider, categoryPicker, stringFilter], [pie, table, wrapper]). 
// Draw the entire dashboard. 
draw(data); 

那些應改爲在適當的options參數傳遞ChartWrapper(可能是指定選項的Table的包裝)。