My customer wants a XY-Line chart with at least 3 sets of data. That is no problem, but they want each dot on the chart labeled with the domain name. So, for all the points that belong to Series 1, they want a "1" by each point.
Is this even possible to do with JFreeChart? Does anyone have an idea on how to move toward it? Looking through the javadocs and the Developer's Guide yields little on this.
Domain Type labels on points
It never fails . . . I ask the question, and then I stumble on it in the javadocs:
I can probably figure out how to align the annotations with the point in some programmic manner
Code: Select all
XYTextAnnotation note = new XYTextAnnotation("1",5,5.2);
plotdata.addAnnotation(note);
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
That is one way to do it. If you are labelling every point, then you might want to customise the renderer to draw the labels, that way it will be easier to work out where to put the labels. (Shortly I will be adding "item labels" to the XYItemRenderer classes, to work the same way as the item labels for the CategoryItemRenderer classes).
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Customizing the renderer would be a wondeful idea . . . . but I decided not to look too deep renderer code.
Here is a method that works for me. I used an x-offset of 0.1. You may have to adjust this to your own need.
http://users.binary.net/thehaas/blogfil ... Notes.html
Here is a method that works for me. I used an x-offset of 0.1. You may have to adjust this to your own need.
http://users.binary.net/thehaas/blogfil ... Notes.html