PDA

View Full Version : Ext.draw.engine.SvgExporter and NaN in Path Elements



karlsnyder0
19 Nov 2013, 10:15 AM
Ext version tested:

Ext 4.1.3


Browser versions tested against:

Chrome 31.0.1650.57
FF8


DOCTYPE tested against:

N/A


Description:
When downloading a Chart using SVG to PNG Transcoders NaN values can cause transcoder failures. The Ext.draw.engine.SvgExporter class passes NaN values along. When failures occur with NaN values the following error is thrown in Apache Batik:

The attribute "d" of the element <path> is invalid.

Workaround
Replace:


for(i = 0; i < itemsLen; i++){
item = items[sortedItems[i]];
if(!item.attr.hidden){
svg += spriteProcessor[item.type](item);
}
}

svg += '</svg>';

With:


for(i = 0; i < itemsLen; i++){
item = items[sortedItems[i]];
if(!item.attr.hidden){
var itemSvg = spriteProcessor[item.type](item);
itemSvg = itemSvg.replace('NaN', '0');
svg += itemSvg;
}
}

svg += '</svg>';

Gary Schlosberg
19 Nov 2013, 4:27 PM
Thanks for the report. Does it happen with ExtJS 4.2.1? Can you please post a test case which reproduces the issue?

karlsnyder0
22 Nov 2013, 8:34 AM
Drop the following files into the examples/charts folder, rename them removing their .txt extension and load the html file in a browser. Next, download the chart and observe the failed download and network packets to the sencha.io server.

46965
46966

I have not yet tested 4.2.2.