c3.js 无法加载行值

c3.js cannot load lines value

我post一些代码here.I不知道为什么old_chart中的行值不能更新。 我已经尽我所能 do.So 我希望你们能帮助我解决这个问题。 非常感谢!!

        <script>
    old_chart = c3.generate({
    bindto: '#chart',
     data: {
    columns: []
    },
     grid: {
    x: {
    show: true
    },
     y: {
    show: true,
     lines: []
    }
    }
    });

   $.ajax({type:"GET",
            url:"threshold",
            success: function(result){
              threshold_in_server = JSON.parse(result);
              input_threshold(threshold_in_server);

            }
    });

input_threshold = function(threshold_in_server){

      old_chart.load({
        y: {
              lines: [{value:threshold_in_server[0] },
                      {value:threshold_in_server[1] }]
            }
       });
    };
    </script>
<body>
<div id='chart' style='position:absolute;top:25px'></div>
<>/body

要更新额外的网格线,您应该使用 .ygrids() api 方法, 而不是 .load() :

old_chart.ygrids([{value:threshold_in_server[0] },
                  {value:threshold_in_server[1] }])