how to create a dynamically changeable gauge in live charts 2 for Avalonia

58 Views Asked by At

Im working in Avalonia using livecharts 2 and i have a few charts which work fine now i wanted to add a gauge and i cant figure out how to create a dynamic object where the values of the gauge are changeable after creation

the documentation shows me this:

public partial class ViewModel : ObservableObject
{
    public IEnumerable<ISeries> Series { get; set; } =
        GaugeGenerator.BuildSolidGauge(
            new GaugeItem(30, series =>
            {
                series.Fill = new SolidColorPaint(SKColors.YellowGreen);
                series.DataLabelsSize = 50;
                series.DataLabelsPaint = new SolidColorPaint(SKColors.Red);
                series.DataLabelsPosition = PolarLabelsPosition.ChartCenter;
                series.InnerRadius = 75;
            }),
            new GaugeItem(GaugeItem.Background, series =>
            {
                series.InnerRadius = 75;
                series.Fill = new SolidColorPaint(new SKColor(100, 181, 246, 90));
            }));
}

but i cant seem to change the display value of the gauge by manipulating the Series object i want the Gauge to be a global object in my view-model that multiple functions can edit based on the state of the UI and i want the object to be initialised in a GaugeInit func

UPDATE: i solved it its accessible not via index but with the first func so Series.First().Values

UPDATE: i solved it its accessible not via index but with the first func so Series.First().Values

(im posting this anyway for the next person to find as it is unclear and not in the documentation :D )

0

There are 0 best solutions below