PDA

View Full Version : Column chart not working



angraxs2
21 Aug 2012, 12:33 PM
Hi i have this code working on ST 2.0 + Chart 2.0B but its not showing any columsn with ST2.1 beta.



Ext.define('WapMobile.view.override.GraficoFatEvolFat', {
override: 'WapMobile.view.GraficoFatEvolFat',

config: {


id: 'fat-evolfat-grafico-tablet',
width: '100%',
items: [
{
xtype: 'chart',
store: 'FatEvolucaoFat',
shadow: true,
width: 800,
height: 600,
viewBox: true,
animate:
{
easing: 'bounceOut',
duration: 750
},

interactions:
[
{
type: 'reset'
},
{
type: 'panzoom',
axes:
{
bottom: {}
}
},
{
type: 'iteminfo',
gesture: 'taphold',
panel:
{
html: 'TESTE 123',
dockedItems:
[
{
dock: 'top',
xtype: 'toolbar',
title: 'Detalhes'
}
]
},

listeners:
{
show: function(me, item, panel)
{
panel.setHtml('<ul><li><b>Dia : </b> ' + item.value[0] + '</li><li><b>Valor : </b>' + item.value[1] + '</li></ul>');
}
}
}
],

legend:
{
position:
{
portrait: 'bottom',
landscape: 'bottom'
},
font: '20px Arial'
},

axes:
[
{
type: 'numeric',
position: 'left',
fields:['VALORFAT'],
//title: 'Faturamento',
minimum: 0
},
{
type: 'category',
position: 'bottom',
//title: 'Dia',
fields: ['EMISSAO']
}
],

series:
[
{
type: 'column',
xField: 'EMISSAO',
yField: 'VALORFAT',
axis: 'left'
/*highlight: true,
//showInLegend : true,
listeners:
{
'itemdoubletap': function()
{
console('OK!!!');
Ext.Msg.alert('OK!!');
}
}*/
}
]
}
]
}

});


I have to use the 2.1 beta because the Sencha Charts 2.0 beta does not have iteminfo interaction.

My chart does not display any columns, athough it does update the grids value whenI update the store, and if i double click anywhere the chart, i got this error on the browser´s log:

TypeError: 'undefine' is not an object (evaluating 'items.lenght') -> sencha-touch-all-debug.js:95210

Can someone please help me? Thanks in advance.


EDIT: I found out that iteminfo IS working. The interaction->taphold is that isn't working.

mitchellsimoens
23 Aug 2012, 4:32 AM
Things have changed a little bit. Look at the charts examples and notice the store config on the series.

angraxs2
23 Aug 2012, 4:22 PM
I will, thank you

angraxs2
24 Aug 2012, 5:27 AM
Hy Mitchel, i tried to lock into the examples folder, and there is no Charts there.

At the 2.1.0b2 docs thats all what i found:

series: [{

type: 'column', axis: 'left', listeners: { 'afterrender': function() { console('afterrender'); } }, xField: 'category', yField: 'data1'}]

And my code is exactly the same.

mitchellsimoens
24 Aug 2012, 5:32 AM
There isn't an example that is named charts, but there are examples in there that use charts. Like open up the kitchensink and tap on Graphics. Or open the stockapp.

2.1.0 b3 will have even more examples.

angraxs2
24 Aug 2012, 6:50 AM
Thanks for the help, Mitchel.

I found out that the problem wasnt really the store, but the style.
Now you have to specify the style of the series.

I Just added the style from the example and it worked. It is now displaying the columns.

I'm still getting the "TypeError: 'undefined' is not an object (evaluating 'items.length')" when i use the gesture tap on my iteminfo interaction, but that is another problem that I will have to deal later.

Thanks for the support.