diff --git a/LC_Tutorial/Tutorial/BasicPlots/StackedAreaWindow.xaml b/LC_Tutorial/Tutorial/BasicPlots/StackedAreaWindow.xaml
new file mode 100644
index 0000000..67de92c
--- /dev/null
+++ b/LC_Tutorial/Tutorial/BasicPlots/StackedAreaWindow.xaml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/LC_Tutorial/Tutorial/BasicPlots/StackedAreaWindow.xaml.cs b/LC_Tutorial/Tutorial/BasicPlots/StackedAreaWindow.xaml.cs
new file mode 100644
index 0000000..cbacf42
--- /dev/null
+++ b/LC_Tutorial/Tutorial/BasicPlots/StackedAreaWindow.xaml.cs
@@ -0,0 +1,145 @@
+using LiveCharts;
+using LiveCharts.Defaults;
+using LiveCharts.Wpf;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Tutorial.BasicPlots
+{
+ ///
+ /// StackedAreaWindow.xaml에 대한 상호 작용 논리
+ ///
+ public partial class StackedAreaWindow : Window
+ {
+ private int _index = 2014;
+
+ public event PropertyChangedEventHandler? PropertyChanged;
+
+ public SeriesCollection SeriesCollection { get; set; }
+ public string[] Labels { get; set; }
+ public StackMode StackMode { get; set; }
+ public Func XFormatter { get; set; }
+ public Func YFormatter { get; set; }
+
+ public StackedAreaWindow()
+ {
+ InitializeComponent();
+ InitInstance();
+ }
+
+ private void InitInstance()
+ {
+ SeriesCollection = new SeriesCollection
+ {
+ new StackedAreaSeries
+ {
+ Title = "Africa",
+ Values = new ChartValues
+ {
+ new DateTimePoint(new DateTime(1950, 1, 1), .228),
+ new DateTimePoint(new DateTime(1960, 1, 1), .285),
+ new DateTimePoint(new DateTime(1970, 1, 1), .366),
+ new DateTimePoint(new DateTime(1980, 1, 1), .478),
+ new DateTimePoint(new DateTime(1990, 1, 1), .629),
+ new DateTimePoint(new DateTime(2000, 1, 1), .808),
+ new DateTimePoint(new DateTime(2010, 1, 1), 1.031),
+ new DateTimePoint(new DateTime(2013, 1, 1), 1.110)
+ },
+ LineSmoothness = 1,
+ PointGeometry = DefaultGeometries.Square
+ },
+ new StackedAreaSeries
+ {
+ Title = "N & S America",
+ Values = new ChartValues
+ {
+ new DateTimePoint(new DateTime(1950, 1, 1), .339),
+ new DateTimePoint(new DateTime(1960, 1, 1), .424),
+ new DateTimePoint(new DateTime(1970, 1, 1), .519),
+ new DateTimePoint(new DateTime(1980, 1, 1), .618),
+ new DateTimePoint(new DateTime(1990, 1, 1), .727),
+ new DateTimePoint(new DateTime(2000, 1, 1), .841),
+ new DateTimePoint(new DateTime(2010, 1, 1), .942),
+ new DateTimePoint(new DateTime(2013, 1, 1), .972)
+ },
+ LineSmoothness = 1,
+ PointGeometry = DefaultGeometries.Square
+ },
+ new StackedAreaSeries
+ {
+ Title = "Asia",
+ Values = new ChartValues
+ {
+ new DateTimePoint(new DateTime(1950, 1, 1), 1.395),
+ new DateTimePoint(new DateTime(1960, 1, 1), 1.694),
+ new DateTimePoint(new DateTime(1970, 1, 1), 2.128),
+ new DateTimePoint(new DateTime(1980, 1, 1), 2.634),
+ new DateTimePoint(new DateTime(1990, 1, 1), 3.213),
+ new DateTimePoint(new DateTime(2000, 1, 1), 3.717),
+ new DateTimePoint(new DateTime(2010, 1, 1), 4.165),
+ new DateTimePoint(new DateTime(2013, 1, 1), 4.298)
+ },
+ LineSmoothness = 1,
+ PointGeometry = DefaultGeometries.Square
+ },
+ new StackedAreaSeries
+ {
+ Title = "Europe",
+ Values = new ChartValues
+ {
+ new DateTimePoint(new DateTime(1950, 1, 1), .549),
+ new DateTimePoint(new DateTime(1960, 1, 1), .605),
+ new DateTimePoint(new DateTime(1970, 1, 1), .657),
+ new DateTimePoint(new DateTime(1980, 1, 1), .694),
+ new DateTimePoint(new DateTime(1990, 1, 1), .723),
+ new DateTimePoint(new DateTime(2000, 1, 1), .729),
+ new DateTimePoint(new DateTime(2010, 1, 1), .740),
+ new DateTimePoint(new DateTime(2013, 1, 1), .742)
+ },
+ LineSmoothness = 1,
+ PointGeometry = DefaultGeometries.Square
+ }
+ };
+
+ XFormatter = val => new DateTime((long)val).ToString("yyyy");
+ YFormatter = val => $"{val.ToString("N")} M";
+
+ DataContext = this;
+ }
+
+ private void btnChageMode_Click(object sender, RoutedEventArgs e)
+ {
+ foreach (var series in SeriesCollection.Cast())
+ {
+ series.StackMode = series.StackMode == StackMode.Percentage ? StackMode.Values : StackMode.Percentage;
+ }
+
+ if (((StackedAreaSeries)SeriesCollection[0]).StackMode == StackMode.Values)
+ YFormatter = val => $"{val.ToString("N")} M";
+ else
+ YFormatter = val => val.ToString("P");
+ }
+
+ private void btnAdd_Click(object sender, RoutedEventArgs e)
+ {
+ Random rand = new Random();
+ int year = _index++;
+ foreach (var series in SeriesCollection.Cast())
+ {
+ series.Values.Add(new DateTimePoint(new DateTime(year, 1, 1), ((DateTimePoint)series.Values[series.Values.Count - 1]).Value + rand.NextDouble()));
+ }
+ }
+ }
+}
diff --git a/LC_Tutorial/Tutorial/MainWindow.xaml b/LC_Tutorial/Tutorial/MainWindow.xaml
index d82d789..7059e62 100644
--- a/LC_Tutorial/Tutorial/MainWindow.xaml
+++ b/LC_Tutorial/Tutorial/MainWindow.xaml
@@ -16,6 +16,7 @@
+
diff --git a/LC_Tutorial/Tutorial/MainWindow.xaml.cs b/LC_Tutorial/Tutorial/MainWindow.xaml.cs
index b3df232..4aaabf1 100644
--- a/LC_Tutorial/Tutorial/MainWindow.xaml.cs
+++ b/LC_Tutorial/Tutorial/MainWindow.xaml.cs
@@ -49,5 +49,11 @@ namespace Tutorial
RowsWindow win = new RowsWindow();
win.Show();
}
+
+ private void btnStackedArea_Click(object sender, RoutedEventArgs e)
+ {
+ StackedAreaWindow win = new StackedAreaWindow();
+ win.Show();
+ }
}
}