如何在谷歌图表表格中隐藏列(how to hide column in google charts table)

其他开发 IT屋
百度翻译此文   有道翻译此文
问 题

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's values, but just hide the column so that it's not getting displayed?

Thanks in advance!

解决方案

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

本文地址:IT屋 » how to hide column in google charts table

问 题

我有 Google图表表格显示一些行和列。比如说我们有4列(分别是A,B,C,D)。我怎么能够加载列C的值,但只是隐藏列,以便它不显示?



预先感谢!


解决方案

不是绘制DataTable,而是必须在过滤原始数据的位置创建一个介于其间的DataView对象。就像这样:

  // dataResponse是你的A,B,C,D列的数据表
var view =新的google.visualization.DataView(dataResponse);
view.setColumns([0,1,3]); //在这里设置你想要显示的列

// Visualization Go draw!
visualizationPlot.draw(view,options);


hideColumns方法可能更好,而不是setColumns,请自己选择!



干杯


本文地址:IT屋 » 如何在谷歌图表表格中隐藏列

官方微信
扫一扫关注IT屋
微信公众号搜索 “ IT屋 ” ,选择关注
与百万开发者在一起