Use asp:chart in Telerik Reports

Thread is closed for posting
3 posts, 0 answers
  1. Telerik Admin
    Telerik Admin avatar
    1531 posts
    Member since:
    Oct 2004

    Posted 22 Oct 2009 Link to this post

    Requirements

    RadControls version

    2.0
    .NET version

    2.0
    Visual Studio version

    VS2008
    programming language

    C#
    To convert code

    Telerik online converter  


    PROJECT DESCRIPTION
    Telerik Reporting offers a chart item for your data visualization needs. It uses the same engine as RadChart for ASP.NET AJAX control, so if you are familiar with it, you should get up to speed in no time. Its documentation, examples and forum threads are there for you whenever you are not sure about something.
    However if you have not worked with our chart before and you do not want to learn new chart or simply feel comfortable with the default asp:chart control (or any chart control for that matter), then you can still use it in a Telerik Report. You can save the image to a stream/image and show it inside our PictureBox item.

    A sample project showing the functionality at hand is attached to this thread.

  2. Pams
    Pams avatar
    61 posts
    Member since:
    Sep 2010

    Posted 06 Oct 2010 Link to this post

    Hello,
    I was looking for getting the 3d effect for the chart. I found in the forum that there is no such facility in telerik reporting. We have to do that in aspchart.

    I checked the code in use aspchart in telerik reporting.
    But i didn't under stand howto do it.
    I first added a telerik reporting class library. report1.
    I dragged a picturebox.
    In the code behind report.cs I pasted the code which was given in the attachment.

     private void pictureBox1_ItemDataBinding(object sender, EventArgs e)
            {
                System.Web.UI.DataVisualization.Charting.Chart chart1 = new System.Web.UI.DataVisualization.Charting.Chart();
                Series series = new Series("Spline");
                series.ChartType = SeriesChartType.Spline;
                ChartArea area = new ChartArea("ChartArea1");
                chart1.ChartAreas.Add(area);
                series.BorderWidth = 3;
                series.ShadowOffset = 2;

                // Populate new series with data
                series.Points.AddY(67);
                series.Points.AddY(57);
                series.Points.AddY(83);
                series.Points.AddY(23);
                series.Points.AddY(70);
                series.Points.AddY(60);
                series.Points.AddY(90);
                series.Points.AddY(20);

                // Add series into the chart's series collection
                chart1.Series.Add(series);
                MemoryStream ms = new MemoryStream();
                chart1.SaveImage(ms, ChartImageFormat.Png);
                Telerik.Reporting.Processing.PictureBox procPicturebox = (Telerik.Reporting.Processing.PictureBox)sender;
                procPicturebox.Image = Image.FromStream(ms);
                
            }

    But the problem is I am not able to System.Web.UI.DataVisualization.Charting and also the Series.
    Am I correct in adding the TelerikReport Item to the class library or how should i proceed to get the 3d chart.

    Any example with would be appreciated.
    Urgent pls.

    Thanks

  3. Steve
    Admin
    Steve avatar
    10942 posts
    Member since:
    May 2014

    Posted 07 Oct 2010 Link to this post

    Hi Pams,

    The attached sample in this thread is fully runnable. The only prerequisite if you are using Visual Studio 2008 is to install:


    Regards,
    Steve
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items

Back to Top