Я новичок в WPF, я хочу знать, как добавлять диаграммы с помощью инструментария визуализации данных WPF из-за кода.
public void LoadChart()
{
List<KeyValuePair<string, int>> valueList = new List<KeyValuePair<string, int>>();
valueList.Add(new KeyValuePair<string, int>("FreeSpace", 60));
valueList.Add(new KeyValuePair<string, int>("UsedSpace", 20));
List<KeyValuePair<string, int>> list = new List<KeyValuePair<string, int>>();
valueList.Add(new KeyValuePair<string, int>("x", 40));
valueList.Add(new KeyValuePair<string, int>("y", 400));
PieSeries pie = new PieSeries();
pie.Title = "Disk Memory";
pie.ItemsSource = valueList;
pie.IndependentValuePath = "Key";
pie.DependentValuePath = "Value";
chart.Series.Add(pie);
Chart x = new Chart();
PieSeries series = new PieSeries();
series.Title = "Disk Memory";
series.ItemsSource = list;
series.IndependentValuePath = "Key";
series.DependentValuePath = "Value";
x.Series.Add(series);
}
}
, где я пытаюсь добавить обе диаграммы в сетку,Как мы можем добавить?