我有这个脚本 protovis :
<script type="text/javascript+protovis">
var w = 600;
var h = 600;
var img = new pv.Panel()
.width(w)
.height(h);
img.add(pv.Image)
.url("./icon/image.gif")
.title("image");
img.add(pv.Dot)
.data(data)
.left(function(d) d[0] * w)
.bottom(function(d) d[1] * h)
.size(function(d) d[2] * 100)
.fillStyle("rgba(30, 120, 180, .6)")
.strokeStyle("white");
img.render();
</script>
data1 在 Javascript 文件中声明:
var data = [[.1, .1, 1], [.2, .2, 2], [.3, .3, 3]];
当我测试我的图像有 3 个点时。但是,例如,如果我更改 Javascript 函数中的数据,然后用新数据重绘 protovis,我不知道该怎么做。就我而言,当用户单击菜单时,我会从数据库中接收新数据并更新数据。但是在我更改数据后,我需要重新绘制图像。
我想知道如何重新加载网页以便用新数据重新绘制图像。我正在考虑重新加载网页,在 POST 中传递数据并在绘制图像之前用 Javascript 检索数据。
但我不确定这个解决方案是否有效,以及它是否是最好的方法。