I am wanting to place a single shape at the point where my linegraph is at its max and (eventually) one where it is at its minimum. In my life graph I have an unknown number of linegraphs at the bottom on the graph representing readings from meters from one datetime to the next and then the totals of those meters for each datetime. I want to mark where the total is at its min and max with a triangle pointing down and up respectively.
Suggestions on how to do this?
To follow myself up, I already know what these values are and where and what datetime they occur. I just need to know how to mark these on the linegraph.
Two shapes plotted on points of a linegraph
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Two shapes plotted on points of a linegraph
If you are using XYLineAndShapeRenderer, the shape displayed for any particular data item is returned by the method:
The default implementation for this just returns one shape per data series, but if you override it you can return a different shape for any data item. You might also need to override getItemShapeVisible() to only show shapes for the two data points you are interested in.
Code: Select all
public Shape getItemShape(int row, int column)
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
Re: Two shapes plotted on points of a linegraph
I resolved this using annotations. I found the high and low and then used the pointers from annotations to mark what I needed: