Hi Daniel, 

thanks a lot for your message. 

I am not sure I have done what you suggested but I still have my issue. 

Here below you can find my steps.

1) 
I used actual dates in my data table. Since I did not want minutes and 
seconds in my output, I have converted these into the 'Y-m-d' format using 
the line code "$temp[] = array('v' => date('Y-m-d', 
strtotime($r['data'])))" my php script. 

Note that using the line code $temp[] = array('v' => (string) $r['data']) 
instead of the previous one makes seconds and minutes (zero and zero in my 
case) display in my line chart. 

2) 
After this, I have used your tip: 

hAxis: { title: "Days", ticks: [{v: new Date(2018, 5, 10), f:"2018-05-10"}, 
{v: new Date(2018, 5,11), f:"2018-05-11"}] },

While I can see the title, I can not see the chosen ticks. Do you have any 
ideas to make this work?

Thanks a lot. 

Drigo




The ticks option only works with axes that have continuous values, not 
> discrete values.  Since your data is really dates, it would probably be 
> better if you use actual dates in your data table, and then the ticks 
> option should work with dates as well.  
>
> hAxis: { title: "Days", ticks: [{v: new Date(2018, 4, 1), f:"2018-05-10"}, 
>                                             {v: new Date(2018, 4,11), 
> f:"2018-05-11"}] },
>
> Note that month numbers start at 0.
>
> On Wed, May 30, 2018 at 4:33 PM drigo <[email protected] <javascript:>> 
> wrote:
>
>> Hi everybody, 
>>
>> I would need some help in order to use ticks on hAxis when I have strings 
>> on such an axis. 
>> Specifically, i have things like the following: '2018-05-01', 
>> '2018-05-02' etc. 
>>
>> I would like to select few of them only in order to make my x-axis 
>> clearer. 
>>
>> I have found the examples below in the google chart documentation  but 
>> they do not 
>> solve my issue. 
>>
>> Example: 
>>
>>
>>    - hAxis: { ticks: [5,10,15,20] }
>>    - hAxis: { ticks: [{v:32, f:'thirty two'}, {v:64, f:'sixty four'}] }
>>    - hAxis: { ticks: [new Date(2014,3,15), new Date(2013,5,15)] }
>>    - hAxis: { ticks: [16, {v:32, f:'thirty two'}, {v:64, f:'sixty 
>>    four'}, 128] }
>>
>> Following these, I wrote these attempts on my var options but 
>> unfortunately they do not work.  
>>
>> <!--hAxis: { ticks: [ new Date(2018,05,01),Date(2018,05,11) ] },-->
>> <!--hAxis: { title: "Days", ticks: [{f:"2018-05-11", f:"2018-05-11"}] 
>> },-->
>> <!--hAxis:{ticks: [ Date(2018,06,01), Date(2018,05,11) ]},-->
>> <!--hAxis: {ticks: [{f:'2018-05-11'},{f:'2018-05-22'}]},-->
>> hAxis: {ticks: ['2018-05-11','2018-05-22']},
>>
>> Any idea to fix this issue?
>>
>> Thanks in advance. 
>>
>> Drigo
>>  
>>
>>
>>
>>
>> -- 
>> 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] 
>> <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> 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/b4c344a1-6323-46ad-8c85-e73312cfef1a%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/google-visualization-api/b4c344a1-6323-46ad-8c85-e73312cfef1a%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] <javascript:>   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 [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/118da9e8-0292-4618-8554-7eaddd0ac4ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to