本文整理汇总了C#中System.Windows.Controls.DataVisualization.Charting.Chart.EndInit方法的典型用法代码示例。如果您正苦于以下问题:C# Chart.EndInit方法的具体用法?C# Chart.EndInit怎么用?C# Chart.EndInit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.DataVisualization.Charting.Chart
的用法示例。
在下文中一共展示了Chart.EndInit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddPieCharts
// Shows how to add an arbitrary controls to the map
// As sample the pie charts series of Wpf toolkit is used
// http://wpf.codeplex.com/releases/view/40535
public void AddPieCharts(ShapeLayer layer)
{
// our demo data
var stores = new List<Store>{
new Store
{
Name = "KA-Center",
Latitude = 48.96,
Longitude = 8.39,
Sales = new List<Sale>{
new Sale{Type = "Food", Amount= 30},
new Sale { Type = "Non Food", Amount = 70 }}
},
new Store
{
Name = "KA-North",
Latitude = 49.04,
Longitude = 8.41,
Sales = new List<Sale>{
new Sale{Type = "Food", Amount = 40},
new Sale { Type = "Non Food", Amount = 50 },
new Sale { Type = "Pet Food", Amount = 10 }}
}};
foreach (var store in stores)
{
// initialize a pie chart for each element
Chart chartView = new Chart();
chartView.BeginInit();
chartView.Width = 300;
chartView.Height = 250;
chartView.Background = new SolidColorBrush(Color.FromArgb(192, 255, 255, 255));
PieSeries pieSeries = new PieSeries();
chartView.Title = store.Name;
pieSeries.IndependentValuePath = "Type";
pieSeries.DependentValuePath = "Amount";
pieSeries.ItemsSource = store.Sales;
pieSeries.IsSelectionEnabled = true;
chartView.Series.Add(pieSeries);
chartView.EndInit();
// Add to map
ShapeCanvas.SetLocation(chartView, new Point(store.Longitude, store.Latitude));
ShapeCanvas.SetAnchor(chartView, LocationAnchor.Center);
ShapeCanvas.SetScaleFactor(chartView, .1); // adopt the element to the scale factor
layer.Shapes.Add(chartView);
}
}