Generate chart image without displaying the chart

5 posts, 0 answers
  1. Brett Robichaud
    Brett Robichaud avatar
    24 posts
    Member since:
    Feb 2009

    Posted 06 Apr 2012 Link to this post

    I'm using RadChart v2011.3.11.1219 with a .Net 4.0 WinForms app using VS 2010 sp1. In this app I am displaying a couple of charts, but I am wondering if it is possible to generate a line chart and save it to png without ever displaying the chart?

    How would I go about doing that?
  2. Ves
    Admin
    Ves avatar
    2879 posts

    Posted 11 Apr 2012 Link to this post

    Hi Brett,

    Here is a small example:

    public MyForm()
            {
                InitializeComponent();
     
                RadChart chart = new RadChart();
                chart.DefaultType = Telerik.Charting.ChartSeriesType.Line;
                chart.DataSource = new double[] {2,3,4,3,4,3,4,5};
                chart.DataBind();
     
                chart.Save("C:\\mychart.png");
            }

    RadChart is never added to the form, but it is only used to generate the output image. You can find a more complex example of creating RadChart in code here. Once you have it configured and populated, you can call the Save method to export the chart to an image.

    Best regards,
    Ves
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Brett Robichaud
    Brett Robichaud avatar
    24 posts
    Member since:
    Feb 2009

    Posted 11 Apr 2012 Link to this post

    Doh! That is about as simple as it gets. Thank you Ves!
  5. Christophe
    Christophe avatar
    2 posts
    Member since:
    Mar 2016

    Posted 03 Mar Link to this post

    Hi, 

    Is there a way to do this with the new RadHtmlChart for Asp.Net ?

    Or should I use the "obsolete" RadChart if I want to generate the image without displaying the chart ?

    Regards,

  6. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 03 Mar Link to this post

    Hello Christophe,

    This forums concerns UI for WinForms. Please address your question in the ASP.NET AJAX forums to get proper advice: http://www.telerik.com/forums/aspnet-ajax

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WinForms is Visual Studio 2017 Ready