Sign in to follow this  
Mansi Shah

Convert chart to image

Recommended Posts

I need to export the fusion chart to PDF, which may contain other data also.

 

So I think for that I need to convert it to image, then I can put that image in PDF with other data.

 

 

 

How can I problematically create an image of chart?

Share this post


Link to post
Share on other sites
Guest Madhumita

Hello,

 

 

 

You can use the Export functionality of FusionCharts V3 to export chart as image or PDF.

 

You can view a demo of the Export functionality from the link below:

 

http://www.fusioncharts.com/Demos/ExportChart/Contents/client_export.html

 

 

 

Please refer to our documentation on Export functionality from the link below:

 

http://www.fusioncharts.com/docs/ >> Export to Image/PDF

Share this post


Link to post
Share on other sites

Hi,

 

Thanks for the reply.

 

 

 

But I am still having some issues, not able to save the image.

 

I am creating the image serve side.

 

 

 

Client side code

 

 

 

< div id="dvChart" runat="server" >

       <%=GetChart()%>    [server side function which will create categories, dataset and values in xmlData stringbuilder]

      < /div >  

       < asp:HiddenField ID="hdnXML"  runat="server" / >



< script type="text/javascript" >

  //Callback handler method which is invoked after the chart has saved image on server.

  function myCallBackFunction(objRtn){

     if (objRtn.statusCode=="1"){

        alert("The chart was successfully saved on server. The file can be accessed from " + objRtn.fileName);

     }else{

        alert("The chart could not be saved on server. There was an error. Description : " + objRtn.statusMessage);

     }

  }

< /script > 



 < script type="text/javascript" >

  //Create the chart. Make sure registerWithJS is set to 1, else callback cannot happen.



  var myChart = new FusionCharts("../FusionCharts/MSColumn3D.swf", "121", "400", "300", "0", "1"); 

  myChart.setDataURL(document.getElementById('hdnXML').value);

    myChart.render("dvChart");



< /script >

 

 

 

Server side code

 

 

 

StringBuilder xmlData = new StringBuilder();

 

xmlData.Append("");

 

 

 

And for rendering, code is,

 

 

 

xmlDATA = FusionCharts.RenderChart("../FusionCharts/MSColumn3D.swf","http://localhost/golf/FusionCharts/PDFs/", xmlData.ToString(), "BallTest", "700", "400", false, true);

 

 

 

Exporer CS

 

 

 

private const string SAVE_PATH = "../FusionCharts/PDFs/";

 

private const string HTTP_URI = "http://localhost/golf/FusionCharts/PDFs/";

 

 

 

I think client side new FusionCharts() function, but not sure with that.

 

At present it is displaying "Error in loading data" and then some javascript text with that. There is something wrong with above code for sure, but don't know where.

 

Can you please help me out?

Share this post


Link to post
Share on other sites

It's very smart for you to adpot a image converting applciation to trasform the chart to image and then render image to pdf, for image to pdf saving, I just search a big third party sit and get this:

 

public static void SaveImageFile(Image image, string filePath);
public static void SaveImageFile(Image image, string filePath, BaseEncoder enc);

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