Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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}" />
Posted
Comments
Graeme_Grant 4-Apr-17 4:06am    
You would have to do it manually if there is no Save to SVG option. Not a small task.

Have you inspected the Xaml using VS2015VS2015 "Live Visual Inspector" tool? ref: Introducing the UI debugging tools for XAML | The Visual Studio Blog[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900