Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Chart > Rendering Chart from WebService

Not answered Rendering Chart from WebService

Feed from this thread
  • Posted on Aug 6, 2010 (permalink)

    Got html from WebServices.
    With these additional settings to chart control:

    chert.UseSession =

     

    false;

     

    chert.TempImagesFolder =

     

    "~/TempImages/";

     



    Having problem getting chart html from WebService. My task it to have it on client side from WS.
    Failed with both of implementations below:
    1.

     

     

     

    [WebMethod]
    public string GetChart()
    {
       RadChart chert = new RadChart();
       chert.ID = "olapChart";
      
    string result = string.Empty;
    using (MemoryStream stream = new MemoryStream())
    {
           StreamWriter writer = new StreamWriter(stream);
           HtmlTextWriter htmlWriter = new HtmlTextWriter(writer);
           chert.RenderControl(htmlWriter);
           System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
           writer.Flush();
           result = encoding.GetString(stream.ToArray());
     }

    Having "Object reference not set to an instance of an object." on call chert.RenderControl(htmlWriter);

    2.

    [WebMethod]
            public string GetChart()
            {
               return GetChartRendered(chert);
            }
      
            private string GetChartRendered(RadChart chert)
            {
                string result = string.Empty;
      
                TempRenderer pageHolder = new TempRenderer();
                HtmlForm tempForm = new HtmlForm();
                tempForm.ID = "TempForm";
                pageHolder.Controls.Add(tempForm);
                tempForm.Controls.Add(new ScriptManager());
                tempForm.Controls.Add(chert);
      
                StringWriter output = new StringWriter();
                HttpContext.Current.Server.Execute(pageHolder, output, false);
      
                result = output.ToString();
                return result;
            }
      
            public partial class TempRenderer : System.Web.UI.Page
            {
            }

    Having "Error executing child request for handler 'ChartTest.TempRenderer'" there on Server.Execute.

    3. Eventually created just page "chart.aspx" wiht just single chart control decalred

    <

     

     

    telerik:RadChart ID="chert" runat="server" Width="500px" Height="290px" EnableViewState="false" SkinsOverrideStyles="false" ></telerik:RadChart>

     

     

     


    and trying this in WebMethod:
    StringWriter output = new StringWriter();
    HttpContext.Current.Server.Execute("chart.aspx", output, false);
    string result = output.ToString();

    Having ex:" Error executing child request for chart.aspx."

    As I understand the reason of all these exceptions is ChartImage.axd
    handler.

    If somebody can help - please, it's very urgent.
    Thank you.

     

     

    Reply

  • Bartholomeo Rocca Master avatar

    Posted on Aug 11, 2010 (permalink)

    Hello Alexander,

    I do not think that this would be possible as the chart image is not just a bunch of html but it is actually served by the ChartImage.axd HttpHandler.

    You might try saving the chart image to a stream via RadChart.Save(...) method and process the result with your service.


    Greetings,
    Bart.

    Reply

  • kulashaker avatar

    Posted on Jan 31, 2012 (permalink)

    Hi, I know this thread is quite old, but I actually need to run Chart.RenderControl.

    Reason is that I need to extract the ImageMap collection from the resulting HTML that RenderControl produces. I know it sounds messy but there is no property that exposes the ImageMap in the RadChart control.

    Is there another way of doing this?

    Cheers
    Bruce

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > Chart > Rendering Chart from WebService
Related resources for "Rendering Chart from WebService"

ASP.NET Chart Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]