vendredi 28 août 2020

How do I refresh data and/or redraw chart in highcharts?

I'm implementing a highchart in an ember component in the following way

/controllers/mycontroller.js

  export default Controller.extend({
  chartData:
    [{
      name: 'Impact',
      borderWidth: 2,
      borderColor: '#FFFFFF',
      data: [],
      keys: ['x', 'y', 'v','f', 'i', 'm', 'c', 'g', 'p'],
      dataLabels: {
        enabled: true,
        color: '#000000',
        style:{
          fontSize: 14,
          fontFamily: 'arial',
          textOutline: false
        },
        formatter: function(){
          return this.point.options.feature;
        }
      }
    }],
  chartOptions: computed(function() {
    return {
      chart: {
        renderTo: 'container',
        type: 'mymap',
        events: {
          load: requestData,        -----> function that makes an api call and formats data
          redraw: true
        }

I've enabled the redraw option, but it does not redraw because the load data happens only when the component first loads (land on URL), I think?

So my question is how do I load/redraw data automatically every 60 seconds when the data is being fetched through a function call?




Aucun commentaire:

Enregistrer un commentaire