Search code examples
extjs4pie-chart

Why do 'Unexpected value NaN parsing y attribute.' warning is displayed while drawing pie chart using ExtJS?


I am trying to draw an pie chart using ExtJS but something is going wrong. I can see following warnings in firebug window :

Unexpected value NaN parsing y attribute.
Unexpected value NaN parsing height attribute.

Code for my pie chart is as follows :

xtype: 'chart',
title: 'Location wise candidate distribution',
itemId: 'CandidateDistributionChart',
store: 'CandidateDistribution',
width: 250,
height: 260,
shadow: true,
animate: true,
theme: 'Base:gradients',
legend: {
    position: 'right'
},
series: [{
    type: 'pie',
    field: 'candidateCount',
    showInLegend: true,
    label: {
        field: 'name',
        contrast: true,
        font: '18px Arial'
    }
}]

Why do those warnings are coming? Currently chart is not getting drawn even though I have mentioned all the necessary values.

Please help...


Solution

  • You used a string to define the store, but it needs a store object. 2 solutions :

    1) store: Ext.getCmp('CandidateDistribution'),

    Or 2) Define the store into a variable this way chartStore = Ext.create('Ext.data.Store', { ... }); and then pass it to the chart config : store: chartStore

    But maybe it's not the problem according to the errors... Can you post the code of your store, your model, and the container of your chart ?