Friday, December 3, 2010

Protovis: Placing the Visualizations

If you want to place the visualization inside a div or any other container, there are two ways to do it(or at least I know two ways), but only one always work.

The first is to place the script tags where you build and render the visualization inside the div
tags, something like this:

<div>
    <script>
        ...
        vis.render();
    </script>
</div>

The other way, an this always work is to specify where it will be shown, something like this:

<script>
    ...
    var vis = new pv.Panel()
        .canvas($("vocabulary_chart"))
    ....
</script>

So It will be shown inside the div you specified.

Hope this helps you.

No comments:

Post a Comment