1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    4
    Vote Rating
    0
    UpWorks is on a distinguished road

      0  

    Default Unanswered: Error Parsing XML Data for Area Chart

    Unanswered: Error Parsing XML Data for Area Chart


    I am receiving the following parsing error. I know the javascript code works because I have swapped out the xml integration with a static JsonStore. Can you spot what I am doing wrong?
    Thank you in advance for any suggestions.
    PHP Code:
    ErrorProblem parsing d="L790,518.887301636L120,518.887301636Z" results-graph3.htm:1111
    Error
    Problem parsing d="Z" 
    The Xml File:
    PHP Code:
    <?xml version="1.0" encoding="utf-8"?>
    <fundGrowthData>
        <growthData>
            <Year>1991</Year>
            <asOfDate>December 31, 1991</asOfDate>
            <Dividends>10000</Dividends>
            <Distribution>10000</Distribution>
        </growthData>
        <growthData>
            <Year>1992</Year>
            <asOfDate>December 31, 1992</asOfDate>
            <Dividends>10655</Dividends>
            <Distribution>10740</Distribution>
        </growthData>
        <growthData>
            <Year>1993</Year>
            <asOfDate>December 31, 1993</asOfDate>
            <Dividends>12146</Dividends>
            <Distribution>12297</Distribution>
        </growthData>
    </fundGrowthData>

    The Javascript
    PHP Code:
    var store Ext.create('Ext.data.Store',{
        
    autoLoadtrue,
        
    fields: ['Year','Dividends','Distribution'],
        
    proxy: {
            
    type'ajax',
            
    url'pathtoXML',
            
    reader: {
                
    type'xml',
                
    record'growthData'
            
    }
        }
    });

    Ext.onReady(function () {

        
    Ext.create('Ext.chart.Chart', {
            
    renderToExt.get("js-chart"),
            
    width800,
            
    height600,
            
    storestore,
            
    axes: [
                {
                    
    type'Numeric',
                    
    gridtrue,
                    
    position'left',
                    
    fields: ['Dividends''Distribution'],
                    
    title'Sample Values',
                    
    grid: {
                        
    odd: {
                            
    opacity1,
                            
    fill'#ddd',
                            
    stroke'#bbb',
                            
    'stroke-width'1
                        
    }
                    },
                    
    minimum0,
                    
    adjustMinimumByMajorUnit0
                
    },
                {
                    
    type'Category',
                    
    position'bottom',
                    
    fields: ['Year'],
                    
    title'Sample Metrics',
                    
    gridtrue,
                    
    label: {
                        
    rotate: {
                            
    degrees315
                        
    }
                    }
                }
            ],
            
    series: [{
                
    type'area',
                
    highlighttrue,
                
    axis'left',
                
    xField'Year',
                
    yField: ['Dividends''Distribution'],
                
    style: {
                    
    opacity0.93
                
    }
            }]
        });

    }); 

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,664
    Answers
    434
    Vote Rating
    586
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Moving to the appropriate forums.

    Since all XML data is a string, you'll probably want to specify the field type so they get converted to numbers: http://docs.sencha.com/ext-js/4-1/#!...Field-cfg-type
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    4
    Vote Rating
    0
    UpWorks is on a distinguished road

      0  

    Default


    Changed to this:
    PHP Code:
    var store Ext.create('Ext.data.Store',{    
      
    autoLoadtrue,    
      
    fields: [        
        {
    name "Year"type"int"},        
        {
    name "Dividends"type"int"},        
        {
    name "Distribution"type"int"}        
      ],    
      
    proxy: {        
        
    type'ajax',        
        
    url'pathToXml',       
        
    reader: {            
            
    type'xml',           
            
    record'growthData'       
     
    }    
    }
    }
    ); 
    No parsing error however there is still no data in the chart

  4. #4
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,664
    Answers
    434
    Vote Rating
    586
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Your data isn't valid for an area chart, look at the data inside the store in the example, compare it to what you have.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  5. #5
    Sencha User
    Join Date
    Nov 2011
    Posts
    4
    Vote Rating
    0
    UpWorks is on a distinguished road

      0  

    Default


    Quote Originally Posted by evant View Post
    Your data isn't valid for an area chart, look at the data inside the store in the example, compare it to what you have.
    The same data in a JsonStore works:
    PHP Code:
    var store Ext.create('Ext.data.JsonStore', {    
    fields: ['Year','Dividends','Distribution'],    
    data: [       
     { 
    "Year""1991""Dividends":10000"Distribution":10000 },       
     { 
    "Year""1992""Dividends":10655"Distribution":10740 },       
     { 
    "Year""1993""Dividends":12146"Distribution":12297 },        
     { 
    "Year""1994""Dividends":12071"Distribution":12300 },       
     { 
    "Year""1995""Dividends":15528"Distribution":15965 },        
     { 
    "Year""1996""Dividends":17721"Distribution":18334 },       
     { 
    "Year""1997""Dividends":22338"Distribution":23258 },       
     { 
    "Year""1998""Dividends":29328"Distribution":30649 },       
     { 
    "Year""1999""Dividends":42667"Distribution":44656 },        
     { 
    "Year""2000""Dividends":45649"Distribution":47999 },        
     { 
    "Year""2001""Dividends":39968"Distribution":42107 },        
     { 
    "Year""2002""Dividends":31135"Distribution":32834 },       
     { 
    "Year""2003""Dividends":41367"Distribution":43636 },        
     { 
    "Year""2004""Dividends":46154"Distribution":48851 },       
     { 
    "Year""2005""Dividends":52400"Distribution":55801 },       
     { 
    "Year""2006""Dividends":57672"Distribution":61907 },        
     { 
    "Year""2007""Dividends":63346"Distribution":68687 },       
     { 
    "Year""2008""Dividends":38145"Distribution":41850 },       
     { 
    "Year""2009""Dividends":50904"Distribution":56281 },       
     { 
    "Year""2010""Dividends":56696"Distribution":63192 },       
     { 
    "Year""2011""Dividends":53511"Distribution":60101 }   
     ]}); 

  6. #6
    Sencha User
    Join Date
    Nov 2011
    Posts
    4
    Vote Rating
    0
    UpWorks is on a distinguished road

      0  

    Default


    Quote Originally Posted by evant View Post
    Your data isn't valid for an area chart, look at the data inside the store in the example, compare it to what you have.
    You are correct, the data is not aggregated, meaning the data is not stacked. Each data start point should start at 10000 but Dividends is stack on top of the graph so it looks like Distributions started at 20000.

    I am not clear on what is going on and or wrong here. Thank you in advance for any suggestions.

Thread Participants: 1

Tags for this Thread