Stock Chart is calling web service continuosly

Hello,

I added a Stock Chart to one of my screens. 

It is working properly but it is calling the web service continuosly despite the page and the chart are well loaded.

Here my code :

           <ejs-stockchart id="stockchart" load="Loadstockchart" width="100%" tooltipRender="LoadToolTipstockchart">

                    <e-stockchart-series-collection>

                        <e-stockchart-series type='Line' xName='x' yName='amount' name='Purchases'> </e-stockchart-series>

                    </e-stockchart-series-collection>

                    <e-stockchart-primaryxaxis valueType="DateTime">

                    </e-stockchart-primaryxaxis>

                </ejs-stockchart>



And here my js :


function Loadstockchart(args) {

    var id = $("#SupplierId").val();

    $.ajax({

        type: "GET",

        url: '/Supplier/GetTMSPurchasesAmountsBySupplier?id=' + id,

        success: function (data) {

            args.stockChart.series[0].dataSource = data;

        },

        error: function (msg) {


        }

    });

}

Here a screenshot of the browser inspector where you can see the huge amount of calls



1 Reply

DG Durga Gopalakrishnan Syncfusion Team November 29, 2021 12:46 PM UTC

Hi Ahmed, 
  
Greetings from Syncfusion. 
  
We have ensured your reported scenario with attached snippet and screenshot; the web service method in controller is triggered only once. We have attached the tested sample for your reference. Please check with the below snippet and screenshot. 
  
<script> 
    var stockload = function (args) { 
        $.ajax({ 
            type: "POST", 
            url: '@Url.Action("GetServerData")', 
            async: false, 
            success: function (data) { 
                args.stockChart.series[0].dataSource = data; 
            } 
        }); 
    } 
</script> 
  
 
  
  
Kindly revert us if you have any concerns. 
  
Regards,  
Durga G 


Loader.
Up arrow icon