PDA

View Full Version : [Question] Problem when attempting to show only one data in a chart



ultrakyo
31 Jan 2012, 5:57 PM
Hi, all.

I have a chart as below:


{
id: 'chartModule',
xtype: 'chart',
animate:
{
listeners: {
afteranimate: function() {
// Execute my custom method after the animation
//Ext.getCmp('testThis').doLayout();
//chartpan.doLayout();
Ext.getCmp('chartModule').animate = false;
},
scope: this
}
},
shadow: false,
insetPadding: 20,
store: storeModule,
axes: [
{
type: 'Category',
fields: [
'name'
],
label:
{
renderer: DateConverter
},
position: 'bottom'
},
{
type: 'Numeric',
fields: [
'total'
],
title: '(count)',
label:
{
renderer: customFormat//Ext.util.Format.numberRenderer('0,0');
},
position: 'left',
grid:true
}
],
series: [{
type: 'column',
highlight: {
size: 7,
radius: 7
},
axis: 'left',
xField: 'name',
yField: 'total',
style:{
fill:'#A3041D',
stroke:'#A3041D',
'stroke-width': 3
},
markerConfig: {
type: 'circle',
size: 4,
radius: 4,
fill:'#ffffff',
stroke:'#A3041D',
'stroke-width': 2
},
tips: Ext.getCmp('moduleToolTip')
}]// end series
}

The chart displays nicely if storeModule has more than 2 datas,

but problem occurs if only one data exists like below:

var storeModule = Ext.create('Ext.data.JsonStore', {
fields: ['name', 'total'],
data: [
{ 'name': '2011-12-28', 'total': 50}
]
});

I get the following error msg in console window:
Error: Invalid value for <rect> attribute height="Infinity"
index.html:1 (file:///D:/CCR_ExtJs/CCR/WebContent/index.html)Error: Invalid value for <rect> attribute y="-Infinity"




Any ideas would be appreciated. Thanks!

mitchellsimoens
1 Feb 2012, 6:53 AM
Does the chart display still?

ultrakyo
1 Feb 2012, 4:58 PM
Only the Y-axis is displayed with empty chart area.
I guess it's because it fails to render.
As I mentioned ExtJs charts only display well with from higher or equals to two data sets.
Any ideas...?

mitchellsimoens
2 Feb 2012, 5:49 AM
Only the Y-axis is displayed with empty chart area.
I guess it's because it fails to render.
As I mentioned ExtJs charts only display well with from higher or equals to two data sets.
Any ideas...?

It can render with only one... I have it working in an app.

ultrakyo
2 Feb 2012, 4:13 PM
Can you see any problems in my code?
Could you show me your working code please?

ultrakyo
2 Feb 2012, 5:32 PM
In addition, I'm using ExtJs 4.

itisjoke
27 Aug 2012, 11:50 PM
look at these thread, maybe it helps you
http://www.sencha.com/forum/showthread.php?159196-getting-error-as-Error-Invalid-value-for-lt-rect-gt-attribute-y-quot-Infinity-quot-on-chart&p=878711