The following example demonstrates how to export the chart data as a PDF document to a file.
using System.Diagnostics;
using System.IO;
using System.Windows;
using DevExpress.Xpf.Charts;
namespace ExportToPdf {
public partial class MainWindow : Window {
string PDFFile = "Output.pdf";
public MainWindow() {
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e) {
PrintSizeMode sizeMode = PrintSizeMode.Stretch;
chartControl.ExportToPdf(PDFFile, sizeMode);
Process.Start(PDFFile);
}
}
}
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts" x:Class="ExportToPdf.MainWindow"
Title="MainWindow" Height="350" Width="525">
<Grid>
<dxc:ChartControl x:Name="chartControl">
<dxc:ChartControl.Legend>
<dxc:Legend/>
</dxc:ChartControl.Legend>
<dxc:XYDiagram2D>
<dxc:BarSideBySideSeries2D DisplayName="Series 1">
<dxc:SeriesPoint Argument="A" Value="2"/>
<dxc:SeriesPoint Argument="B" Value="13"/>
<dxc:SeriesPoint Argument="C" Value="15"/>
<dxc:SeriesPoint Argument="D" Value="17"/>
</dxc:BarSideBySideSeries2D>
</dxc:XYDiagram2D>
</dxc:ChartControl>
<StackPanel Orientation="Horizontal">
<Button Content="Export To PDF File" VerticalAlignment="Top" Width="120" Click="Button_Click"/>
</StackPanel>
</Grid>
</Window>
Imports Microsoft.VisualBasic
Imports System.Diagnostics
Imports System.IO
Imports System.Windows
Imports DevExpress.Xpf.Charts
Namespace ExportToPdf
Partial Public Class MainWindow
Inherits Window
Private PDFFile As String = "Output.pdf"
Public Sub New()
InitializeComponent()
End Sub
Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim sizeMode As PrintSizeMode = PrintSizeMode.Stretch
chartControl.ExportToPdf(PDFFile, sizeMode)
Process.Start(PDFFile)
End Sub
End Class
End Namespace