0

如何动态更改chart.series.color?

我有什么方法可以改变“ONE”栏的颜色以引起注意?

谢谢

4

1 回答 1

0

我使用这段代码,但渐变在后面看到,而不是在所有栏中:

看这张图片:图表图片

var enroll = Ext.create('Ext.chart.Chart', {
    width: 430,        
    height: 250,
    xtype: 'chart',
    renderTo: 'O20_id-body',
    store: store1,
    axes: [{
        type: 'Numeric',
        position: 'left',
        fields: ['data1'],
        label: {
            renderer: Ext.util.Format.numberRenderer('0,0')
        },
        title: 'Number of Hits',
        grid: true,
        minimum: 0
    }, {
        type: 'Category',
        position: 'bottom',
        fields: ['data1'],
        title: 'Month of the Year'
    }], 
    gradients: [{
    id: 'redGradient',
    angle: 45,
    stops: {
        0: {
            color: '#FF0000'
        },
        100: {
            color: '#F0F0F0'
        }
    }
  }],        
    series: [{
        type: 'column',
        axis: 'bottom',
        highlight: true,
        xField: 'name',
        yField: 'data1',
        renderer: function(sprite, record, attr, index, store) {
                     //draw diffrent color                                         
                     sprite.setAttributes({fill: 'url(#redGradient)'}, true);
                     return attr;

        }
    }]

});
于 2013-01-24T07:54:59.413 回答