0

I would like to change color of chart in extjs type ='pie'. Can I use renderer in the series block please see the example:

.....    },
                series : [ {
                    type : 'bar',
                    axis : 'bottom',
                    gutter : 0,
                    groupGutter : 0,
                    yField : this.fields,
                    title : this.fieldTitles,
                    stacked : true,
                    fill: true,
                    scope: this,
                    renderer: function(sprite, record, attr, index, store) {
                        var color = this.fieldColors[index];
                        return Ext.apply(attr, {
                            fill: color
                        });
                    },.....
Vahe Akhsakhalyan
  • 2,140
  • 3
  • 24
  • 38

1 Answers1

0

Instead of a custom renderer, you can use the colorSet property for your series.

series: [{
    colorSet: this.fieldColors,
    ...
}]

See http://docs.sencha.com/extjs/4.2.1/#!/api/Ext.chart.series.Pie-cfg-colorSet

Towler
  • 1,552
  • 1
  • 10
  • 21