I'm using LiveCharts v2 in .net MAUI app. I need to display temprature using chart and change point color when temperature > 38. In WPF i can use CartesianMapper and LineSeries.Configuration, but in .net MAUI i can't find LineSeries.Configuration. So, how to change point color?
I've tried LineSeries.Mapping, but i don't know how to change ChartPoint color? `
lineSeries.Mapping = (value, point) =>
{
if (value > 37)
{
//lineSeries.DataLabelsPaint = new SolidColorPaint(SKColors.Red);
}
else
{
}
point.PrimaryValue = value;
point.SecondaryValue = point.Context.Entity.EntityIndex;
};
`
LiveCharts2 is based on LiveCharts but the API is a little bit different, this feature is now called ConditionalDraw
and while it is not properly documented yet, you can get info about it here.
// full code at
// https://github.com/beto-rodriguez/LiveCharts2/blob/master/samples/ViewModelsSamples/General/ConditionalDraw/ViewModel.cs
var series1 = new ColumnSeries<ObservableValue>
{
Name = "Mary",
Values = new ObservableValue[] { ... }
}
.WithConditionalPaint(new SolidColorPaint(SKColors.Black.WithAlpha(50)))
.When(point => point.Model?.Value > 5);
I think changing the color of the labels is not supported by now, I will take deeper look into that and update the docs.