每1秒包含json数据的动态 highcharts

niknxzdl  于 2022-11-11  发布在  Highcharts
关注(0)|答案(1)|浏览(133)

我有如下的json_data

[{"n":"0","y":"450","prediction_value":"449.191"},{"n":"1","y":"451.117","prediction_value":"451.259"},{"n":"2","y":"354.17","prediction_value":"354.352"},{"n":"3","y":"439.781","prediction_value":"439.939"},{"n":"4","y":"451.436","prediction_value":"451.611"},{"n":"5","y":"448.935","prediction_value":"448.991"},{"n":"6","y":"451.935","prediction_value":"451.806"},{"n":"7","y":"370.045","prediction_value":"369.802"},{"n":"8","y":"447.232","prediction_value":"447.231"},{"n":"9","y":"410.612","prediction_value":"410.873"},{"n":"10","y":"423.815","prediction_value":"423.923"},{"n":"11","y":"451.707","prediction_value":"451.867"},{"n":"12","y":"425.391","prediction_value":"425.287"},{"n":"13","y":"395.942","prediction_value":"395.905"},{"n":"14","y":"436.397","prediction_value":"436.682"},{"n":"15","y":"405.184","prediction_value":"405.027"},{"n":"16","y":"372.175","prediction_value":"372.128"}]

我想画两种类型的图形

  • 第一个图有X=n,Y=y,所以y=f(n)
  • 第二个图具有X=n,且Y=预测值,因此预测=f(n)

如何在同一个面板中绘制两个 highcharts ?

jogvjijk

jogvjijk1#

例如,要绘制两种类型的图表,您可以添加两个系列。

series: [{
      data: [4, 3, 5, 6, 2, 3]
    },
    {
      type: 'column',
      data: [4, 3, 5, 6, 2, 3].reverse()
    }
  ]

演示:https://jsfiddle.net/BlackLabel/4b6g9doy/
关于从json加载数据,您可以在这里找到:使用json预处理数据
动态载荷数据:https://www.highcharts.com/demo/stock/dynamic-update
但是这个例子是JavaScript相关的,你需要找到一种方法把它移植到python上。

相关问题