Home Forums Chart Support Update chart with new date Reply To: Update chart with new date

#44406

@rcweb,

Parsing data received from the post request & passing it to chart-option before rendering it should work fine in your case. You are trying to perform another request inside the success of AJAX request, which is redundant. Please take a look at the code-snippet below.


$.ajax({
  url : 'chart.php',
  type : 'POST',
  data : {startDate:startDate,endDate:endDate},
  success : function(data) {
    var chart = new CanvasJS.Chart("chartContainer", {
      data: [
        {

          indexLabel: " {y}",
          indexLabelFontSize: 16,

          dataPoints: data
        }
      ]
    });

    chart.render();

  }
});

If you are still facing the issue, kindly create sample project reproducing the issue and share it with us over Google-Drive or Onedrive along with sample data so that we can look into your code, run it locally at our end to understand the scenario better and help you out.

—-
Manoj Mohan
Team CanvasJS