使用Plotly.js创建图不会绘制

时间:2019-06-19 11:46:16

标签: javascript plotly.js

我正在尝试使用plotly绘制简单图形。

在此函数中,我收到2个数组,即fio2和时间,如下所示: fio2 and time

这是我的功能:

function eventgraphFIO2(fio2, time) {

    var FiO2layout = {
        autosize: true,
        margin: { l: 50, r: 50, b: 20, t: 20, pad: 4 },
        color: 'red',
        yaxis: {
          fixedrange:
        },
        xaxis: {
          fixedrange: true
        }
      };


    var dataevent = [{
        x: fio2, // fio2 array, first picture
        y: time, // time array, first picture
        type: 'line'
    }]

   console.log(dataevent); //see second picture

    Plotly.newPlot('ideventGraphFIO2', dataevent, FiO2layout);
}

这是console.log结果:

dataevent

我做错了什么?

当然,当我在x和y中插入数字或字符串时,便会绘制图形。

0 个答案:

没有答案