在谷歌图表上放置值
如何在“google.visualization”图表上放置值?
请参阅附图。
var options = {
width: 1024, height: 240,
title: 'Clicks from Welcome email',
vAxis: {title: 'email Clicks', titleTextStyle: {color: 'black'}}
};
这是解决方案
data.addColumn({type:'number', role:'annotation'});
在谷歌图表中,它都是关于图层的,所以我添加了这个图层, 请注意该类型与 rowData 中的类型相同
var data = new google.visualization.DataTable();
data.addColumn('字符串', '日期'); data.addColumn('数字', '删除'); data.addColumn({type:'number', role:'annotation'}); // 注释角色 col. data.addColumn('数字', '添加'); data.addColumn({type:'number', role:'annotation'}); // 注释角色 col. data.addRows([]);
How can i place values on the 'google.visualization' graph ?
please see image attached.
var options = {
width: 1024, height: 240,
title: 'Clicks from Welcome email',
vAxis: {title: 'email Clicks', titleTextStyle: {color: 'black'}}
};
this is the solution
data.addColumn({type:'number', role:'annotation'});
in the google graph its all about layers, so i added this layer,
watch out that the type is the same type as in your rowData
var data = new google.visualization.DataTable();
data.addColumn('string', 'date');
data.addColumn('number', 'Remove');
data.addColumn({type:'number', role:'annotation'}); // annotation role col.
data.addColumn('number', 'Add');
data.addColumn({type:'number', role:'annotation'}); // annotation role col.
data.addRows([]);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最近使用 DataTable 角色向 gviz 引入了此类功能:您可以使用数据表中的额外信息列来创建注释和其他类型的功能。
请参阅此处的第一个示例,了解我认为您想要的内容的指南:
http://code.google.com/apis/chart/interactive /docs/roles.html#whatrolesavailable
This type of functionality was recently introduced to gviz using DataTable roles: you can use extra columns of information in your datatable to create annotations and other types of functionality.
See the first example here for a guide to what I think you want:
http://code.google.com/apis/chart/interactive/docs/roles.html#whatrolesavailable
调用图表 API 时,您必须设置数据,如下所示:
然后使用上面的代码设置选项并绘制图表:
这一切都在详细的 文档
You will have to set your data when calling the Chart API, like this:
Then set your options with your code above and draw the chart:
It's all explained in the extensive documentation