I am new in jQuery flot, I have two charts I want to connect the two for zoom and selection functionality,
Code:
// 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);
});
Please see the demo :
My chart displays the data correctly but I feel for connecting both two I am doing some mistake.
$.plot("#time_chart", time_series,
$.extend(true, {}, options, {
while passing time_series
.
Please help me.
After some corrections it works, see the updated fiddle.
Changes:
Adding http://www.flotcharts.org/flot/jquery.flot.selection.js
to External Resources.
$.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, {