beto-rodriguez / LiveCharts2

Simple, flexible, interactive & powerful charts, maps and gauges for .Net, LiveCharts2 can now practically run everywhere Maui, Uno Platform, Blazor-wasm, WPF, WinForms, Xamarin, Avalonia, WinUI, UWP.
https://livecharts.dev
MIT License
4.39k stars 573 forks source link

Chart Not loading Unless Hot Reload is Pressed #1711

Open nourhammoury opened 1 day ago

nourhammoury commented 1 day ago

Describe the bug I have been trying to figure this out for over two days, but I haven't been able to. I downloaded the master version, but I still couldn't resolve the issue. It works fine on Android, but I can't figure it out on Windows.

I even tried creating a clean project, and I'm experiencing the same problem. I have attached the simple project based on the documentation. I would appreciate it if anyone could clarify what I am doing wrong.

To make the chart appear, modify any line in the XAML file, restore it, and then click on Hot Reload. Otherwise, it won't work.

Code Below App.xaml.cs ` namespace LiveCharts2 { public partial class App : Application { public App() { InitializeComponent();

        //MainPage = new AppShell();
        MainPage = new Chart();
    }
}

} `

ViewModel.cs `using LiveChartsCore.SkiaSharpView.Drawing.Geometries; using LiveChartsCore.SkiaSharpView; using LiveChartsCore; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;

namespace LiveCharts2 { public class ViewModel { public ISeries[] Series { get; set; } = [ new ColumnSeries(3, 4, 2), new ColumnSeries(4, 2, 6), new ColumnSeries<double, DiamondGeometry>(4, 3, 4) ]; } } **Chart.xaml** <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:lvc="clr-namespace:LiveChartsCore.SkiaSharpView.Maui;assembly=LiveChartsCore.SkiaSharpView.Maui" xmlns:local="clr-namespace:LiveCharts2;assembly=LiveCharts2" x:Class="LiveCharts2.Chart"

`

Chart.xaml.cs `namespace LiveCharts2;

public partial class Chart : ContentPage { public Chart() { InitializeComponent(); } }`

Desktop

Smartphone

nourhammoury commented 1 day ago

Video

https://github.com/user-attachments/assets/f0188774-74d4-4c11-a20a-ec742a19ca2d