In my project I declare some y-axes (temperature, humidity, etc) for line-charts. but I can show\hide some of the series.
I want to highlight the y-axes of tooltip item only if there are some y-axes on the screen
I thought I could use
var isMultyYaxes = ( $(".flot-y-axis").length > 1 );
if (isMultyYaxes) {
$(".y" + item.series.yaxis.n + "Axis").addClass("myActiveAxis");
}
but it seems there are duplicate y-axes in $(".flot-y-axis").
Should I use -
var isMultyYaxes = ( $(".flot-y-axis").length > 2 );
Is there another way to determine how many y-axes are currently used?
If you have stored a reference to your plot-object (with
var plot = $.plot(...);
) then you can get the options and the axes like this:Then you can check if the axes are shown like this: