Change minimum of chart from code

Hi

I'm trying to change minimum value of SfChart as seen in attached image. The chart is refreshed but the new MinDate is not used. Any suggestion how to fix this?

Image_9428_1702486469648


1 Reply

DG Durga Gopalakrishnan Syncfusion Team December 15, 2023 03:22 PM UTC

Hi Stefan,


Greetings from Syncfusion.


We have ensured your reported scenario with attached code snippet. We were able to update the Minimum date range in x axis and redraw the chart with updated value by calling the StateHasChanged method. We have attached the tested sample and screenshot for your reference.


<SfChart>

   <ChartPrimaryXAxis Minimum="@minimum"></ChartPrimaryXAxis>

</SfChart>

@code{

    DateTime minimum { get; set; } = new DateTime(2016, 2, 01);

    public void ChangeMinimum()

    {

        minimum = new DateTime(2016, 1, 01);

        StateHasChanged();

    }

}


Before Update



After Update


Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/MinRangeUpd-602224469.zip


If you are still facing problem, please try to replicate an issue in above sample or share us issue reproduced sample to validate this case further from our end. Kindly revert us if you have any concerns.


Regards,

Durga Gopalakrishnan.


Loader.
Up arrow icon