how to hide column in google charts table

前端 未结 5 659
梦如初夏
梦如初夏 2021-02-05 12:18

I\'ve got a Google Charts Table that displays a couple of columns and rows. Say for instance we have 4 columns(A,B,C,D respectively). How would I be able to still load column C\

5条回答
  •  灰色年华
    2021-02-05 12:45

    Instead of drawing the DataTable, you have to create an in-between DataView object where you filter the original data. Something like this:

    //dataResponse is your Datatable with A,B,C,D columns        
    var view = new google.visualization.DataView(dataResponse);
    view.setColumns([0,1,3]); //here you set the columns you want to display
    
    //Visualization Go draw!
    visualizationPlot.draw(view, options);
    

    The hideColumns method is maybe better instead of setColumns, choose yourself!

    Cheers

提交回复
热议问题