Crosshair values

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
karolinas
Posts: 5
Joined: Fri Mar 25, 2016 3:32 pm
antibot: No, of course not.

Crosshair values

Post by karolinas » Thu Oct 27, 2016 2:55 pm

Hello, I was wondering whether it is any how possible to get the Y value from the series plotted, for a given DomainCrosshair? I don't particularly want to use the CrosshairOverlay, as I use my custom defined plot, where I have a grid of XY charts on a single ChartPanel, and I need the crosshairs defined for each chart in that grid. :?:

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Crosshair values

Post by david.gilbert » Thu Oct 27, 2016 5:17 pm

The DatasetUtilities class has the following method that returns the y-value for a given x-value:

Code: Select all

public static double findYValue(XYDataset dataset, int series, double x);
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked