jquery flot zoom 选择不适用于图表

jquery flot zoom selection is not working for to charts

我是 jQuery flot 的新手,我有两个图表我想连接两个图表以实现缩放和选择功能,

代码:

      // now connect the two

  $("#time_chart").bind("plotselected", function(event, ranges) {

    // clamp the zooming to prevent eternal zoom

    if (ranges.xaxis.to - ranges.xaxis.from < 0.00001) {
      ranges.xaxis.to = ranges.xaxis.from + 0.00001;
    }

    if (ranges.yaxis.to - ranges.yaxis.from < 0.00001) {
      ranges.yaxis.to = ranges.yaxis.from + 0.00001;
    }

    // do the zooming

    plot = $.plot("#time_chart", time_series,
      $.extend(true, {}, options, {
        xaxis: {
          min: ranges.xaxis.from,
          max: ranges.xaxis.to
        },
        yaxis: {
          min: ranges.yaxis.from,
          max: ranges.yaxis.to
        }
      })
    );

    // don't fire event on the overview to prevent eternal loop

    time_overview.setSelection(ranges, true);
  });

  $("#time_overview").bind("plotselected", function(event, ranges) {
    plot.setSelection(ranges);
  });

请看演示:

http://jsfiddle.net/w47agnq2/

我的图表正确显示了数据,但我觉得将两者联系起来是我做错了。

$.plot("#time_chart", time_series,
          $.extend(true, {}, options, {

同时通过 time_series

请帮帮我。

经过一些更正后它起作用了,请参阅 updated fiddle

变化:

正在将 http://www.flotcharts.org/flot/jquery.flot.selection.js 添加到外部资源。

$.plot($("#time_chart"), [time_series], time_options);
var plot = $.plot($("#time_chart"), [time_series], time_options);

plot = $.plot("#time_chart", time_series,
plot = $.plot("#time_chart", [time_series],

$.extend(true, {}, options, {
$.extend(true, {}, time_options, {