Rally 使用2.0rc1设置拉力图的颜色

Rally 使用2.0rc1设置拉力图的颜色,rally,Rally,我有一个在2.0p5上运行得很好的应用程序。我能够设置图表中各个列的特定颜色。在图表配置中,我添加了 颜色:[ "89A54E",, "4572A7",, "AA4643" ], 当我升级到2.0rc1时,颜色似乎不再固定。我的图表配置是: Ext.create('Rally.ui.chart.Chart', { animate: true, chartData: { series: [{ type: 'co

我有一个在2.0p5上运行得很好的应用程序。我能够设置图表中各个列的特定颜色。在图表配置中,我添加了

颜色:[ "89A54E",, "4572A7",, "AA4643" ],

当我升级到2.0rc1时,颜色似乎不再固定。我的图表配置是:

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'
                    }
                }
            }
        }
    });
Ext.create('Rally.ui.chart.chart'{
动画:对,
图表数据:{
系列:[{
键入:“列”,
名称:“数据1”,
数据:数据1
},
{
键入:“列”,
名称:“数据2”,
数据:数据2
},
{
键入:“列”,
名称:'Data3',
数据:数据3
}],
类别:xAxisData
},
图表配置:{
图表:{
类型:“列”
},
标题:{
文本:“显示数据”
},
亚克斯:{
分:0,,
标题:{
文本:“yAxis信息”
},
堆叠标签:{
启用:对,
风格:{
fontWeight:'粗体',
颜色:“灰色”
}
}
},
图例:{
对齐:“右”,
x:-100,
垂直排列:“顶部”,
y:20,
浮动:是的,
背景颜色:“白色”,
边框颜色:“#CCC”,
边框宽度:1,
影子:错
},
工具提示:{
格式化程序:函数(){
返回“+this.x+”
+ this.series.name+':'+this.y+'
+ “总计:”+this.point.stackTotal; } }, 颜色:[ "89A54E",, "4572A7",, "AA4643" ], 打印选项:{ 专栏:{ 堆叠:“正常”, 数据标签:{ 启用:对, 颜色:“白色” } } } } });

你知道为什么我在2.0rc1中丢失了颜色设置功能吗?

我的一个应用程序的示例:

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
});

希望这对你有用

谢谢!你给了我一个主意。我将我的图表分配给一个变量(myChart),然后在其上调用SetChartColor。myChart.setChartColor(['89A54E'、'4572A7'、'AA4643']);成功了!