+ Reply to Thread
Results 1 to 2 of 2

Thread: generate a Google Charts

  1. #1
    Junior Member
    Join Date
    Jan 2012

    generate a Google Charts

    Hello , i would like to call google chart API and save the result as a JPEG or PNG file , is that possible in c# ?

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Hi firstly look at GoogleChartSharp
    Then Using the HttpWebRequest and HttpWebResponse classes you could capture the response stream as a byte array (the image) and write that to a file with the proper extensionstring chartUrl = chart.GetUrl();
    byte[] chartBytes = null;
    WebClient cl = new WebClient();
    chartBytes = cl.DownloadData(chartUrl);
    using (var memStream = new MemoryStream())
        memStream.Write(chartBytes, 0, chartBytes.Length);
    File.WriteAllBytes("C:\chart.png", chartBytes);

+ Reply to Thread

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts