Currently my chart is powered by data entered through code-behind:
Wpf:
<chartingToolkit:ChartName="lineChart" Title="Series Demo" Margin="0,10,10,54">
<chartingToolkit:LineSeries DependentValuePath="Value"
IndependentValuePath="Key" ItemsSource="{Binding}"
IsSelectionEnabled="True" />
</chartingToolkit:Chart>
C # code:
public partial class Charts : Window
{
public Charts()
{
InitializeComponent();
showColumnChart();
}
private void showColumnChart()
{
List<KeyValuePair<string, int>> valueList = new List<KeyValuePair<string, int>>();
valueList.Add(new KeyValuePair<string, int>("oculos", 60));
valueList.Add(new KeyValuePair<string, int>("lentes prontas", 200));
valueList.Add(new KeyValuePair<string, int>("manutenção", 10));
lineChart.DataContext = valueList;
}
}
I have a table with these same values and would like to use them from the table in the sql server, and then add or remove them without changing the code.