Sign in to follow this  
steveddei

Fc 3.1 Getxmll() And Setdataxml() Not Working

Recommended Posts

I am using FC 3.1 PHP to generate my markup then javascript to update the data.

Since 3.1 does not support single attribute update, I am trying to set the dataxml and I am getting the following error:

ERROR: Invalid XML encountered. An XML element is malformed. Click the above "dataURL Invoked" link to see the XML in browser Or check the XML data provided.

 

I have searched the forums and tried all the solution. The strange thing is that, honestly, out of no where, it worked, but now it is not.

I have tried the scenerios:

 

Get and reset-

var xml = chart.getXML();

chart.setDataXML(xml);

"<chart showPercentValues="1" animation="1" baseFontSize="18" showBorder="0" bgAlpha="0" bgColor=""FFFFFF"" bold="1"><set value="3596.74" label="Initial" /><set value="105.35" label="Software" /><set value="130.20" label="System" /><set value="52.45" label="Media/Service" /><set value="0.00" label="Indirect (Initial)" /><set value="656.66" label="Operation/cost" /><set value="2910.96" label="Maintenance" /><set value="11777.30" label="Fees" /><set value="974.41" label="Content" /><set value="263.85" label="Update" /><set value="263.00" label="Updates" /><set value="720.00" label="costs (Recurring)" /></chart>"

 

Replaced double quotes-

var xml = chart.getXML();

"<chart showPercentValues="1" animation="1" baseFontSize="18" showBorder="0" bgAlpha="0" bgColor=""FFFFFF"" bold="1"><set value="3596.74" label="Initial" /><set value="105.35" label="Software" /><set value="130.20" label="System" /><set value="52.45" label="Media/Service" /><set value="0.00" label="Indirect (Initial)" /><set value="656.66" label="Operation/cost" /><set value="2910.96" label="Maintenance" /><set value="11777.30" label="Fees" /><set value="974.41" label="Content" /><set value="263.85" label="Update" /><set value="263.00" label="Updates" /><set value="720.00" label="costs (Recurring)" /></chart>"

 

xml = xml.replace(/\"/g,"'"); or xml = xml.replace(/"/g,"'");

"<chart showPercentValues='1' animation='1' baseFontSize='18' showBorder='0' bgAlpha='0' bgColor=''FFFFFF'' bold='1'><set value='3596.74' label='Initial'/><set value='105.35' label='Software'/><set value='130.20' label='System'/><set value='52.45' label='Media/Service' /><set value='0.00' label='Indirect (Initial)' /><set value='656.66' label='Operation/cost' /><set value='2910.96' label='Maintenance' /><set value='11777.30' label='Fees' /><set value='974.41' label='Content' /><set value='263.85' label='Update' /><set value='263.00' label='Updates'/><set value='720.00' label='costs (Recurring)' /></chart>"

 

chart.setDataXML(xml);

 

None of them seem to work

$('#toggle').toggle(
       function(){
           var chart = getChartFromId('Doughnut2D1');
           if(chart && chart.hasRendered && chart.hasRendered()==true)
           {
               var xml = chart.getXML();
               xml = xml.replace(/"/g,"'");
               //xml = xml.replace("showValues='1'", "showPercentValues='1'");

               chart.setDataXML(xml);
           }
       },
       function(){
           var chart = getChartFromId('Doughnut2D1');
           if(chart && chart.hasRendered && chart.hasRendered()==true)
           {
               var xml = chart.getXML();
               xml = xml.replace(/"/g,"'");
               //xml = xml.replace("showPercentValues='1'", "showValues='1'");

               chart.setDataXML(xml);
           }
       });

Edited by steveddei

Share this post


Link to post
Share on other sites

Well, sometimes it take some talking out to figure it out :(

 

I just noticed in the post, that the XML is mal-formed. On load, it doesn't blow up with bgColor=""FFFFFF"" , but on js update it does.

Turns out on the PHP side, the bgColor param was set to bgColor="FFFFFF", when it should have been bgColor=FFFFFF. :)

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
Sign in to follow this