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

查看:431
本文介绍了如何在谷歌图表表格中隐藏列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

预先感谢!

推荐答案

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

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);

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

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

干杯

这篇关于如何在谷歌图表表格中隐藏列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆