PDA

View Full Version : [CLOSED] Line serie is not reused after show/hide in legend



fabio.parra
6 Aug 2013, 8:55 AM
REQUIRED INFORMATION

Ext version tested:

Ext 4.2.0.663

Browser versions tested against:

Firefox
Chrome

Description:

if you click in show/hide legend the line series isnot reused

Steps to reproduce the problem:

click in 'data1' legend item

The result that was expected:

Dom nodes dont increase, lines should be reused, only showing/hidding

The result that occurs instead:

each time you click in legend news dom nodes are created

Test Case:



var store = Ext.create('Ext.data.JsonStore', {
fields: ['name', 'data1', 'data2', 'data3', 'data4', 'data5'],
data: [
{ 'name': 'metric one', 'data1': 10, 'data2': 12, 'data3': 14, 'data4': 8, 'data5': 13 },
{ 'name': 'metric two', 'data1': 7, 'data2': 8, 'data3': 16, 'data4': 10, 'data5': 3 },
{ 'name': 'metric three', 'data1': 5, 'data2': 2, 'data3': 14, 'data4': 12, 'data5': 7 },
{ 'name': 'metric four', 'data1': 2, 'data2': 14, 'data3': 6, 'data4': 1, 'data5': 23 },
{ 'name': 'metric five', 'data1': 4, 'data2': 4, 'data3': 36, 'data4': 13, 'data5': 33 }
]
});


var logEl = Ext.getBody().createChild();


Ext.create('Ext.chart.Chart', {
renderTo: Ext.getBody(),
width: 500,
height: 300,
animate: false,
legend : true,
store: store,
redraw : function(){
Ext.chart.Chart.prototype.redraw.apply(this, arguments);
var el = this.surface.el;
if(el && el.dom){
var len = el.dom.childNodes.length;
logEl.update('SVG childNodes: ' + len);
}
},
axes: [
{
type: 'Numeric',
position: 'left',
fields: ['data1'],
title: 'Sample Values',
minimum: 0
},
{
type: 'Category',
position: 'bottom',
fields: ['name'],
title: 'Sample Metrics'
}
],
series: [
{
type: 'line',
axis: 'left',
xField: 'name',
yField: ['data1']
}
]
});



Cause (drawSeries method ):



if (!storeCount || me.seriesIsHidden) {
me.hide();
me.items = [];
if (me.line) {
me.line.hide(true);
if (me.line.shadows) {
shadows = me.line.shadows;
for (j = 0, lnsh = shadows.length; j < lnsh; j++) {
shadow = shadows[j];
shadow.hide(true);
}
}
if (me.fillPath) {
me.fillPath.hide(true);
}
}
me.line = null; // <--- cause
me.fillPath = null; // <--- cause
return;
}



*EDIT BY Gary Schlosberg
Issue started in 4.1.1, still present 4.2.1. Not present in 4.1.0

Gary Schlosberg
6 Aug 2013, 2:03 PM
Thanks for the report! I have opened a bug in our bug tracker.