简体   繁体   English

extjs chart-> series动态更改颜色

[英]extjs chart->series change color dynamically

How can dynamically change a chart.series.color? 如何动态更改chart.series.color?

I sthere any way to change a color for "ONE" bar to draw attention? 我想通过任何方式更改“ ONE”栏的颜色来引起注意吗?

thanx 谢谢

I use this code, but the gradient is seen in the back not in all the bar: 我使用此代码,但并非在所有栏中都看到了渐变:

see this image: chart image 看到这张图片: 图表图片

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;

        }
    }]

});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM