I have seen a few post about this but no one seems to have a solution. Does anyone know if it is possible to change the size of the shapes that are drawn on a series. I am using an XYLineAndShape renderer, I want to change the size of specific shapes in a series, is this possible?
Thank you.
Changing the size of shapes that are drawn
-
- Posts: 26
- Joined: Thu Jun 07, 2007 10:07 pm
-
- Posts: 26
- Joined: Thu Jun 07, 2007 10:07 pm
impossible?
Do you mean you want to change the size of all of the shapes of a series or that you want a few shapes in a series to be changed?
If you want to change all shapes you can use setShape and pick a new shape to use.
Or if you want only a few points in a series to big bigger than the others you could subclass the XYLineAndShapeRenderer. I did that when I wanted a series that could change color in the middle of the series, and change shape as well.
Do you mean you want to change the size of all of the shapes of a series or that you want a few shapes in a series to be changed?
If you want to change all shapes you can use setShape and pick a new shape to use.
Code: Select all
XYItemRenderer renderer = new StandardXYItemRenderer(StandardXYItemRenderer.SHAPES_AND_LINES);
plot.setRenderer(0,renderer);
renderer.setShape(new Rectangle(-3,-3,6,6));
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
It's not impossible. Subclass the renderer and override getItemShape(int, int) to return whatever shape you want for any given item.superfield wrote:Nevermind, I just read a post where David said it's impossible
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- Posts: 14
- Joined: Wed Sep 12, 2007 7:05 pm
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Only because the 'autoPopulateSeriesShape' flag defaults to true. If you set this to false, the renderer will use the baseShape if no series shape is specified (rather than doing an automatic lookup on the current DrawingSupplier).lucas luky wrote:but if ure reading this and using JF1.0.6, DONT try to use the "setBaseShape" method. it simply doesnt work.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

