Point whiskers
Point whiskers
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.
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: Point whiskers
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.
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: Point whiskers
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?
Also, why this renderer is developed specific for date purpose?
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: Point whiskers
If no existing render meets your requirements, won't you have to look at those alternatives?ekta1994 wrote:I don't want to manually draw the line using draw() or by adding annotations.
On review, XYErrorRenderer looks ideal. What was the problem?ekta1994 wrote:I came across XYError renderers for XY plots. But that doesn't seem to be working good.
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:I have normal (x,y) points to be plotted and (x-deltaX -> x+deltaX) to be shown via whiskers.
In the demo, HighLowRenderer appears among the financial charts, all of which appear to involve functions of time.ekta1994 wrote:Why this HighLowRenderer is developed specific for date purpose?
Re: Point whiskers
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.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Point whiskers
Can you post the two charts side by side and explain what looks bad?
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: Point whiskers
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?
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?
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
Re: Point whiskers
Only by writing a new renderer.
Your workaround (returning different value for x, xmin and xmax) looks om to me.
Your workaround (returning different value for x, xmin and xmax) looks om to me.