【问题标题】:extjs chart->series change color dynamicallyextjs 图表-> 系列动态改变颜色
【发布时间】:2013-01-23 19:44:51
【问题描述】:

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

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

感谢

【问题讨论】:

    标签: extjs charts


    【解决方案1】:

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

    看到这张图片: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;
    
            }
        }]
    
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-06
      • 2023-03-21
      • 2014-11-30
      • 1970-01-01
      • 2018-12-31
      相关资源
      最近更新 更多