need help for bar graph

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
kapilsharma
Posts: 5
Joined: Thu Oct 25, 2007 4:29 pm
Location: India
Contact:

need help for bar graph

Post by kapilsharma » Thu Oct 25, 2007 4:35 pm

hi,
i would be very grateful if someone can guide me how to fix my problem.
i am creating a bar chart with jfreechart which is coming fine except for the base items. i mean the labels at the bottom of each bar.
for a big text like MY_BIG_COMPANY_NAME
it shows MY_BIG_CO...
can i get the full text here.

thanks,
Kapil

nuclex
Posts: 2
Joined: Thu Oct 25, 2007 4:19 pm

Post by nuclex » Thu Oct 25, 2007 4:47 pm

Try setting the item margin:

Code: Select all

renderer.setItemMargin(0.5);

kapilsharma
Posts: 5
Joined: Thu Oct 25, 2007 4:29 pm
Location: India
Contact:

Post by kapilsharma » Thu Oct 25, 2007 5:07 pm

this doesn't seem to work.
i tried with much larger values for margin as well.
thanks for trying.

Priya Shivapura
Posts: 59
Joined: Fri Feb 23, 2007 7:41 am

Post by Priya Shivapura » Thu Oct 25, 2007 5:50 pm

If you are using the CategoryAxis, you can set the maximum number of label lines like this

Code: Select all

categoryAxis.setMaximumCategoryLabelLines(2);
Now, the labels will use 2 lines instead of one.

Regards,
Priya

kapilsharma
Posts: 5
Joined: Thu Oct 25, 2007 4:29 pm
Location: India
Contact:

Post by kapilsharma » Thu Oct 25, 2007 7:09 pm

this is how i am getting my chart
JFreeChart chart = ChartFactory.createBarChart("MyChart","countryPreference","Volume",dataset,PlotOrientation.VERTICAL,true,false,false);

in the dataset
dataset.addValue(currentRow.getCol3(), "",currentRow.getCol1());

currentRow.getCol1() Value is displayed below each graph.
this get trimmed to a short text with "..." to indicate incomplete text.

i need full text here.
can someone please guide me on how to achieve this

kapilsharma
Posts: 5
Joined: Thu Oct 25, 2007 4:29 pm
Location: India
Contact:

Post by kapilsharma » Thu Oct 25, 2007 7:48 pm

what is a tooltip in bargraph?

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 » Fri Oct 26, 2007 5:00 pm

kapilsharma wrote:i need full text here.
can someone please guide me on how to achieve this
Did you try the suggestion about calling setMaximumCategoryLabelLines()? T hat's what I would have suggested. Also, you can try rotating the category labels by 90 degrees.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

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 » Fri Oct 26, 2007 5:02 pm

kapilsharma wrote:what is a tooltip in bargraph?
A tooltip is a small text item in a box that appears in a client app user interface when the mouse pointer hovers over something for a short time. The ChartPanel class will display tooltips for some of the items in a chart (such as the bars) if they've been configured in the renderer.

If you are a server-side developer, your users can also see these tooltips in a web browser if you create an HTML image map to go along with a chart image.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked