PDA

View Full Version : Issue with piechart



threethazz
23 Nov 2011, 5:57 AM
Hello,

I'm having an Error on chrome (IE doesnt mind it though) while opening a panel with a pie chart in it. The error comes from the legend: section.

Error: Invalid value for <rect> attribute height="NaN"
Error: Invalid value for <rect> attribute y="NaN"
Error: Invalid value for <rect> attribute height="NaN"


I've searched over the net and modified the code dozens of times and nothing works...

Even after I get this error messages, the pie works fine...

Can anyone help me? Thank you!



var pieChart = new Ext.chart.Chart({
animate: true,
store: pieStore,
shadow: true,
legend: {
position: 'right'
},
insetPadding: 50,
theme: 'Base:gradients',
series: [{
type: 'pie',
field: 'num_repetition',
showInLegend: true,
tips: {
trackMouse: true,
width: 170,
height: 40,
renderer: function(storeItem) {
//calculate percentage.
this.setTitle(storeItem.get('log_type_name') + ': ' + Math.round(storeItem.get('num_repetition') / total * 100) + '%' +'<br>occurrences: '+ storeItem.get('num_repetition'));
}
},
highlight: {
segment: {
margin: 20
}
},
label: {
field: 'log_type_name',
contrast: true,
font: '12px Arial'
}
}]
});




var panel1 = Ext.create('widget.panel', {
width: 800,
height: 800,
title: 'Requests',
layout: 'fit',
items: [pieChart]
});

panel1.render('render');


threethazz

mitchellsimoens
23 Nov 2011, 7:10 AM
What does your response look like?

threethazz
23 Nov 2011, 7:27 AM
I'm sorry, I forgot that part.

The data is loaded correctly, and it is also correctly displayed. It's only those 3 errors showing up in the Chrome console.



if (!Ext.ClassManager.isCreated('AdminStatistics')){
Ext.define('AdminStatistics',{
extend: 'Ext.data.Model',
fields: [
'log_type_id', 'log_type_name', 'company_id', 'num_repetition'
]
});
}

var pieStore = Ext.create('Ext.data.Store', {
model: 'AdminStatistics',
autoLoad: false,
proxy: {
// load using HTTP
type: 'ajax',
url: '/AdminStatistics/Statistics',
// the return will be XML, so lets set up a reader
reader: {
type: 'json',
root: 'list'
},
extraParams:{
company_id: ''
}
}
});

threethazz
25 Nov 2011, 2:28 AM
anyone?