Point whiskers

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
ekta1994
Posts: 26
Joined: Fri May 12, 2017 8:06 am
antibot: No, of course not.

Point whiskers

Post by ekta1994 » Thu Jun 01, 2017 10:15 am

I am drawing a scatter plot and need to show ranges in that. Like left and right range. By range, what I mean is, for the current (x,y) point on the scatter plot, i need to draw whiskers i.e. a line from x-(deltaX) to x. I don't want a simple straight line but somewhat like how minimum and maximum values are shows in Box and whisker plots using whiskers. So, this can be imagines as the box and whisker plot with a point instead of the complete box. Which type of chart will be most suitable for this. I don't want to manually draw the line using draw() or by adding annotations.

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: Point whiskers

Post by John Matthews » Thu Jun 01, 2017 11:32 am

You might look at MinMaxCategoryRenderer, discussed here and illustrated here.

Image

ekta1994
Posts: 26
Joined: Fri May 12, 2017 8:06 am
antibot: No, of course not.

Re: Point whiskers

Post by ekta1994 » Thu Jun 01, 2017 12:22 pm

Documentation says "for use with CategoryPlot". I have XY Plot. I cam across XYError renderers for XY plots. But that doesn't seem to be working good.

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: Point whiskers

Post by John Matthews » Thu Jun 01, 2017 10:22 pm


ekta1994
Posts: 26
Joined: Fri May 12, 2017 8:06 am
antibot: No, of course not.

Re: Point whiskers

Post by ekta1994 » Fri Jun 02, 2017 5:12 am

This renderer needs OHLC dataset in which every OHLC data item needs Date on x axis. I have normal (x,y) points to be plotted and (x-deltaX -> x+deltaX) to be shown via whiskers.
Also, why this renderer is developed specific for date purpose?

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: Point whiskers

Post by John Matthews » Fri Jun 02, 2017 8:59 am

ekta1994 wrote:I don't want to manually draw the line using draw() or by adding annotations.
If no existing render meets your requirements, won't you have to look at those alternatives?
ekta1994 wrote:I came across XYError renderers for XY plots. But that doesn't seem to be working good.
On review, XYErrorRenderer looks ideal. What was the problem?
ekta1994 wrote:I have normal (x,y) points to be plotted and (x-deltaX -> x+deltaX) to be shown via whiskers.
An XYErrorRenderer expects an IntervalXYDataset. You could store the bounds, x±deltaX, in the values returned by getStartX() and getEndX(), respectively. Which implementation of IntervalXYDataset did you use?
ekta1994 wrote:Why this HighLowRenderer is developed specific for date purpose?
In the demo, HighLowRenderer appears among the financial charts, all of which appear to involve functions of time.

ekta1994
Posts: 26
Joined: Fri May 12, 2017 8:06 am
antibot: No, of course not.

Re: Point whiskers

Post by ekta1994 » Fri Jun 02, 2017 9:30 am

Yes. I am doing the same for XYErrorRenderer and using XYIntervalSeriesCollection. But the scale on which it plots the point looks very bad. While if I normally plot the points on an XY plot without drawing any error bars, it looks good.

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

Re: Point whiskers

Post by david.gilbert » Fri Jun 02, 2017 3:37 pm

Can you post the two charts side by side and explain what looks bad?
David Gilbert
JFreeChart Project Leader

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

ekta1994
Posts: 26
Joined: Fri May 12, 2017 8:06 am
antibot: No, of course not.

Re: Point whiskers

Post by ekta1994 » Tue Jun 06, 2017 6:33 am

XYErrorRenderer worked. Problem was happening because of custom range setting. I wasn't over riding restoreAutoBounds().
But the other issue I am running into is: The dataset for the renderer is of the form (x, xmin, xmax, Y ) for YIntervalSeries. This draws the error bars from xmin-->x-->xmax. In some cases I only need the right bar and in some cases only left. For left bars, what I do is (x,xmin,x,Y) i.e. Put the value of X only in xmax field. This draws the vertical error line for the right bar on the point itself. Similarly for the right error bar, I put x as xmin. Is there, any why I can tell the renderer not to override?

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: Point whiskers

Post by paradoxoff » Sat Jun 10, 2017 11:55 am

Only by writing a new renderer.
Your workaround (returning different value for x, xmin and xmax) looks om to me.

prize
Posts: 3
Joined: Wed Jun 21, 2017 6:20 pm
antibot: No, of course not.
Contact:

Re: Point whiskers

Post by prize » Wed Jun 21, 2017 6:37 pm

just like tutorial, thx. For me everything is now much much known

Locked