If you use the annotations.alwaysOutside option, you'll see where
annotations end up when they don't fit inside the bar.

I'm not finding any explicit padding for when the position of the
annotation is outside the bar, so I believe it is just based on the font
size and the number of lines of annotation text, such that the bottom of
the text is just above the top of the bar.   For the inside position, there
is a hard-coded minimum margin of 2 pixels between the top of the bar and
the top of the annotation text.

On Thu, Jan 10, 2019 at 10:51 AM JENNIFER WOODSON <
[email protected]> wrote:

> Hi Daniel,
>
> Thank you for your response. I can adjust the size some, but not enough to
> fix the issue.
>
> Is there anything you can tell me about how far the annotations are moved
> when they don't fit inside the bar? i.e., can you tell me anything about
> how the offset is calculated?
>
> I'm already manipulating the x coordinate, but it gets shifted when it
> doesn't fit inside the bar. I don't mind to do a little more math to get
> the label where I need it, and any information about how and where the
> annotation is moved would help with precision.
>
> Thanks,
> Jennifer
>
> On Tuesday, January 8, 2019 at 6:47:32 PM UTC-7, Daniel LaLiberte wrote:
>>
>> Hi Jennifer
>>
>> The implicit rules for deciding whether to move an annotation out of the
>> bar are based on whether it can fit inside the bar, and there is no
>> override to force it to draw inside the bar regardless.
>>
>> The collision between annotations is unfortunate, and I have been working
>> on strategies for automatically moving annotations around so they avoid
>> collision.  I'm not sure when that will be available.
>>
>> Your best workaround might be to make all the annotations smaller, if
>> that works at all.
>>
>> On Tue, Jan 8, 2019 at 5:11 PM JENNIFER WOODSON <[email protected]>
>> wrote:
>>
>>> Are the rules for positioning/placing annotations on bar charts
>>> documented anywhere? Specifically, on a stacked bar chart, what are the
>>> rules Google uses for positioning an annotation when the annotation is
>>> wider than the bar? If a bar is not wide enough for the annotation, Google
>>> moves it. I'd like to know the rules for this and how to circumvent them.
>>>
>>> I'm using a mutation observer to center annotations on the bars of a
>>> stacked bar chart (see this StackOverflow post
>>> <https://stackoverflow.com/questions/43845104/moving-google-chart-column-annotation-position>).
>>> This works well, except for when a bar is not wide enough to fit the
>>> annotation. When Google moves the label, it collides with the next one. I'd
>>> like to override Google's defaults to prevent annotations from overlapping.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Google Visualization API" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at
>>> https://groups.google.com/group/google-visualization-api.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/google-visualization-api/8718df8b-6812-4174-8bb2-979ee2b862d0%40googlegroups.com
>>> <https://groups.google.com/d/msgid/google-visualization-api/8718df8b-6812-4174-8bb2-979ee2b862d0%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
>> [email protected]   Cambridge MA
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Visualization API" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to
> [email protected].
> Visit this group at
> https://groups.google.com/group/google-visualization-api.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-visualization-api/d4bb608d-e9ea-4007-8a43-2eea58202c16%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/d4bb608d-e9ea-4007-8a43-2eea58202c16%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
[email protected] <[email protected]>   Cambridge MA

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJMUxcpFHdbZMLx1JoP2%2BiYe%2BX8S3VDkSQ9fqdh56TYM0w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to