You can get the range of data with getColumnRange() (
https://developers.google.com/chart/interactive/docs/reference#DataTable_getColumnRange
)
and then compute the ticks you need from that.  You'll probably want to
round up the range to the nearest multiple of 1, 2, or 5 times a power of
10.

We should offer a way to specify a tick formatting function, so you could
simply use the absolute value of whatever ticks are computed based on your
data.

On Wed, Oct 19, 2016 at 12:22 PM, Ricky Costa <rickycost...@gmail.com>
wrote:

> Hey Daniel,
>
> This works, but the problem is that my ticks are dynamic because my values
> changes every minute. I am getting the values from a ajax request to a
> server.
> Doing this, my ticks will always have the same values and won´t match the
> values of the bars.
>
> Any way of dong this dynamically? I can´t share directly the code because
> this project its not personal :(. I wish i could, would be much easier for
> you and for me.
>
> Regards,
>
> terça-feira, 18 de Outubro de 2016 às 16:23:31 UTC+1, Daniel LaLiberte
> escreveu:
>>
>> You can specify a set of tick values and how they will be displayed, if
>> that is your concern.  e.g.
>>
>>   hAxis: { ticks: [{v: -15000, f: '15,000'}, {v: -10000, f: '10,000'},
>> {v: -5000, f: '5,000'}, {v: 0, f: '0'}, {v: 5000, f: '5,000'}] }
>>
>> Here is an example: https://jsfiddle.net/dlaliberte/wctwnro5/3/
>>
>> It might be simpler if you could point me to your web page, or set up an
>> example on jsfiddle.
>>
>>
>> On Tue, Oct 18, 2016 at 11:09 AM, Ricky Costa <rickyc...@gmail.com>
>> wrote:
>>
>>> Hi Daniel,
>>>
>>> Thank you for your example. Maybe i am not exposing corrrectly my issue,
>>> i am new with this, sorry! Basically my problem its with the ticks and i
>>> tried solve it with all this values conversion and direction thing. What i
>>> am trying to solve its the following:
>>>
>>>
>>> <https://lh3.googleusercontent.com/-Qs8Q_VcBVcs/WAY6Zh7RI4I/AAAAAAAAAOs/LrpYgyr9pVMpM6AXh1oonHPoeBZcqRFnwCLcB/s1600/expensiveChart1.png>
>>>
>>>
>>> <https://lh3.googleusercontent.com/-lZF_5DdxRBA/WAY6czFctsI/AAAAAAAAAOw/-Eta1IGnWtk_9PzrBh6441xC6iL68FtuwCLcB/s1600/expensiveChart1b.png>
>>> I am using a animation during my charts draw. During that animation my
>>> ticks for the negative values are negatives..but i want them so be
>>> positive. Basically i want to have bars to the left and right (to negative
>>> and positive values) but with positive values for the ticks. Check my
>>> images please. The first image, to the left bars the ticks are negative
>>> during the animation. When the animation finish, the ticks get the values
>>> that i want (2nd image). I want always have the values like they are shown
>>> on second image, even during the animation.
>>> Its that possible? Any idea i can i change this behavior?
>>>
>>> Thank you very much for be trying to help!
>>> Regards,
>>>
>>> terça-feira, 18 de Outubro de 2016 às 15:38:18 UTC+1, Daniel LaLiberte
>>> escreveu:
>>>>
>>>> Hi Ricky,
>>>>
>>>> Check this example out that reproduces your problem:
>>>> https://jsfiddle.net/dlaliberte/wctwnro5/
>>>> Then uncomment the viewWindow line and you will see that it does work
>>>> correctly.
>>>>
>>>> On Tue, Oct 18, 2016 at 3:59 AM, Ricky Costa <rickyc...@gmail.com>
>>>> wrote:
>>>>
>>>>> Hey Daniel,
>>>>>
>>>>> Thank you for your answer.
>>>>>
>>>>> If i apply my original values and don´t revert the direction, this
>>>>> issue don´t happen. So i don´t think that the problem its not enough space
>>>>> :/. Its weird because this only happens when i change the direction of the
>>>>> bars!
>>>>>
>>>>> Regards,
>>>>>
>>>>> segunda-feira, 17 de Outubro de 2016 às 15:21:54 UTC+1, Daniel
>>>>> LaLiberte escreveu:
>>>>>>
>>>>>> Hi Ricky,
>>>>>>
>>>>>> It appears the annotation for the top bar is dropped down,
>>>>>> erroneously, perhaps because the code thinks it is too close to the top.
>>>>>> Maybe arrange that there is more space on the top by using a
>>>>>> vAxis.viewWindow.max of, say, 8000.
>>>>>>
>>>>>> On Mon, Oct 17, 2016 at 7:50 AM, Ricky Costa <rickyc...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hello,
>>>>>>>
>>>>>>> I am working on some google charts. In one of those charts i am
>>>>>>> using a Bar Chart. I have negative and positive values, so i have bars 
>>>>>>> to
>>>>>>> the right (positive) and bars to the left (negative), but i am having 
>>>>>>> the
>>>>>>> ticks with negative values for the left bars. So i decided turn my 
>>>>>>> positive
>>>>>>> values to negative, my negative values to positive and apply the 
>>>>>>> direction:
>>>>>>> -1 to get the bars to the correct direction and without negative ticks. 
>>>>>>> But
>>>>>>> i am getting an issue with one of my annotations...it appears in the
>>>>>>> incorrect position. Its visible in the image. Any idea what is going on 
>>>>>>> and
>>>>>>> how to fix it? Or a better solution for what i am trying to do?
>>>>>>>
>>>>>>> Thanks,
>>>>>>>
>>>>>>>
>>>>>>> <https://lh3.googleusercontent.com/-la6MaC5QjV4/WAS6nGqvALI/AAAAAAAAAOU/4VCmJcElWgoMSs-cQLTkWWCgPtHsUekNACLcB/s1600/annotationIssue.png>
>>>>>>> Best regards for you all.
>>>>>>>
>>>>>>> --
>>>>>>> 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 google-visualization-api+unsub
>>>>>>> scr...@googlegroups.com.
>>>>>>> To post to this group, send email to google-visua...@googlegroups.c
>>>>>>> om.
>>>>>>> Visit this group at https://groups.google.com/grou
>>>>>>> p/google-visualization-api.
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/google-visualization-api/
>>>>>>> e6cd39f8-e820-4533-bf6b-1c5f4485d46b%40googlegroups.com
>>>>>>> <https://groups.google.com/d/msgid/google-visualization-api/e6cd39f8-e820-4533-bf6b-1c5f4485d46b%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>
>>>>>> dlali...@google.com   5CC, 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 google-visualization-api+unsubscr...@googlegroups.com.
>>>>> To post to this group, send email to google-visua...@googlegroups.com.
>>>>> Visit this group at https://groups.google.com/grou
>>>>> p/google-visualization-api.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/google-visualization-api/
>>>>> 72bdc51f-9943-4afc-93b0-34daf8982cde%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/google-visualization-api/72bdc51f-9943-4afc-93b0-34daf8982cde%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>
>>>> dlali...@google.com   5CC, 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 google-visualization-api+unsubscr...@googlegroups.com.
>>> To post to this group, send email to google-visua...@googlegroups.com.
>>> Visit this group at https://groups.google.com/grou
>>> p/google-visualization-api.
>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>> gid/google-visualization-api/08a55033-a5c2-44c7-babb-52c059
>>> 86ddc6%40googlegroups.com
>>> <https://groups.google.com/d/msgid/google-visualization-api/08a55033-a5c2-44c7-babb-52c05986ddc6%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>
>> dlali...@google.com   5CC, 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 google-visualization-api+unsubscr...@googlegroups.com.
> To post to this group, send email to google-visualization-api@
> googlegroups.com.
> 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/20edac1e-fafe-4c2e-bfcf-
> fd6de7e49747%40googlegroups.com
> <https://groups.google.com/d/msgid/google-visualization-api/20edac1e-fafe-4c2e-bfcf-fd6de7e49747%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>
dlalibe...@google.com <dlalibe...@google.com>   5CC, 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 google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
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/CAOtcSJOh8%2BdHwm-bstLf42QYy7MWeeOO%3DAa%2B-NMBfyy6c1ZtHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to