In my MAUI app, I’m using microcharts to draw real time data stream, but when i change the background of chart to transparent, by any means( BackgroundColor = SKColors.Transparent //or BackgroundColor = SKColor.Parse(#00FFFFFF,
), the chart starts redrawing in place.
Here are my data and chart implementations:
inside a function in viewmodel:
//DataEntries is ObservableCollection
DataEntries.Add(new ChartEntry(data)
{
Label = timestamp.ToString("HH:mm:ss"), // Format timestamp for label
ValueLabel = data.ToString(),
Color = randomcolor // choosing random color from List<SKColors>
});
chart = new LineChart()
{
Entries = DataEntries ,
//IsAnimated = true,
//AnimationProgress=1000,
//AnimationDuration=TimeSpan.FromMilliseconds(2500),
//LineMode = LineMode.Spline, // Use straight lines between points
//LineSize = 3, // Adjust line thickness
//PointMode = PointMode.Circle, // Display data points as circles
//PointSize = 20, // Adjust point size
BackgroundColor = SKColors.Transparent,
//EnableYFadeOutGradient = true,
MaxValue = max,
MinValue=min,
ShowYAxisLines = true,
ShowYAxisText=true,
YAxisMaxTicks=7,
ValueLabelOrientation=Orientation.Horizontal,
LabelOrientation=Orientation.Horizontal,
LabelTextSize = 12,
Margin = 20,
};
inside View.XAML:
<microcharts:ChartView x:Name="chartData"
MinimumWidthRequest="200"
Chart="{Binding Chart}"
HeightRequest="400"
/>
- I’m using MVVM to pass the data and chart logic through viemodel to
View.xaml. - The background of app is set to Mica on windows.
Can anyone tell if there is anything wrong with my code, or is it the microchart itself causing this issue.