Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Setting Stroke-Color via Mapper in LineSeries not working #1166

Open
nickstr15 opened this issue Jul 27, 2022 · 0 comments
Open

Setting Stroke-Color via Mapper in LineSeries not working #1166

nickstr15 opened this issue Jul 27, 2022 · 0 comments

Comments

@nickstr15
Copy link

How to reproduce?

here a minimalistic example:

MainWindow.xaml

<lvc:CartesianChart Series="{Binding ChartData}">

MainWindowViewModel.cs

//  constructor
public MainWindowVievModel(){

    GraphData = new SeriesCollection(){
         new LineSeries(){
            Values = currentData,
            PointGeometrySize = 0,
            LineSmoothness = 0,
            Fill = Brushes.Transparent,
            Configuration = new CartesianMapper<Point>()
                .X(point => point.X)
                .Y(point => point.Y)
                .Stroke(point => Brushes.Black),
        }
    }

    FillChart();

}
  
private ChartValues<Point> currentData = new ChartValues<Point>();

private SeriesCollection graphData;
public SeriesCollection GraphData{
    get => graphData;
    set{
        graphData = value;
        OnPropertyChanged();
    }
}

//add some dummy data
private void FillChart(){
    currentData .Add(new Point(0, 0));
    currentData .Add(new Point(1, 1));
    currentData .Add(new Point(2, 2));
}

Expectation

I would expect the LineChart to have the stroke color black, but instead it is the default blue.
In my problem I do not want to use Black for all colors, but instead want to do something like

Configuration = new CartesianMapper<MyCustomPoint>()
     .X(point => point.X)
     .Y(point => point.Y)
    .Stroke(point => FindColorMethod(point),

I also tried using .Fill(point => ...) (with other PointgeometrySize) but this did not worked too.

I am using

Live-Charts version 0.9.7
.Net Version .NET Framework 4.7.2
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant