jqplot:根据窗口宽度更改图例位置

时间:2013-10-15 11:27:58

标签: javascript jqplot

我有一个代码,当窗口改变大小时刷新图表:

$(window).resize(function () {
     plot.replot({ clear: true, resetAxes: false });
});

但我想在小屏幕上移动传奇。这对jqPlot有可能吗?

1 个答案:

答案 0 :(得分:0)

 $(window).resize(function () {
        if (window.innerWidth < 700) { plotgraph.replot({ resetAxes: true, legend: { placement: 'insideGrid', location: "s", rowSpacing: '2px' } }); }
        else { plotgraph.replot({ resetAxes: true, legend: { placement: 'outsideGrid', location: "ne" } }); }
    });
相关问题