Showing posts with label condition. Show all posts
Showing posts with label condition. Show all posts

Tuesday, February 17, 2015

Tip Tree Map Example Display colors of groups based on condition








function f() {
    var colorScale;

    var cd = this.chartDefinition;
    cd.legend = false;

    cd.leaf_fillStyle = function(scene) {
        /*
        if(!colorScale) {
            colorScale = pv.ramp(red, blue);
           
            var extent = this.chart.data.dimensions(size).extent();
            if(extent)
                colorScale.domain(extent.min.value, extent.max.value);
        }
 */      
        // Is colorScale created ?
    if(!colorScale) {
        colorScale = pv.Scale.linear().range("red", "black", "blue","#708090");
   
        var extent = this.chart.data.dimensions(size).extent();
        if(extent) {
            var min  = extent.min.value;
            var b=500;
            var c=1000;
            var max = extent.max.value;

            //colorScale.domain(min, (min + max) / 2, max);
            colorScale.domain(min,b,c,max);
        }
        }
       
        var size = scene.getSize();
        return colorScale(size);
    };
}
Read more »