Sign in to follow this  
sirill

Pie2D with only one element.

Recommended Posts

Hi,

 

 

 

I am using SWFToImage with C# to capture the swf on jpg files.

 

 

 

I try to get a Pie2D with only one element in it.

 

 

 

I use this code for setiing the dataXML when the SWF will be launched

 

 

 

graph.Execute_SetVariable("dataXML", GraphXml);

 

 

 

But i'm facing a problem : If my Pie2D has only one elements i get a data XML invalid message.

 

 

 

Here is the XML Code of my chart :

 

 

 

<chart bgColor='FFFFFF' showBorder='0' animation='0' use3DLighting='0'><set label='taux' value='100'/> </chart>

 

 

 

But if the XML has a second element :

 

 

 

<chart bgColor='FFFFFF' showBorder='0' animation='0' use3DLighting='0'><set label='taux' value='100'/><set label='alternatif' value='100'/> </chart>

 

 

 

This works this time...

 

 

 

Here is the debugger message :

 

 

 

bugjp9.jpg

 

 

 

Someone got a solution for this ?

 

 

 

Thanks

Share this post


Link to post
Share on other sites

Hi Sirill,

Could you please follow these codes: 

// This will execute the flash.

graph.Execute_Begin();

// Now set the dataXML variable.

graph.Execute_SetVariable("dataXML", xml);

// Important Step.

Console.

WriteLine("Wait till chart fully load itself.");

Console.ReadLine();

// Capture the SWF as Image.

graph.Execute_GetImage();

// Save the captured Image(Binary) in File.

graph.SaveToFile(

"FusionCharts.bmp");

It works like this:

  When you invoke graph.SaveToFile() method, it just captures SWF's frame No. 0 or more but not the final frame i.e. when chart completely loads.

To overcome this issue you have to wait till chart finished loading itself, for this purpose I have used Console.ReadLine();. However if you don't like to use ReadLine() you can use some delay method.

 

Share this post


Link to post
Share on other sites

Hi,

 

 

 

Thanks for your reply.

 

 

 

I was actually using a method to wait until the chart completely loads but this is not the purpose of my problem.

 

 

 

everything works fine with two elements in my Pie2d Chart but if it only contains one element i get the error you can see on the screenshot.

 

 

 

For all other charts swftoimage works fine (I use this to include charts in PDF and everything works fine unless this one element Pie Chart :) )

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