Hi, I'm a JFreeChart user and I love this library, but I need to know how to change the shapes size dinamically, when change the chart zoom.
Thanxs!!! Great Library!!
Change Shapes size dinamically
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
It isn't supported. I'm not even sure how I'd go about this...maybe you could have the renderer scale the shape according to the current axis range?
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
OK, if you look in the XYLineAndShapeRenderer class (if that's the one you are using) at the drawSecondaryPass() method, you'll see where a Shape is fetched and translated into position...at that point, you could add some code to scale the shape as well (scaling it before it is translated would be easiest).
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 pm
You could also have a look at the XYBlockRenderer. That renderer allows to set a "blockWidth" and "blockHeight" that are defined in data coordinates, i.e. the width/height are added to the x/y coordinate of the given data point before it is transferred from data space to java2D space. In other words, the blocks will get bigger if you zoom in.
The entire JFreeChart sourcecode is available online. If you go to the API docs (e. g. the main page of the XYBlockRenderer), you will see that the name of the class (i.e. the word "BlockRenderer" in the line "public class XYBlockRenderer") is a link, and this directly brings you to the source code.
The entire JFreeChart sourcecode is available online. If you go to the API docs (e. g. the main page of the XYBlockRenderer), you will see that the name of the class (i.e. the word "BlockRenderer" in the line "public class XYBlockRenderer") is a link, and this directly brings you to the source code.