How to refresh Heatmap when data change

Hi, 

The following code does not work.

Thanks in advance.

<SfButton @onclick=@change CssClass="e-flat" IsToggle="true" IsPrimary="true" Content="demo"></SfButton>

<SfHeatMap DataSource="@HeatMapData" @ref="chartObj">
    <HeatMapXAxis Labels="@XAxisLabels"></HeatMapXAxis>
    <HeatMapYAxis Labels="@YAxisLabels"></HeatMapYAxis>
    <HeatMapTitleSettings Text="Sales Revenue per Employee (in 1000 US$)">
    </HeatMapTitleSettings>
    <HeatMapCellSettings ShowLabel="true" TileType="CellType.Rect">
         <HeatMapCellBorder Width = "1" Radius = "4" Color = "White" ></HeatMapCellBorder>
    </HeatMapCellSettings>
    <HeatMapLegendSettings ShowLabel="true"></HeatMapLegendSettings>
</SfHeatMap>

@code{
    int[,] GetDefaultData()
    {
        int[,] dataSource = new int[,]
        {
            {73392639940},
            {935853382668},
            {99282246690},
            {14269769693},
            {7464747886},
            {41557323379},
        };
        return dataSource;
    }
    string[] XAxisLabels = new string[] {"Nancy""Andrew""Janet""Margaret""Steven""Michael" };
    string[] YAxisLabels = new string[] { "Mon""Tue""Wed""Thu""Fri""Sat" };
    SfHeatMap<Object> chartObj; 
    public object HeatMapData { get; set; }
    protected override void OnInitialized()
    {
        HeatMapData = GetDefaultData();
    }


    private void change() {
        var aa = this.HeatMapData as int[,];
        aa[0,1] = 100;


        StateHasChanged();
    }

}

3 Replies 1 reply marked as answer

SP Sowmiya Padmanaban Syncfusion Team April 1, 2021 12:29 PM UTC

Hi Hugo Zhao,  
 
Sorry for the inconvenience. 
 
We checked your reported problem with Heatmap component. Currently, we don’t have support to change the dataSource dynamically and considered this as a bug from our end. We will include this fix in second weekly patch release of April which is expected to be rolled out by the mid of April, 2021. You can track the status of your reported problem through the below portal link.  
   
 
Once the fix is included, you can assign the updated dataSource to the Heatmap dataSource to reflect the changes in UI.  
    
We appreciate your patience.   
   
Regards,   
Sowmiya.P 


Marked as answer

AM Amanda replied to Sowmiya Padmanaban November 18, 2021 11:21 AM UTC

Hello,

Is this bug fixed yet because I am having the same problem when changing my DataSource dynamically?



SM Shalini Maragathavel Syncfusion Team November 19, 2021 12:03 PM UTC

Hi Amanda, 

Greetings from Syncfusion support.
 
Based on your query, we suspect that you are facing an issue in changing data source to the HeatMap dynamically. So we have prepared a HeatMap sample and tried to reproduce the reported issue by changing the data source dynamically but we are unable to reproduce the mentioned issue as the HeatMap Chart component  is rendered properly while updating the data source dynamically

If your reported problem persists, then please share the following information to validate further. 
  • If possible, replicate your reported problem in the above sample or provide a simple sample to replicate the issue.
  • Elaborate on your issue in detail with a video demonstration.
  • Syncfusion package version.
This information would help us to find the exact cause of your reported problem and to provide the prompt solution.  
Regards,  
Shalini M. 



Loader.
Up arrow icon