title: How to update Apexcharts data by using Ajax
body: <p>In our Application, we are displaying a chart and that needs to be updated constantly when a user-entered/changed input box value.</p>
  <p>I call ajax to update charts data (series data) when the input value changed but chats disappeared after Ajax response.</p>
  <p>I have the following code to update Chart's Data</p>
  <pre><code>jQuery(document).ready(function () {
      
      const apexChart = &quot;#chart_1&quot;;
      var options = {
          series: [{
              name: 'Speed',
              data: [[0, 61.800509], [38.40001963, 61.16179846], [76.80003925, 60.52701894], [115.2000589, 59.89221522], [153.6000785, 59.25741165], [192.0000981, 58.62260808]]
          }],
          chart: {
              height: 350,
              type: 'line',
              offsetX: 1
          },
          dataLabels: {
              enabled: false
          },
          stroke: {
              curve: 'straight',
              dashArray: [0, 0, 15, 5, 0]
          },
          xaxis: {
              min: 0,
              max: 4500,
              tickAmount: 9,
              type: 'numeric',
          },
          grid: {
              row: {
                  colors: ['#f3f3f3', 'transparent'],
                  opacity: 0.5
              },
          },
          colors: [primary, danger, '', '', '']
      };
  
      var chart = new ApexCharts(document.querySelector(apexChart), options);
      chart.render();
  
      //Call ajax when input value changed
      $.ajax({
          url: APP_URL + &quot;{controller}/{method}&quot;,
          data: data,
          type: 'POST',
          dataType: 'json',
          async: true,
          cache: false,
          //beforeSend: function() { openLoadingDialog('#container'); },
          success: function (response) {
              //closeLoadingDialog('#container');
              console.log(JSON.stringify(response));
              chart.updateSeries([{
                  name: 'Speed',
                  data: response
              }]);
          }
      });
  });
  </code></pre>
  <p>When I do <code>console.log(JSON.stringify(response))</code>, the output value is</p>
  <pre><code>&quot;[[0.0,61.8],[38.4,61.2],[76.8,60.5],[115.2,59.9],[153.6,59.3],[192.0,58.6]]&quot;
  </code></pre>
  <p>If I copy the response value and paste it in <code>updateSeries()</code>, then the chart loads fine.</p>
  <p>Any help to update the chart's series data by Ajax?</p>