gavioto / clientsidegchart

Automatically exported from code.google.com/p/clientsidegchart
0 stars 2 forks source link

Add new annotation location AnnotationLocation.LEFT #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Would like to be able to left justify a label inside a bar symbol.  

1.  AnnotationLocation.CENTER results in annotation centered in the bar
2.  AnnotationLocation.WEST results in annotation to the left of the bar
3.  AnnotationLocation.EAST results in annotation to the right of the bar

Would like an annotation location that results in the label inside the 
horizontal bar, but left justified instead of centered.

Original issue reported on code.google.com by Atlantic...@gmail.com on 15 Jun 2010 at 2:02

GoogleCodeExporter commented 9 years ago
Seems like a good idea. Couple of ways to workaround to get same effect.

You can use setAnnotationXShift and setAnnotationYShift to explicitly position 
the annotations starting from some convenient starting point.

But a trickier but easier approach would be to set the widthUpperBound 
parameter on setAnnotationText or setAnnotationWidget to 0:

   getCurve().getPoint().setAnnotationText("The Annotation", 0, GChart.NAI);
   getCurve().getPoint().setAnnotationLocation(AnnotationLocation.WEST);

Setting the widthupperbound to 0 will force the annotation to extrude to the 
right of the attachment point (centered on the left edge) which should give you 
the effect you are after of inside-left. You may still need to use 
setAnnotationXShift to tweak the position a few pixels.

Original comment by gchartco...@gmail.com on 19 Jun 2010 at 3:40

GoogleCodeExporter commented 9 years ago
That works great!  Thank you so much.

Original comment by Atlantic...@gmail.com on 14 Aug 2010 at 11:17

GoogleCodeExporter commented 9 years ago

Original comment by gchartco...@gmail.com on 29 Aug 2010 at 10:00