Couple of things that may help you:

1) To allow more space for long axis labels and thus avoid the
"overwriting" problem you mentioned in the first place, you can
explicitly set axis label thickness via Client-side GChart's
setAxisLabelThickness method:

http://gchart.googlecode.com/svn/trunk/doc/com/googlecode/gchart/client/GChart.Axis.html#setAxisLabelThickness%28int%29

2) A simple way to add "vertical" (sort of) text is by using HTML
within setAnnotationText. This snippet should display the word "price"
vertically:

getCurve().getPoint().setAnnotationText
("<html><center>p<br>r<br>i<br>c<br>e</center>");

BTW, same trick works with the setAxisLabel, and addTick methods.

If you have trouble getting stuff to align right, try using a mono-
spaced font (e.g. surrounding the text with <tt></tt>). Likely there
are better HTML vertical text tricks out there, but this is the only
one I know.

Note the importance of the <html> prefix, otherwise GChart treats
everything as plain text. Here's the setAnnotationText method's
javadocs for reference:

http://gchart.googlecode.com/svn/trunk/doc/com/googlecode/gchart/client/GChart.Curve.Point.html#setAnnotationText%28java.lang.String,%20int,%20int%29

3) If you have any GWT Widgets handy that can display true vertical
text (or you can create one) then you can use GChart's
setAnnotationWidget to display that text via such a Widget. It seems
there ought to be such a widget, somewhere out there...if you know of
one, please post back. If you can't find or build such a Widget you
could of course use an image of the text you wanted and an Image
widget. Here's the setAnnotationWidget's javadoc:

http://gchart.googlecode.com/svn/trunk/doc/com/googlecode/gchart/client/GChart.Curve.Point.html#setAnnotationWidget%28com.google.gwt.user.client.ui.Widget,%20int,%20int%29

GChart's addTick method also supports widgets.

Finally, don't overlook the setAnnotationXShift and
setAnnotationYShift methods for fine tuning the positions of your
annotations.

Vertical text is a valuable feature that other chart libraries I've
seen support directly, and I'd definitely consider adding it (if I
could get a clue as to how to do it). On the other hand, a Widget-
based solution to this problem keeps GChart simpler, and (in theory)
should make it easier to swap in alternative vertical-text-rendering
approaches.

Appreciate your question, HTH/HNY

John C. Gunther
http://gchart.googlecode.com

On Jan 1, 1:09 am, ArunDhaJ <[email protected]> wrote:
> Hi,
> I'm using gchart to generate Bar Charts for my application, and using
> GWT 1.4.62.
>
> The Axis label gets overridden by the adjacent labels when the text is
> very long. So, I thought to use setAnnotationText to set the labels
> within the bar itself. It shows horizontally, but I need the text to
> be displayed vertically over the bar of the chart.
> How can I display it?
>
> Regards,
> ArunDhaJwww.arundhaj.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to