Saturday, April 23, 2011

Set Panel's Background Color

This is the sample code to fill our panel with color using fillStyle method. We can use following color format :
  • #rgb
  • #rrggbb
  • rgb(rvalue, gvalue, bvalue)
  • rgb(rvalue%, gvalue%, bvalue%)
  • hsl(rvalue%, gvalue%, bvalue%)
  • rgba(rvalue, gvalue, bvalue,alphavalue%)
  • hsla(value/value%,value/value%, value/value%, alphavalue%)

<div id="fig">
<script type="text/javascript+protovis">
/* The root panel. */
var vis = new pv.Panel()
.width(400)
.height(300)
.fillStyle("#ff0000"); // Fill the background with red
vis.render();
</script>
</div>

Output :


No comments:

Post a Comment