gflot
gflot copied to clipboard
item label at HoverListener when series with threshold
When hovering on plot series with threshold, item.getSeries().getLabel() is null if hovering on values lower than threshold, is correct ("db" in this example) if hovering on valus bigger than threshold.
// create series with label and threshold Series.create().setLabel("db").setThreshold(Threshold.create().setBelow(1.5).setColor("#ff0000")).setColor("#0000ff");
// add hover listener plot.addHoverListener(new PlotHoverListener() { @Override public void onPlotHover(Plot plot, PlotPosition position, PlotItem item) { item.getSeries().getLabel(); } }, true);
Hello,
From the documentation of threshold plugin :
Internally, the plugin works by splitting the data into two series, above and
below the threshold. The extra series below the threshold will have its label
cleared and the special "originSeries" attribute set to the original series.
You may need to check for this in hover events.
Since I didn't add a getter to originSeries
in Series
object, you have to get it manually :
item.getSeries().<Series>getJsObject("originSeries").getLabel()
OK. Thanks for the answer! Il 06/dic/2014 09:12 "Nicolas Morel" [email protected] ha scritto:
Hello,
From the documentation of threshold plugin :
Internally, the plugin works by splitting the data into two series, above and below the threshold. The extra series below the threshold will have its label cleared and the special "originSeries" attribute set to the original series. You may need to check for this in hover events.
Since I didn't add a getter to originSeries in Series object, you have to get it manually :
item.getSeries().<Series>getJsObject("originSeries").getLabel()
— Reply to this email directly or view it on GitHub https://github.com/nmorel/gflot/issues/20#issuecomment-65889597.