using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Input; using LiveCharts; using LiveCharts.Uwp; namespace UWP.CartesianChart.Energy_Predictions { /// /// Interaction logic for EnergyPredictionExample.xaml /// public partial class EnergyPredictionExample { public EnergyPredictionExample() { InitializeComponent(); Series = new SeriesCollection { new StackedAreaSeries { Values = new ChartValues {20, 30, 35, 45, 65, 85}, Title = "Electricity" }, new StackedAreaSeries { Values = new ChartValues {10, 12, 18, 20, 38, 40}, Title = "Water" }, new StackedAreaSeries { Values = new ChartValues {5, 8, 12, 15, 22, 25}, Title = "Solar" }, new StackedAreaSeries { Values = new ChartValues {10, 12, 18, 20, 38, 40}, Title = "Gas" } }; DataContext = this; } public SeriesCollection Series { get; set; } private void UIElement_OnTapped(object sender, TappedRoutedEventArgs e) { var series = (StackedAreaSeries) ((ContentPresenter) sender).Content; if (series != null) series.Visibility = series.Visibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible; } } }