mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-20 00:16:36 +08:00
添加项目文件。
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Windows.Controls;
|
||||
using LiveCharts;
|
||||
using LiveCharts.Wpf;
|
||||
|
||||
namespace Wpf.CartesianChart.Basic_Stacked_Bar
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for StackedColumnExample.xaml
|
||||
/// </summary>
|
||||
public partial class BasicStackedColumnExample : UserControl
|
||||
{
|
||||
public BasicStackedColumnExample()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
SeriesCollection = new SeriesCollection
|
||||
{
|
||||
new StackedColumnSeries
|
||||
{
|
||||
Values = new ChartValues<double> {4, 5, 6, 8},
|
||||
StackMode = StackMode.Values, // this is not necessary, values is the default stack mode
|
||||
DataLabels = true
|
||||
},
|
||||
new StackedColumnSeries
|
||||
{
|
||||
Values = new ChartValues<double> {2, 5, 6, 7},
|
||||
StackMode = StackMode.Values,
|
||||
DataLabels = true
|
||||
}
|
||||
};
|
||||
|
||||
//adding series updates and animates the chart
|
||||
SeriesCollection.Add(new StackedColumnSeries
|
||||
{
|
||||
Values = new ChartValues<double> {6, 2, 7},
|
||||
StackMode = StackMode.Values
|
||||
});
|
||||
|
||||
//adding values also updates and animates
|
||||
SeriesCollection[2].Values.Add(4d);
|
||||
|
||||
Labels = new[] {"Chrome", "Mozilla", "Opera", "IE"};
|
||||
Formatter = value => value + " Mill";
|
||||
|
||||
DataContext = this;
|
||||
}
|
||||
|
||||
public SeriesCollection SeriesCollection { get; set; }
|
||||
public string[] Labels { get; set; }
|
||||
public Func<double, string> Formatter { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user