1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    Mumbai, India
    Posts
    119
    Vote Rating
    4
    Answers
    11
    Sasha172 is on a distinguished road

      0  

    Default Answered: Touch Charts Y-Axis showing 0 for all values

    Answered: Touch Charts Y-Axis showing 0 for all values


    Hi,
    So I have a Sencha Touch Area Chart that I'm using. The chart uses data that it collects from a json file.
    As of now, the chart displays correctly. But all the values in the Y-axis show up as 0.00
    Im using the code from the EnergyApp example in touch charts.
    What am I doing wrong ?? I know that values are going into the chart.

    Here's the code for the chart :

    Code:
    var areaChartProd = new Ext.chart.Chart({
        id: 'prodArea',
        title: 'prodAreas',
        iconCls: 'area',
        cls: 'chartpanel',
        theme: 'Energy',
        interactions: ['reset', {
            type: 'panzoom',
            axes: {
                right: {}
            }
        },
        {
            type: 'iteminfo',
            gesture: 'tap',
            listeners: {
                show: function(interaction, item, panel) {
                    EnergyApp.popup(item, panel);
                }
            }
        }],
        animate: false,
        store: EnergyApp.stores.ChartStore, 
        axes: [{
            type: 'Numeric',
            position: 'right',
            minimum: 0,
            majorTickSteps : 10,
            minorTickSteps : 5,
            label: {
                renderer: EnergyApp.commify
            },
            //adjustMinimumByMajorUnit: 0,
            fields: [….],
            title: 'Kilo Watts'
        },
        {
            type: 'Category',
            position: 'bottom',
            fields: ['day'],
            title: 'Day',
            label: {
                rotate: {
                    degrees: 45
                }
            }
        }],
        legend: {
            position: Ext.is.Phone ? 'left' : 'top'
        },
        series: [{
            type: 'area',
            highlight: false,
            title: […..],
            axis: 'right',
            xField: 'day',
            yField: [….]
        }],
        listeners: {
            afterrender: function(me) {
                me.on('beforerefresh', function() {
                    if (me.ownerCt.getActiveItem().id !== me.id) {
                        return false;
                    }
                }, me);
            }
        }
    });

  2. Ok I figured it out and got it working.

    The part of the example code that says

    Code:
    label: {
                renderer: EnergyApp.commify
            },
    doesnt work at all. Basically, Im not sure whether the values I'm passing are too small or what else the problem could be, but the .commify function is returning 0.00 for all the data i pass to it.

    I just commented out that part of code… and Voilá everything falls into place and works great

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,525
    Vote Rating
    871
    Answers
    3564
    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


    Not enough to help. If you just changed the example then it should be no problem.

    Also, why are you adding a listener in the afterrender event? Can you just have the beforerefresh event listener outside like you have the afterrender event?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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.

  4. #3
    Sencha User
    Join Date
    Aug 2011
    Location
    Mumbai, India
    Posts
    119
    Vote Rating
    4
    Answers
    11
    Sasha172 is on a distinguished road

      0  

    Default


    Ok I figured it out and got it working.

    The part of the example code that says

    Code:
    label: {
                renderer: EnergyApp.commify
            },
    doesnt work at all. Basically, Im not sure whether the values I'm passing are too small or what else the problem could be, but the .commify function is returning 0.00 for all the data i pass to it.

    I just commented out that part of code… and Voilá everything falls into place and works great