A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
nilesh
- Posts: 20
- Joined: Wed May 21, 2003 10:56 am
-
Contact:
Post
by nilesh » Thu Mar 18, 2004 5:17 am
in pieplot.java at drawLabel() function, there is code
Code: Select all
if (this.sectionLabelType == NAME_AND_VALUE_LABELS) {
label = data.getKey(section).toString()
+ " (" + valueFormatter.format(value) + ")";
}
which displays label as:
name(value)
I need to display label in two lines
like:
name
value
Please david help me how to do it ? what changes i need to make ?
Thank you
-
david.gilbert
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
-
Contact:
Post
by david.gilbert » Thu Mar 18, 2004 10:11 am
I would insert a '\n' for the line break then make two further modifications:
(1) Find the code that draws the label and modify it to use a TextBlock;
(2) In the TextUtilities class, change the code that creates a TextBlock from a string so that it scans the string looking for line breaks.
Bear in mind that the pie chart labelling has been changed around quite a lot in the 0.9.17 release (which is due out soon). The new release doesn't do exactly what you want, but it does support label wrapping. You might want to grab the latest source files from CVS....