Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/475.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
每次加载第二个数组时更新图表:Highcharts,Javascript_Javascript_Mysql_Highcharts - Fatal编程技术网

每次加载第二个数组时更新图表:Highcharts,Javascript

每次加载第二个数组时更新图表:Highcharts,Javascript,javascript,mysql,highcharts,Javascript,Mysql,Highcharts,所以,我在MySQL中有一个条件,首先显示前1000个数据点,然后在Highcharts中显示其他2000个数据点 if lastindex==0: cur.execute("SELECT data,value FROM table where id<1001") else: cur.execute("SELECT data,value FROM table where id>1001 and id<3000")

所以,我在MySQL中有一个条件,首先显示前1000个数据点,然后在Highcharts中显示其他2000个数据点

if lastindex==0:
            cur.execute("SELECT data,value FROM table where id<1001")
        else:
            cur.execute("SELECT data,value FROM table where id>1001 and id<3000")
        data = cur.fetchall()  
//python Code to fetch SQL data
我想要的只是附加事件数据,而不是加载整个图表


如何在不重新加载整个图表的情况下重新加载特定的Highchart值?

如何使用新数据更新当前序列,这些数据将是与新数据合并的旧数据数组

  chart: {
    events: {
        load(){
             let chart = this,
                 currentSeries = chart.series[0],
             newData;
             newData = [...currentSeries.userOptions.data, ...data1]

                setTimeout(()=> {
                chart.series[0].update({
                data: newData
              })
            }, 5000)
      }
    }
  },

请参见

如果我只想定义一次图表,并动态加载数据更新时的事件,以便我的图表不再从0开始,该怎么办?您可以使用setInterval功能(设置超时除外)并执行类似操作。图表从0开始。我不知道你想触发这个操作多少次,但是你也应该考虑一些条件,因为很多点都会破坏你的图表。演示:
  chart: {
    events: {
        load(){
             let chart = this,
                 currentSeries = chart.series[0],
             newData;
             newData = [...currentSeries.userOptions.data, ...data1]

                setTimeout(()=> {
                chart.series[0].update({
                data: newData
              })
            }, 5000)
      }
    }
  },