This example demonstrates how to use client-side events to export a WebChartControl to PDF on a client side. To do this, it is necessary to do the following:
1. Set the WebChartControl.ClientInstanceName property to some value (e.g. "chart1");
2. Add two ASPxButton controls to a web page, and set their AutoPostBack properties to False;
3. Handle their client-side Click event as "chart1.SaveToWindow('pdf');" or "chart1.SaveToDisk('pdf');".
NOTE: Since exporting a chart to PDF is based upon the XtraPrinting Library, don't forget to add a reference to the DevExpress.XtraPrinting assembly into your project's References list.
Question Comments
Added By: mehmet akyel at: 11/26/2013 7:50:25 AM
It does not work.
Added By: Ekambar Bomma at: 6/16/2014 6:55:18 AMIf I change the series dynamically during the run time, it is not printing the updated chart. It is still printing the old chart. Any suggestions?
Here is how I add series to the chart during the run time:
Series series = new Series("Series1", ViewType.Line);
series.DataSource = mySeresTable;
series.ArgumentScaleType = ScaleType.DateTime;
series.ArgumentDataMember = "Argument";
series.ValueDataMembers.AddRange(new string[] { "Value" });
series.Name = "My Test";
series.Visible = true;
//REMOVE THE MARKER (POINT BUBBLES) NO THE LINE GRAPH
LineSeriesView view = (LineSeriesView)series.View;
view.MarkerVisibility = DevExpress.Utils.DefaultBoolean.False;
this.WebChartControl1.Series.Add(series);
this.WebChartControl1.Titles.Clear();
ChartTitle chartTitle = new ChartTitle();
chartTitle.Text = "Title at + myVal.ToString();
this.WebChartControl1.Titles.Add(chartTitle);
this.WebChartControl1.DataSource = mySeresTable;
this.WeChartControl1.DataBind();