Bar Chart with plot background image

by duarteleao

HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.19/require.min.js"></script>
<script src="//webdetails.github.io/ccc/charts/lib/amd/require.config.js"></script>
<script src="//webdetails.github.io/ccc/charts/lib/q01-01.js"></script>
<div id="cccExample" />

JavaScript

require([
  "ccc/pvc", 
  "ccc/def", 
  "ccc/protovis"
], function(pvc, def, pv) {

    new pvc.BarChart({
        canvas: "cccExample",
        width:  400,
        height: 400,    
        title: "Bar Chart with plot background image",
        animate:    false,
        selectable: true,
        hoverable:  true,
        legend:     true,
        extensionPoints: {
            plotBg_add: function() {
                return new pv.Image()
                    .width(300).height(300) // comment for "stretch" effect
                    .fillStyle("#def")
                    .url("http://vis.stanford.edu/protovis/ex/stanford.png");
            }
        }
    })
    .setData(relational_01, { crosstabMode: false })
    .render();
});