Results 1 to 3 of 3

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

  1. #1
    Sencha User
    Join Date
    Aug 2011
    Location
    Mumbai, India
    Posts
    120
    Answers
    11
    Vote Rating
    4
      0  

    Default 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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,553
    Answers
    3931
    Vote Rating
    1272
      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 @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Aug 2011
    Location
    Mumbai, India
    Posts
    120
    Answers
    11
    Vote Rating
    4
      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

Tags for this Thread

Posting Permissions

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