Quantcast
Viewing all articles
Browse latest Browse all 7205

How to export a web chart on a client side

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 AM    

If 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();

Added By: John (DevExpress Support) at: 6/17/2014 3:57:18 AM    Hi Ekambar,
A similar issue is described in the export chart with filters and PerformCallBack topic. 
To solve this problem, both the WebChartControl.EnableViewState and WebChartControl.SaveStateOnCallbacks properties should be set to false.Added By: Paul Astro at: 10/23/2014 8:03:15 AM    

Will this still work with the latest v14 + of dev express ?   Or is there a better method to export webchartcontrols to PDF?  Please post link to new updated code if there is any.  THanks,.

Added By: Paul Astro at: 10/23/2014 8:13:09 AM    

Would this code work if the user is on a Android Tablet/Smart phone with Javascript eneabled?

Added By: Paul Astro at: 10/23/2014 8:54:38 AM    

My WebCHartControl (Chart size is too big and it takes up two pages within the generated PDF files, how can I dynamically make it smaller so that it fits on ONE PDF page and maybe even open the file in "landscape" page view?


Viewing all articles
Browse latest Browse all 7205

Trending Articles