regnillob

setDataXML with Gantt Chart

Recommended Posts

I declare my chart as follows, and this line succeeds and the chart can accept data and render.

 

 

 

var gantt = new FusionCharts("../Fusion/Gadgets/Gantt.swf", "FusionGanttID", "500", "400", "0", "1");

 

 

 

This is my setDataXML line of JavaScript, which does not work. This XML does work when returned from an XML file to setDataURL. See below the XML for more details.

 

 

 

gantt.setDataXML("<chart dateFormat='yyyy/mm/dd' start='2010/01/11' end='2010/01/12' canvasBgColor='E6F2F9, CCE4F3' canvasBgAngle='90' ganttLineColor='306D90' ganttLineAlpha='33' gridBorderColor='306D90' canvasBorderColor='306D90' taskbarRoundRadius='3' showShadow='0'><categories bgAlpha='100' bgColor='DBE0E3'></categories><categories bgAlpha='100' bgColor='DBE0E3'><category name='Jan' start='2010/01/11' end='2010/01/12' /></categories><categories bgAlpha='100' bgColor='DBE0E3'><category name='11' start='2010/01/11' end='2010/01/11' /><category name='12' start='2010/01/12' end='2010/01/12' /></categories><processes isBold='1' headerbgColor='007AC1' fontColor='003D60' bgColor='E6F2F9'><process Name='PX01' id='1' /><process Name='PX02' id='2' /><process Name='PX03' id='3' /></processes><tasks><task name='86386' processId='2' start='2010/01/11' end='2010/01/11' taskId='86386' color='98B6C8' borderColor='00629A' height='100%' /></tasks></chart>");

 

 

 

The offending member is the height="100%" of the only <task>. I have listed the task below.

 

 

 

<task name='86386' processId='2' start='2010/01/11' end='2010/01/11' taskId='86386' color='98B6C8' borderColor='00629A' height='100%' />

 

 

 

1. With the attribute in place, the chart reports "invalid XML".

 

 

 

2. If I remove the height attribute, the chart renders and displays the task, but I cannot control the height, which I need at 100%.

 

 

 

3. If I try to encode the percent sign by changing to height="100%25" the chart does render, but the task does not show.

 

 

 

Any suggestions? Thanks!

Edited by Guest

Share this post


Link to post
Share on other sites

Hi,

I am afraid, I could not replicate the issue after testing the XML that you have posted. :(

Your XML is working fine in our lab. Could you please recheck with the issue you are facing?

Also, could you please send us the sample code that you are using to render the chart, as an attachment?

Share this post


Link to post
Share on other sites

For now I have found a workaround. Passing the xml string into JavaScript instead of creating it in JavaScript works. Not sure why, but as long as it works I am in business. Thanks.

Share this post


Link to post
Share on other sites
Guest Basundhara Ghosal

Hi,

Glad that your issue is resolved.

Thanks for sharing your idea.

Happy FusionCharting. :(

Share this post


Link to post
Share on other sites

Hi,

 

 

 

Could you please also check whether you are using the latest FusionCharts.js (In the header if the JS file you would find this - Version: 1.2.4 (16th February, 2009) - Added fix for chart with % width/height.)

 

 

 

This version contains fix for % and & characters.

 

 

 

Also, to use this fix you need to pass the XML using setDataXML().

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now