I want to update dynamicly ( on input ) the chart AND the table where i can modify values.

Hello,


i'm trying to modify the chart when i change values in my table in the left side of the page. Here is a screenshot :image.png

And here is my code :

<table class="table table-bordered">
                    <thead>
                        <tr>
                            <th>AZ</th>
                            <th>Amp</th>
                            <th>Phase</th>
                        </tr>
                    </thead>
                    <tbody>
                        @*Affichage du tableau de données représentant le graphique à côté*@
                        @for (int i = 0; i < tableauRaw.tab.Count() - 1; i++)
                        {
                            <tr>
                                    <td><input @bind="tableauRaw.tab[i].X" ></td>
                                    <td><input @bind="tableauRaw.tab[i].Y" ></td>
                                    <td><input @bind="tableauRaw.tab[i].Z" ></td>
                                   
                               
                            </tr>
                        }
                    </tbody>
                </table>

 <SfChart @ref="Chart" Title="@this.selected" Palettes="@palettes">
                    <ChartPrimaryXAxis StartAngle="90" Minimum="0" Maximum="360" Interval="30"> </ChartPrimaryXAxis>
                    <ChartPrimaryYAxis Minimum="0" Maximum="1"/>
                    <ChartSeriesCollection>
                        <Syncfusion.Blazor.Charts.ChartSeries DataSource="@tableauRaw.tab" XName="X" Width="2" Opacity="1" YName="Y"
                                     Type="ChartSeriesType.Polar" DrawType="ChartDrawType.Spline">
                                     <ChartDataEditSettings Enable="true"></ChartDataEditSettings>

                        </Syncfusion.Blazor.Charts.ChartSeries>
                       
                    </ChartSeriesCollection>
                </SfChart>

When i try to replace a value un my table, the chart is not modified instantaneous. I need to refresh the page to see te difference. And also the value inside the table stay unchanged like it were before the input. I don't understand how this can occur can you Help Me ?

Thank you.


Maxime Miquel.


4 Replies

DG Durga Gopalakrishnan Syncfusion Team April 12, 2022 02:53 PM UTC

Hi Miquel,


Greetings from Syncfusion.


We suggest you to assign the table changed values to chart series datasource and update the chart using Refresh method. You can also use ObservableCollection for chart data to update the data dynamically.


<SfChart @ref="Chart"></SfChart>

 

@code {

SfChart Chart;

public void Refresh(){

       Chart.Refresh();

}


Please let us know if you have any concerns.


Regards,

Durga Gopalakrishnan.



MM MIQUEL Maxime replied to Durga Gopalakrishnan April 12, 2022 02:57 PM UTC

Hi, thank you for your return.


As i said that's not the main problem.

The problem is that the value that was before my input goes back after pressing enter.





DG Durga Gopalakrishnan Syncfusion Team April 13, 2022 03:18 PM UTC

Hi Miquel,


We are checking your reported scenario. We will update the further details within two business days. We appreciate your patience until then.


Regards,

Durga Gopalakrishnan.



DG Durga Gopalakrishnan Syncfusion Team April 18, 2022 03:56 PM UTC

Hi Miquel,


Thanks for being patience. We have prepared sample based on your requirement. Please check with the below snippet and screenshots.


public void ChangeData()

    {

        this.Sales = new List<SalesInfo>{

                new SalesInfo { Month = x1, SalesValue = y1 },

                new SalesInfo { Month = x2, SalesValue = y2 },

              new SalesInfo { Month = x3, SalesValue = y3 },

        };

        chart.Refresh();

    }


Initial rendering


Updating table values


Sample : https://www.syncfusion.com/downloads/support/directtrac/general/ze/TableData-1977437269.zip


Kindly revert us if you have any concerns.


Regards,

Durga Gopalakrishnan.


Loader.
Up arrow icon