This is a migrated thread and some comments may be shown as answers.

Export RadChart to pdf for winforms

3 Answers 155 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Nicky
Top achievements
Rank 1
Nicky asked on 22 May 2012, 05:24 AM
How do I export radchart to pdf for winforms? 

3 Answers, 1 is accepted

Sort by
0
Peshito
Telerik team
answered on 24 May 2012, 09:33 AM
Hi Nicky,

RadChart for WinForms does not support exporting to PDF. However you can save the chart into an image:
radChart1.Save("chart.png", ImageFormat.Png);
and then add your image to whatever document you want.

All the best,
Peshito
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Nicky
Top achievements
Rank 1
answered on 25 May 2012, 06:55 PM
Thank You! 
Do you know how to refresh the RadChart for winforms?
0
Peshito
Telerik team
answered on 30 May 2012, 08:26 AM
Hello Nicky,
 
Simply try calling the DataBind() method.
Below is a sample code demonstrating the approach:
public partial class Form1 : Form
    {
        private DataTable table;
 
        public Form1()
        {
            InitializeComponent();
 
            table = GetTable();
 
            ChartSeries series = new ChartSeries();
            series.Type = ChartSeriesType.Pie;
            series.DataYColumn = "Value";
            series.Name = "1st Series Name";
            //series.DataLabelsColumn = "Title";
            series.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;
 
            radChart1.AutoLayout = true;
 
            radChart1.Series.Add(series);
            radChart1.Legend.Appearance.Visible = false;
            radChart1.DataSource = table;
            radChart1.DataBind();
        }
 
        public static DataTable GetTable()
        {
            DataTable table = new DataTable();
            table.Columns.Add("Value", typeof(int));
            table.Columns.Add("Title", typeof(string));
 
            table.Rows.Add(65, "Text1");
            table.Rows.Add(20, "Text2");
            table.Rows.Add(5, "Text3");
            table.Rows.Add(10, "Text4");
            table.Rows.Add(15, "Text5");
 
            return table;
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            int value = (int)this.table.Rows[0][0];
            value += 100;
            this.table.Rows[0][0] = value;
 
            this.radChart1.DataBind();
        }
    }

Hope this helps.

Kind regards,
Peshito
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
General Discussions
Asked by
Nicky
Top achievements
Rank 1
Answers by
Peshito
Telerik team
Nicky
Top achievements
Rank 1
Share this question
or