Results 1 to 2 of 2

Thread: How to set custom colors and custom label for pie chart?

  1. #1

    Default How to set custom colors and custom label for pie chart?

    Hi,

    I try to set colors for series with this code:

    Code:
    series: [{
                        type: 'pie',
                        ...,
                        style: {
                            colors: [0xbcb8af, 0xe2dedb, 0xbcb8af, 0xe3dedb, 0xe2dddb, 0xe2deab]
                        }
    }]
    but it doesn't work.

    And how can I display the label with name of series + their value, for example:

    Code:
    label: {
                            field: 'name' + 'data1',
                            display: 'rotate',
                            contrast: true,
                            font: '18px Arial'
                        },
    thanks.

  2. #2
    Ext JS Premium Member
    Join Date
    Apr 2011
    Posts
    93

    Default

    Based on the docs, this is how I got it to work:

    Code:
    var baseColor = '#eee';
    
    Ext.define('Ext.chart.theme.Newthemename', {
            extend: 'Ext.chart.theme.Base',
            
            constructor: function(config) {
                this.callParent([Ext.apply({
                    axis: {
                        fill: baseColor,
                        stroke: baseColor
                    },
                    axisLabelLeft: {
                        fill: baseColor
                    },
                    axisLabelBottom: {
                        fill: baseColor
                    },
                    axisTitleLeft: {
                        fill: baseColor
                    },
                    axisTitleBottom: {
                        fill: baseColor
                    },
                    colors: ['#555',
                      '#666',
                      '#777',
                      '#888',
                      '#999',
                      '#000']
                }, config)]);
            }
        });
    then just set this in the pie chart object:
    Code:
    theme: 'Newthemename'

Similar Threads

  1. Custom Chart Axis
    By chrisbrianolsen in forum Ext:Bugs
    Replies: 2
    Last Post: 18 Jan 2012, 4:29 AM
  2. Custom label width
    By georgec in forum Sencha Touch 1.x: Discussion
    Replies: 4
    Last Post: 23 Nov 2010, 1:16 AM
  3. Problem creating a colorMenu with custom colors
    By Matt202 in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 2 Oct 2009, 3:16 AM
  4. Custom Colors with Colormenu! It should but it doesn't!
    By overnoise in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 20 Feb 2008, 4:57 PM
  5. [RESOLVED] How to add custom colors to ColorMenu
    By PTG in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 18 Dec 2007, 10:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •