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 574 forks source link

The legend does not reflect my Stroke color #1507

Closed Xixi0506 closed 2 months ago

Xixi0506 commented 6 months ago

Discussed in https://github.com/beto-rodriguez/LiveCharts2/discussions/1427

Originally posted by **Daimonion1980** January 19, 2024 Hello Community. Maybe someone can give me a hint, why my stroke color is not reflected in the legend. Please take a look at the screenshot: ![image](https://github.com/beto-rodriguez/LiveCharts2/assets/12880413/54f4c868-04f7-4863-a2a4-d895c94c7293) And here are the codesnippets, I use to display the series: ViewModel: ```csharp partial void OnInitialize() { //temporäre initalisierung einer Achse, des Plots PlotData = new ObservableCollection { new LineSeries { Values = plotValue1, Fill = null, GeometrySize = 0, Stroke = new SolidColorPaint(SKColors.Red), LineSmoothness = 0.3, Name="Drehzahl rpm" } }; } ``` UserControl: ```xml ``` I found [issue 365](https://github.com/beto-rodriguez/LiveCharts2/issues/365) but this should already be fixed in 2.0.0-rc2 ?! Does anybody see the problem?
beto-rodriguez commented 2 months ago

Hello sorry about the confusion, what is shown in the legend is the geometry, not the line, setting the GeometryStroke will make the trick:

new LineSeries<double>
{
    Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
    Fill = null,
    GeometryStroke = new SolidColorPaint(SKColors.Red),
}

image

In your case it is confusing because your geometry is null.