Highlighting the active category bars

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: 300,
        crosstabMode: false,
        axisGrid:  true,
        stacked:   true,
        hoverable: true,
        bar_fillStyle: function(scene) {
            var color = this.delegate();
            if(color) {
                var activeScene = scene.active();
                if(activeScene && 
                   scene.getCategory() === activeScene.getCategory()) {
                    color = color.brighter(1);
                }
            }
            return this.finished(color);
        }
    })
    .setData(relational_04)
    .render();
});