Unplanned
Last Updated: 19 Nov 2023 15:06 by ADMIN
Steve
Created on: 19 Nov 2023 14:55
Category: Chart
Type: Bug Report
1
Chart: [iOS] [MacCatalyst] Any customizations made in the handler are reset when Chart series are updated.
If you access the native chart control and made some customization on handler changed, the customizations are reset when series are updated. 
1 comment
ADMIN
Didi
Posted on: 19 Nov 2023 15:06

Solution: Call the update each time data is added to the chart series source. 

public partial class MainPage : ContentPage
{
    ViewModel vm;
    public MainPage()
    {
        InitializeComponent();

        this.vm = new ViewModel();
        this.BindingContext = vm;

        RunAsync(cancel => {
            while (!cancel.IsCancellationRequested)
            {
                Thread.Sleep(2000);
                Dispatcher.Dispatch(() =>
                {
                    vm.AddPoint();
                    this.UpdateChart();
                });
            }
        });

    }

    private void Chart_HandlerChanged(object sender, EventArgs e)
    {
        this.UpdateChart();
    }

    private void UpdateChart()
    {
        var platformView = this.chart.Handler.PlatformView;
#if IOS || MACCATALYST
        var platformChart = (Telerik.Maui.Controls.Compatibility.ChartRenderer.iOS.TKExtendedChart)platformView;
        platformChart.YAxis.Style.LineHidden = false;
        platformChart.YAxis.Style.LabelStyle.TextAlignment = TelerikUI.TKChartAxisLabelAlignment.Left;
        platformChart.YAxis.Style.LabelStyle.FirstLabelTextAlignment = TelerikUI.TKChartAxisLabelAlignment.Left;

#endif
    }

 

Regards,
Didi
Progress Telerik

A brand new .NET MAUI course was just added to the Virtual Classroom. The training course is developed to help you get started with the Telerik UI for .NET MAUI components and features. It aims to put you in the shoes of an engineer who adds new features to an existing application. You can check it out at https://learn.telerik.com