I'm trying to create a service which generates and saves/returns a chart as a svg file.
For that i would like to use
System.Windows.Controls.DataVisualization.Toolkit
.
Is there a way to save the chart as required?
Thanks in advance...
David
What I have tried:
MainWindow.XAML.cs
public partial class MainWindow : Window {
public MainWindow()
{
InitializeComponent();
ShowColumnChart();
}
private void ShowColumnChart()
{
//csgn.DataContext = GetCsgValueList();
//ubsn.DataContext = GetUbsValueList();
List<KeyValuePair<DateTime, double>> listCsgn = GetCsgValueList();
List<KeyValuePair<DateTime, double>> listUbsn = GetUbsValueList();
var dataSourceList = new List<List<KeyValuePair<DateTime, double>>>();
dataSourceList.Add(GetFirstValueList());
dataSourceList.Add(GetSecondValueList());
lineChart.DataContext = dataSourceList;
}
}
XAML:
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Margin="0">
<Grid Height="650">
<!-- BorderBrush="#00000000" IsTabStop="True" -->
<chartingToolkit:Chart Name="lineChart" Style="{DynamicResource GeneralChartStyle}" Title="ChartFactoryTest">
<chartingToolkit:LineSeries IndependentValuePath="Key" DependentValuePath="Value" ItemsSource="{Binding [0]}"
IsSelectionEnabled="True" Title="blubba" DataPointStyle="{DynamicResource LineDataPointStyleCs}" />
<chartingToolkit:LineSeries IndependentValuePath="Key" DependentValuePath="Value" ItemsSource="{Binding [1]}"
IsSelectionEnabled="True" Title="blubba2" DataPointStyle="{DynamicResource LineDataPointStyleUbs}" />