简体   繁体   中英

Set an existing column to tooltip in google visualization api?

Is it possible to set an existing column to be used as a html tooltip for a bar chart in google api without having to perform the following:

data.addColumn({type:'string',role:'tooltip'});

then adding the tooltip specific fields after converting the data to a datatable? Is there something like a:

data.setColumn(2, {type:'string',role:'tooltip'})

such that I dont have to adda new one? Does such a function exist?

My data is currently like this:

[
["Name", "Number", "Tooltip"],
["James", 1, "Tooltip for James"],
["Kyle", 2, "Tooltip for Kyle"]
]

使用DataTable#setColumnProperty方法设置角色:

data.setColumnProperty(2, 'role', 'tooltip');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM