javascript - Plotly.relayout() 给出错误

标签 javascript jquery plotly

[已解决]

我正在使用plotly来绘制我的图表。当我调整浏览器窗口的大小时,我使用下面的代码来调整我的绘图图的大小。

  $(window).resize(function() {
     var divheight = $("#section").height();
     var divwidth = $("#section").width();

     var update = {
              width:divwidth,  // or any new width
              height:divheight // " "
            };

    Plotly.relayout('section', update);

        }).resize();

但是,当我尝试运行代码时,我在控制台中收到以下错误。

plotly-basic.js:17 Uncaught bad container

PS:我使用flask作为后端,使用Javascript、HTML来显示绘图

有人可以帮我吗:(

最佳答案

[已解决]

好吧,我在创建图表之前尝试使用“Plotly.relayout()”:)纠正它并且错误消失了:)

关于javascript - Plotly.relayout() 给出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37698145/

相关文章:

javascript - 在 iframe 中编辑 block

javascript - Angular指令参数长度限制

javascript - 从 AJAX 返回 JSON 对象获取某些值

python - Plotly 无法正确显示 y 轴标签

javascript - 变量声明是否与变量的绑定(bind)相同?

jquery - HTML5 声音插件?

javascript - 防止 .ajaxStart() 在特定的 Ajax 请求上执行

javascript - 使用 Plotly 定义饼图切片颜色

python - Plotly:如何设置分组子图?

javascript - TypeError : nodemailer. createTransport 不是一个函数