1. #1
    Sencha User
    Join Date
    Aug 2012
    Posts
    7
    Vote Rating
    0
    GUPTA.221 is on a distinguished road

      0  

    Default Unanswered: Uncaught SyntaxError: Unexpected identifier

    Unanswered: Uncaught SyntaxError: Unexpected identifier


    Hello Colleagues,

    I am trying to integrate sencha touch2 with Charts 2.0 library to display a simple bar chart which fetches the Data from SAP Odata. However it returns an error "Uncaught SyntaxError: Unexpected identifier"

    When I try to display the data in the form of Grid, it works fine which means that store fetches the data properly. It seems there is some problem in displaying a bar chart itself.

    I have created a view as shown below and triggering same from app.js..

    Ext.define('MyApp.view.BarChart', {


    extend: 'Ext.chart.Panel',


    requires: ['Ext.chart.series.Series', 'Ext.chart.Panel', 'Ext.chart.Chart',
    'Ext.chart.axis.Numeric', 'Ext.chart.axis.Category','Ext.chart.series.Area', 'Ext.chart.theme.Base', 'Ext.chart.theme.Style'],


    var chartPanel = Ext.create('Ext.chart.Panel', {
    layout: 'auto',
    renderTo: Ext.get('BarChart'),
    // themeCls: 'bar1',
    theme: 'Demo',
    animate: true,
    shadow: false,
    items: [{
    // id:'BarChart',
    store:'Orders',
    xtype:'Charts',
    /* legend: {
    position: {
    portrait: 'bottom',
    landscape: 'right'
    },
    labelFont: '17px Arial'
    },*/
    axes: [
    {
    type: 'NumericAxis',
    position: 'bottom',
    fields: ['TotalNetAmount_E'],
    label: {
    renderer: function (v) {
    return v.toFixed(0);
    }
    },
    title: 'Total Net Amount',
    minimum: 0
    },
    {
    type: 'CategoryAxis',
    position: 'left',
    fields: ['SalesOrder'],
    title: 'Sales Orders'
    }
    ],
    series: [
    {
    type: 'bar',
    xField: 'SalesOrder',
    yField: ['TotalNetAmount_E'],
    axis: 'bottom',
    highlight: true,
    showInLegend: true
    }
    ]
    }];
    });
    });

    Any help would be very much grateful...

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,611
    Answers
    543
    Vote Rating
    326
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    You seem to be creating a chart instance in the middle of your class definition. It's totally invalid JavaScript.

  3. #3
    Sencha User
    Join Date
    Aug 2012
    Posts
    7
    Vote Rating
    0
    GUPTA.221 is on a distinguished road

      0  

    Default


    Oh..my blunder I would say. Do you have any sample code which I can use to create a bar chart or so as per the application mentioned above?

Thread Participants: 1