如何将Protovis图表附加到特定的HTML标记?

tir*_*hen 3 html javascript charts protovis

我有一个id为"图表"的div标签但是如何让Protovis在该标签内呈现图表?

我尝试了canvas方法,但它没有用.

var vis = new pv.Panel().canvas("chart").width(width).height(height)
Run Code Online (Sandbox Code Playgroud)

作为我正在研究的框架的一部分,我需要保持我的JS代码对图表的影响,并且不能在HTML正文中包含脚本标记.

dan*_*ani 5

这绝对适用于最新版本的Protovis(3.2):

<div id="#chart-div"></div>

var vis = new pv.Panel().canvas('chart-div')
Run Code Online (Sandbox Code Playgroud)

确保它的根面板.

http://groups.google.com/group/protovis/browse_thread/thread/1ff9530cee6133ff