Re: Multiple Yaxes doesn't work with selection plug-in

54 views
Skip to first unread message

Ced

unread,
May 18, 2013, 1:41:36 PM5/18/13
to flot-...@googlegroups.com
The reason this happens is because selecting an area on the plot applies only to the first y- axis.  Once you zoom in, the data on the second y-axis is outside your selected range.

The only acceptable solution I have found personally is to limit zooming to x-axis only.


On Tuesday, May 7, 2013 4:24:03 PM UTC-7, Jin Young Kim wrote:
Hi, all.

I'm trying to make zoom work with plot with multiple yaxes, and here's the yaxes code I adopted from selection plugin example:

$(plot_div).bind("plotselected", function (event, ranges) {
var option_new = $.extend(true, {}, options, {
xaxis: {
min: ranges.xaxis.from,
},
yaxes: [{min:ranges.yaxis.from, max:ranges.yaxis.to, position:"left"}, 
{min:ranges.yaxis.from, max:ranges.yaxis.to, position:"right"}, 
{min:ranges.yaxis.from, max:ranges.yaxis.to, position:"right"}]
})
plot = $.plot($(plot_div), series, option_new)
});


But the points from second yaxes disappear when I zoom in. It doesn't happen if I zoom in for x-axis only.



$(plot_div).bind("plotselected", function (event, ranges) {
var option_new = $.extend(true, {}, options, {
xaxis: {
min: ranges.xaxis.from,
})
plot = $.plot($(plot_div), series, option_new)
});

I tried using yaxis parameter instead of yaxes, but the results are the same.

Any thoughts? 

Ced

unread,
Aug 13, 2013, 1:16:35 AM8/13/13
to flot-...@googlegroups.com
Recently needed to actually solve this problem.  Here's the solution:

$('#placeholder').bind("plotselected", function (event, ranges) {
  $.plot(placeholder, data, $.extend(true, {}, options, {

    xaxis: {min: ranges.xaxis.from,    max: ranges.xaxis.to},
    yaxes: [{min: ranges.yaxis.from, max: ranges.yaxis.to},
      {min:ranges.y2axis.from, max: ranges.y2axis.to}]
  }));
});
Reply all
Reply to author
Forward
0 new messages