Dynamically Enable & Disable Crosshair

Hi Syncfusion team,

i am trying to dynamically enable & disable the crosshair on a sfchart in my application. Unfortunately changing the "Enable" property has no effect. Attached sample VS project & code.


@using Syncfusion.Blazor.Charts
@using Syncfusion.Blazor.Buttons

<SfButton OnClick="() => enable_crosshair = !enable_crosshair">
    @btn_text
</SfButton>

<SfChart>
    <ChartPrimaryXAxis ValueType="Syncfusion.Blazor.Charts.ValueType.DateTime"></ChartPrimaryXAxis>

    <ChartCrosshairSettings Enable="@enable_crosshair"></ChartCrosshairSettings>

    <ChartSeriesCollection>
        <ChartSeries XName="X" YName="Y" DataSource="@SalesDetails" Type="ChartSeriesType.Line">
        </ChartSeries>
    </ChartSeriesCollection>
</SfChart>


@code {

    public class ChartData

    {

        public DateTime X { get; set; }

        public double Y { get; set; }

    }


    private bool enable_crosshair = false;

    private string btn_text => enable_crosshair ? "Disable Crosshair" : "Enable Crosshair";



    public List<ChartData> SalesDetails = new List<ChartData>

    {

        new ChartData { X = new DateTime(2000, 01, 01), Y = 4 },

        new ChartData { X = new DateTime(2001, 01, 01), Y = 3.0 },

        new ChartData { X = new DateTime(2002, 01, 01), Y = 3.8 },

        new ChartData { X = new DateTime(2003, 01, 01), Y = 3.4 },

        new ChartData { X = new DateTime(2004, 01, 01), Y = 3.2 },

        new ChartData { X = new DateTime(2005, 01, 01), Y = 3.9 },

    };

}


Regards
Simon

Attachment: ChartCrosshair_a29da093.zip

2 Replies

GV Gopalakrishnan Veeraraghavan Syncfusion Team November 6, 2024 12:50 PM UTC

Hi Simon Andres,

We have considered your reported issue as a bug and have logged a defect report for it. This fix will be available in our patch release, which is scheduled to be rolled out on November 19th , 2024. We appreciate your patience until then. You can keep track of the bug using the feedback link below.

 

Feedback Link: The Enable property does not dynamically update in ChartCrosshairSettings in Blazor | Feedback Portal

 

If you have any more specification/precise replication procedure or a scenario to be tested, you can add it as a comment in the portal.

 

Disclaimer: “Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization.”


Regards,
Gopalakrishnan V


DG Durga Gopalakrishnan Syncfusion Team November 26, 2024 05:22 AM UTC

Simon,


We are glad to announce that our v27.2.3 patch release is rolled out; we have added the fix for reported issue. You can use the latest Syncfusion.Blazor.Charts NuGet package.


Root Cause:

Previously, we didn't have a method to update the ChartCrosshairSettings properties on the script side.


Fix:

Implemented the proper method to update the properties of ChartCrosshairSettings.


NuGet Package : https://www.nuget.org/packages/Syncfusion.Blazor.Charts/


Sample : https://blazorplayground.syncfusion.com/LDLzWsVRsQPtAWIi


Feedback : https://www.syncfusion.com/feedback/62844/the-enable-property-does-not-dynamically-update-in-chartcrosshairsettings


We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.


Loader.
Up arrow icon