1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    9
    Vote Rating
    0
    kpython is on a distinguished road

      0  

    Default Unanswered: Bar chart on Sencha 2.1

    Unanswered: Bar chart on Sencha 2.1


    Hi everybody,

    I'm working on the latest version of Sencha Touch 2.1 (GPLv3) and i'm trying to draw a bar chart like in this example : http://dev.sencha.com/deploy/touch-c.../examples/Bar/. Unfortunately I met several problems..

    First, i'm trying to write a label on the top of the bar which represent the y-value of the bar like this:
    Capture d’écran 2012-12-28 à 22.28.02.png
    I saw on lots of post how to do this with a label definition (label :{ …}) but nothing is showing up.
    (See the code a the end)

    Second, I have two different series on the same chart. I saw on the example that when we click on the legend to disable a series the other is automatically resized and centered. This is not the case in my chart:
    Capture d’écran 2012-12-28 à 22.30.52.jpg

    Third, I don't know how to set a color for 2th series.

    Here is my code:
    Code:
    Ext.define("iSmart.view.Year", {    requires: [
            'Ext.chart.label.Label',
            'Ext.util.Format'
        ],
        extend: 'Ext.Panel',
        xtype: 'yearView',
        alias: "widget.year",
    
    
        
        config: {
            layout: 'fit',
            //iconCls: 'time',
            title: 'Jahr',
            animate: true,
            items: [{
                xtype: 'toolbar',
                docked: "top",
                items: [{
                    xtype: 'label',
                    html: 'Total'
                },{
                    xtype: 'spacer'
                },{
                    xtype: 'label',
                    html: '2012'
                },{
                    xtype: 'spacer'
                }]
            },{
                xtype: 'chart',
                store: {
                    fields: ['month','energy','oldEnergy'],
                    data: [
                        { month: 'Jan', energy: 3424, oldEnergy: 3432},
                        { month: 'Feb', energy: 2523, oldEnergy: 3432},
                        { month: 'Mär', energy: 1140, oldEnergy: 3432},
                        { month: 'Apr', energy: 2344, oldEnergy: 3432},
                        { month: 'Mai', energy: 5450, oldEnergy: 3432},
                        { month: 'Jun', energy: 6045, oldEnergy: 3432},
                        { month: 'Jul', energy: 2344, oldEnergy: 3432},
                        { month: 'Aug', energy: 1345, oldEnergy: 3432},
                        { month: 'Sep', energy: 5425, oldEnergy: 3432},
                        { month: 'Okt', energy: 3333, oldEnergy: 3432},
                        { month: 'Nov', energy: 5423, oldEnergy: 3432},
                        { month: 'Dez', energy: 4545, oldEnergy: 3432}
                    ]
                },
                
                legend: {
                    position: 'top'
                },
                axes: [{
                    // y-axsis
                    type: 'numeric',
                    minimum: '0',
                    fields: ['energy','oldEnergy'],
                    position: 'left',
                    grid: true,
                    title: 'Energie [kWh]'
                }, 
                {
                    // x-axis
                    type: 'category',
                    fields: ['month'],
                    position: 'bottom'
                }],
                series: [{
                    type: 'bar',
                    xField: 'month',
                    yField: ['energy','oldEnergy'],
                    style: {
                        fillStyle: '#086fb2'
                    },
                    stacked: false,
                    label: {
                        display: 'insideEnd', 
                        field: 'energy',
                           orientation: 'horizontal', // 'vertical'
                        color: '#333',
                        'text-anchor': 'middle',
                    }
                }]
            }]
        }
    });
    Is the problem in my code or in this release of sencha touch charts ?
    Thanks for your help guys !
    Attached Images

  2. #2
    Sencha Premium Member
    Join Date
    Aug 2012
    Posts
    3
    Vote Rating
    0
    adrian.badea is on a distinguished road

      0  

    Default


    You'll need to set the labelField in the series config: http://docs.sencha.com/touch/2-1/#!/...art.series.Bar.

    Also, the label config has changed in 2.1: http://docs.sencha.com/touch/2-1/#!/...rt.label.Label

  3. #3
    Sencha User
    Join Date
    Dec 2012
    Posts
    9
    Vote Rating
    0
    kpython is on a distinguished road

      0  

    Default


    Thank you for your response, but I had to open a new thread for a similar problem with these labels :
    http://www.sencha.com/forum/showthread.php?254649


    M
    aybe your could help me on this new thread, I didn't found the response yet.

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."