PDA

View Full Version : [FIXED] [4.0.7] Pie chart series draws incorrectly



nohuhu
9 Nov 2011, 6:02 AM
REQUIRED INFORMATION


Ext version tested:

Ext 4.0.7

Browser versions tested against:

Chrome 15
Firefox 7
Safari 5.1
IE8

DOCTYPE tested against:

HTML

Description:

Pie series is drawn incorrectly when first value is zero and last value is non-zero.

Steps to reproduce the problem:

Create Chart with Pie series
Load data with first value == 0 and last value !== 0

The result that was expected:

Correct drawing.

The result that occurs instead:

Incorrect drawing.

Test Case:




Ext.require([
'Ext.data.Store',
'Ext.chart.theme.Base',
'Ext.chart.series.Pie',
'Ext.chart.Chart',
]);


Ext.onReady(function () {
var store = Ext.create('Ext.data.Store', {
fields: [ 'name', 'data' ],
data: [
{ name: 'Field 0', data: 0 },
{ name: 'Field 1', data: 1 }
]
});

var panel = Ext.create('widget.panel', {
width: 450,
height: 400,
renderTo: Ext.getBody(),
layout: 'fit',
items: {
xtype: 'chart',
insetPadding: 5,
store: store,
theme: 'Base:gradients',
series: [{
type: 'pie',
field: 'data',
showInLegend: true,
label: {
display: 'rotate',
contrast: true
}
}]
}
});
});



HELPFUL INFORMATION


Screenshot or Video:

29174

Debugging already done:

none

Possible fix:

not provided

Additional CSS used:

only default ext-all.css

Operating System:

Mac OS X 10.6.8
WinXP Pro

mitchellsimoens
9 Nov 2011, 6:58 AM
Thank you for the report

oniseijin
15 Nov 2011, 4:16 AM
Saw this myself today; glad to see a good bug report on it.

nohuhu
15 Nov 2011, 4:29 AM
oniseijin,

My current workaround is to check for this condition and set first value to 0.0001. This results in somewhat ugly looking first section but at least the pie itself is drawn where it belongs.

Regards,
Alex.

pisi
15 Nov 2011, 6:54 AM
same error here, but i use a trick.
i put first as result from php first non 0 value.
ex.
"data": [{"status":"necunoscut","count":"0"},{"status":"down","count":"0"},{"status":"recuperare","count":"0"},{"status":"online","count":"10"}]

=>

"data": [{"status":"online","count":"25"},{"status":"down","count":"0"},{"status":"recuperare","count":"0"},{"status":"necunoscut","count":"0"}]

i do this, because i don't care the order of slices, just valu and color.

Geo

oniseijin
16 Nov 2011, 3:05 AM
nohuhu, good suggestion. I went with it... just has a little ugly line.

Hope a fix comes next release.

I can't change the order of it, or it will mess up the color (which is critical in my case); I suppose I could then re-order the color too, but that gets tedious.