1. #1
    Sencha User
    Join Date
    Mar 2012
    Posts
    15
    Vote Rating
    0
    reis3k is on a distinguished road

      0  

    Default How to show Catagories in the legend instead of the name of the Store's data field

    Hi All,
    Default behavior of the Ext JS chart is a little strange: While Bar and Column charts shows the Store's data field's name e.g. data1, the Pie chart shows the values of Store's name field e.g. Jan, Feb...

    PHP Code:
        var store1 = new Ext.data.JsonStore({
        
    fields:['name''data1'],
        
    data: [
            {
    name:'Jan'data12000},{name:'Feb'data11800},
            {
    name:'Mar'data11500},{name:'Apr'data12150},
            {
    name:'May'data12210},{name:'Jun'data12250},
            {
    name:'Jul'data12370},{name:'Aug'data12500},
            {
    name:'Sep'data13000},{name:'Oct'data12580},
            {
    name:'Nov'data12100},{name:'Dec'data12650}
        ]}); 
    Is it possible to get a behavior like in Pie chart to the Bar and Column charts? I've been searching fro this nearly full 2 days, but couldn't come across anything.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    38,526
    Vote Rating
    1113
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default

    The legend isn't that configurable.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Mar 2012
    Posts
    15
    Vote Rating
    0
    reis3k is on a distinguished road

      0  

    Default

    Then I have to create my own legend. Can you post the code how to get the color of the bar/column. I tried to get it where I applied custom colors under renderer, but it returns duplicated values, not the exact amount of available data and color. I used Jquery to append the values into a div:

    PHP Code:
            series: [{
                
    type'bar',
                
    axis: ['bottom'],
                
    xField'name',
                
    yField'data1',
                
    label: {
                    
    display'insideEnd',
                    
    field'data1',
                    
    orientation'horizontal',
                    
    color'#333',
                   
    'text-anchor''middle',
                   
    contrasttrue
                
    },
                
    renderer: function(spriterecordattrindexstore) {
                    var 
    colorVal colors2[index colors2.length];
                    
    attr.fill colorVal;

                    
    //$("#legendDiv").append("Value: " +  record.get('name') + ", color: " + colorVal);
                    
    return attr;
                    
                }
            }]
        }); 
    Thanks

Thread Participants: 1

Tags for this Thread