amcolosk
amcolosk

Reputation: 210

Setting Colors for Rally Chart with 2.0rc1

I have an app that worked great for 2.0p5. I was able to set the various columns in the chart specific colors. In the chart config, I added

colors: [ '#89A54E', '#4572A7', '#AA4643' ],

When I upgraded to 2.0rc1, the colors no longer seem to get set. My chart config is:

Ext.create('Rally.ui.chart.Chart', {
        animate: true,
        chartData: {
            series: [{
                type: 'column',
                name: 'Data1',
                data: data1
            },
            {
                type: 'column',
                name: 'Data2',
                data: data2
            },
            {
                type: 'column',
                name: 'Data3',
                data: data3
            }],
            categories: xAxisData
        },
        chartConfig: {
            chart: {
                type: 'column'
            },
            title: {
                text: 'Show Data'
            },
            yAxis: {
                min: 0,
                title: {
                    text: 'yAxis Info'
                },
                stackLabels: {
                    enabled: true,
                    style: {
                        fontWeight: 'bold',
                        color: 'gray'
                    }
                }
            },
            legend: {
                align: 'right',
                x: -100,
                verticalAlign: 'top',
                y: 20,
                floating: true,
                backgroundColor: 'white',
                borderColor: '#CCC',
                borderWidth: 1,
                shadow: false
            },
            tooltip: {
                formatter: function() {
                    return '<b>'+ this.x +'</b><br/>'+
                        this.series.name +': '+ this.y +'<br/>'+
                        'Total: '+ this.point.stackTotal;
                }
            },
            colors: [
               '#89A54E',
               '#4572A7', 
               '#AA4643'
            ],
            plotOptions: {
                column: {
                    stacking: 'normal',
                    dataLabels: {
                        enabled: true,
                        color: 'white'
                    }
                }
            }
        }
    });

Any ideas why I lost my color setting capabilities in 2.0rc1?

Upvotes: 0

Views: 348

Answers (1)

Tore
Tore

Reputation: 1264

An example from one of my apps:

var series    = [{
    name         : 'Col 1',
    data         : [],
    showInLegend : false
},{
    name         : 'Col 2',
    data         : [],
    showInLegend : false
},{
    name         : 'Col 3',
    data         : [],
    showInLegend : false
}];
Ext.Array.each(records, function(record) {
    //HighCharts Data
    record.set('name', ...);
    record.set('y', ...);
    record.set('color', ...);

    //Add record to series
    series[index].data.push(record.data);
    // Add to chartData
});

Hope this helps/works for you!

Upvotes: 1

Related Questions