Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

item label at HoverListener when series with threshold #20

Open
ibaldachini opened this issue Dec 1, 2014 · 2 comments
Open

item label at HoverListener when series with threshold #20

ibaldachini opened this issue Dec 1, 2014 · 2 comments
Assignees
Milestone

Comments

@ibaldachini
Copy link

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);

@nmorel
Copy link
Owner

nmorel commented Dec 6, 2014

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()

@nmorel nmorel closed this as completed Dec 6, 2014
@nmorel nmorel reopened this Dec 6, 2014
@nmorel nmorel self-assigned this Dec 6, 2014
@nmorel nmorel added this to the 3.3.1 milestone Dec 6, 2014
@ibaldachini
Copy link
Author

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().getJsObject("originSeries").getLabel()


Reply to this email directly or view it on GitHub
#20 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants