using System;
using Windows.UI.Xaml.Controls;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace UWP.CartesianChart.Basic_Stacked_Bar
{
using LiveCharts;
using LiveCharts.Uwp;
///
/// An empty page that can be used on its own or navigated to within a Frame.
///
public sealed partial class BasicStackedColumnExample : Page
{
public BasicStackedColumnExample()
{
InitializeComponent();
SeriesCollection = new SeriesCollection
{
new StackedColumnSeries
{
Values = new ChartValues {4, 5, 6, 8},
StackMode = StackMode.Values, // this is not necessary, values is the default stack mode
DataLabels = true
},
new StackedColumnSeries
{
Values = new ChartValues {2, 5, 6, 7},
StackMode = StackMode.Values,
DataLabels = true
}
};
//adding series updates and animates the chart
SeriesCollection.Add(new StackedColumnSeries
{
Values = new ChartValues { 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";
this.CleanSeparator = DefaultAxes.CleanSeparator;
}
public Separator CleanSeparator;
public SeriesCollection SeriesCollection { get; set; }
public string[] Labels { get; set; }
public Func Formatter { get; set; }
}
}