After you have added a chart control to your ActiveReport, you can save the chart to an XML file as well as load an existing XML-based chart into your project. A chart can be saved to or loaded from an XML file at design time using the "Load" and "Save As" verbs below the Properties window.
If you do not see the verbs in Visual Studio 2005, right-click the Properties Window and select Commands. |
When an XML-based chart layout is loaded into a project it will supersede the chart layout in the currently active report. Thus, in order to avoid replacing any important layouts in the current project, a new blank ActiveReport must be created before loading the file. After you have created the new ActiveReport, load the XML file into it. |
The following code demonstrates how you can do this programmatically.
'VB Private Sub ReportHeader_Format(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles ReportHeader.Format Me.ChartControl2.Save(Application.StartupPath & "\savedChart.xml") End Sub Private Sub Detail1_Format(ByVal sender As Object, ByVal e As System.EventArgs) Handles _ Detail1.Format Me.ChartControl1.Load(Application.StartupPath & "\Bezier.xml") End Sub //C# private void ReportHeader_Format(object sender, System.EventArgs eArgs) { this.chartControl2.Save(System.Windows.Forms.Application.StartupPath + "\\savedChart.xml"); private void detail_Format(object sender, System.EventArgs eArgs) { this.chartControl1.Load(System.Windows.Forms.Application.StartupPath + "\\Bezier.xml"); }