Dear Daniel,

Thank you for the cleanning. I am sorry if you find many mistakes.

In fact, to draw this chart I followed this document where datatable is a
matrix where the first coloum must be a string:
https://developers.google.com/chart/interactive/docs/points#fullhtml

However,before using ajax and json (for the dropdown event), I put my data
in a php function and then I call it back in my web page and I can get both
axis in logscale. Unfortunatly, it doesn't work using json format. here is
the output.

Thank you


[image: Inline image 1]



On Wed, Feb 3, 2016 at 3:02 PM, 'Daniel LaLiberte' via Google Visualization
API <[email protected]> wrote:

> There are several errors in that jsfiddle, but most are irrelevant the
> problem with the log scale.  The reason you are not seeing log scale is
> your first column (number 0) of data is strings, even though they are
> strings with numbers in them.
>
> The other problems involve your multiple loading of jsapi, together with
> the www.gstatic.com/charts/loader.js.  Use one or the other, but not
> both.  I cleaned it up for you here:  https://jsfiddle.net/ug3ogx0v/1/
>
>
> On Wed, Feb 3, 2016 at 8:20 AM, Souma L <[email protected]>
> wrote:
>
>> Dear Daniel
>>
>> Thank you for your help and I read all the instructions to draw the
>> chart. I added some missing  links on the <head>.
>>
>> Please find in this jsfiddle link all my code. the chart appears when you
>> click on 'refresh' button. Unfortunatlly, only on jsfiddle my chart doesn't
>> change when I change X or Y parameters (but in my local project it works
>> perfectlly).
>>
>> So, my question is how to put log scale on hAxis?
>>
>> https://jsfiddle.net/Souma/ug3ogx0v/
>>
>>
>> Thank you very much!!
>>
>> On Tue, Feb 2, 2016 at 5:57 PM, 'Daniel LaLiberte' via Google
>> Visualization API <[email protected]> wrote:
>>
>>> Hi Souma,
>>>
>>> The basic instructions on loading charts can be found here:
>>> https://developers.google.com/chart/interactive/docs/basic_load_libs
>>>
>>> If you could point to your actual web page, or create a jsfiddle that we
>>> can see, that will help us be able to point out particular problems and
>>> suggest more fixes.
>>>
>>> Assuming you get the chart to display (which it sounds like you did at
>>> least once), we still can't see what your data is from your code, but I
>>> suspect your hAxis data is not actually numbers, but either string or one
>>> of the date/time types.  So check on that.
>>>
>>> On Tue, Feb 2, 2016 at 11:37 AM, Souma L <[email protected]>
>>> wrote:
>>>
>>>> Thank you for your help. I read some pages about
>>>> 'google.setOnLoadCallback' but I didn't get how I can correct my errors.
>>>>
>>>>  I was wondering if you could explain to me in my code because I am a
>>>> begginner in this world but I am spending a long time to learn.
>>>>
>>>> Thnak you in advance,
>>>>
>>>> On Tue, Feb 2, 2016 at 4:58 PM, 'Sergey Grabkovsky' via Google
>>>> Visualization API <[email protected]> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> There are numerous issues with your code, and none of them have to do
>>>>> with fact that you're doing log scale.
>>>>>
>>>>> Your first issue is that you're using google.setOnLoadCallback wrong.
>>>>> You must pass it a function reference, but you are passing it the result 
>>>>> of
>>>>> a function call (in this case, the value 'undefined', since drawChart
>>>>> doesn't return anything).
>>>>>
>>>>> Another thing you're doing wrong is calling google.setOnLoadCallback
>>>>> after the page loads (as evidenced by the fact that you're using 
>>>>> $.ready). google.setOnLoadCallback
>>>>> won't work if your page has already loaded. This issue has been fixed with
>>>>> our new loader (google.charts.load).
>>>>>
>>>>> On Tue, Feb 2, 2016 at 10:46 AM SL <[email protected]> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I am trying to set a log scale in both hAxis and vAxis when I refresh
>>>>>> the page (through AJAX).
>>>>>>
>>>>>> I specify 'logScale = 'True' in options but it works for vAxis and
>>>>>> not for h Axis. All my data are positive without date.
>>>>>>
>>>>>> Here is my code if someone could help me:
>>>>>>
>>>>>> Thanks!
>>>>>> ------------------------------------------------
>>>>>>  function drawChart(dataIn) {
>>>>>>
>>>>>>             var data = google.visualization.arrayToDataTable(dataIn);
>>>>>>
>>>>>>             var options = {
>>>>>>                 legend: 'yes',
>>>>>>                 pointSize: 10,
>>>>>>                 hAxis: {
>>>>>>                     logScale:true,
>>>>>>                     scaleType:'log',
>>>>>>                     gridlines: { count: 10 },
>>>>>>                     title: varX2.options[varX2.selectedIndex].text
>>>>>>
>>>>>>                 },
>>>>>>                 vAxis:{
>>>>>>                     logScale: true,
>>>>>>                     title: varY2.options[varY2.selectedIndex].text
>>>>>>                 },
>>>>>>                 series: {
>>>>>>                     0: { pointShape: 'circle' },
>>>>>>                     1: { pointShape: 'triangle' },
>>>>>>                     2: { pointShape: 'square' },
>>>>>>                     3: { pointShape: 'diamond' },
>>>>>>                     4: { pointShape: 'star' },
>>>>>>                     5: { pointShape: 'polygon' }
>>>>>>                 }
>>>>>>
>>>>>>             };
>>>>>>
>>>>>>             var chart = new
>>>>>> google.visualization.ScatterChart(document.getElementById('chart_div2'));
>>>>>>
>>>>>>             chart.draw(data, options);
>>>>>>         }
>>>>>>
>>>>>>     $(document).ready(function() {
>>>>>>
>>>>>>             $('#button2').click(function() {
>>>>>>                 $.ajax({
>>>>>>                     url: 'data_json.php',
>>>>>>                     type: 'POST',
>>>>>>                     data:{varX2:$('#varX2').val(),
>>>>>> varY2:$('#varY2').val() },
>>>>>>                     success: function(json) {
>>>>>>                         json = JSON.parse( json );
>>>>>>
>>>>>>                         console.log( json );
>>>>>>                         google.setOnLoadCallback(drawChart(json));
>>>>>>                     }
>>>>>>                 });
>>>>>>             });
>>>>>>     });
>>>>>>
>>>>>> ------------------------------------------------
>>>>>>
>>>>>> --
>>>>>> 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/440a2238-7113-45ef-943c-27547a36a325%40googlegroups.com
>>>>>> <https://groups.google.com/d/msgid/google-visualization-api/440a2238-7113-45ef-943c-27547a36a325%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>> --
>>>>>
>>>>> *[image: unnamed.gif]• Sergey Grabkovsky• Software Engineer• Google,
>>>>> Inc• [email protected] <[email protected]>*
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to a topic in the
>>>>> Google Groups "Google Visualization API" group.
>>>>> To unsubscribe from this topic, visit
>>>>> https://groups.google.com/d/topic/google-visualization-api/dyZim8O-H68/unsubscribe
>>>>> .
>>>>> To unsubscribe from this group and all its topics, 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/CAEwwup6u9htrMOcHvq1P67pZ3pd1nU3Kr4Yv%2BTKT4n5grTM_SQ%40mail.gmail.com
>>>>> <https://groups.google.com/d/msgid/google-visualization-api/CAEwwup6u9htrMOcHvq1P67pZ3pd1nU3Kr4Yv%2BTKT4n5grTM_SQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>> --
>>>> 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/CANTZVwMz2xqqkES5Bi5kb2QUwoiwFyYG9%2BKnDSbAfke25K4-GA%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/google-visualization-api/CANTZVwMz2xqqkES5Bi5kb2QUwoiwFyYG9%2BKnDSbAfke25K4-GA%40mail.gmail.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]>   5CC, Cambridge MA
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Google Visualization API" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/google-visualization-api/dyZim8O-H68/unsubscribe
>>> .
>>> To unsubscribe from this group and all its topics, 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/CAOtcSJPg4UY3uQRPDi0-dOGY6F0G8BVgb7_O1C1MAzGe373Qxw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJPg4UY3uQRPDi0-dOGY6F0G8BVgb7_O1C1MAzGe373Qxw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> 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/CANTZVwN8DDuBrTLabWDJQSxJa%2BHs3juARzfCxOajk9DMprxotg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/google-visualization-api/CANTZVwN8DDuBrTLabWDJQSxJa%2BHs3juARzfCxOajk9DMprxotg%40mail.gmail.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]>   5CC, Cambridge MA
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Google Visualization API" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/google-visualization-api/dyZim8O-H68/unsubscribe
> .
> To unsubscribe from this group and all its topics, 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/CAOtcSJMXGEC_Du75GT9G9U7Y0n4UQicWjgu%2BiC7_O%2BfnZ4Ma3Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJMXGEC_Du75GT9G9U7Y0n4UQicWjgu%2BiC7_O%2BfnZ4Ma3Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CANTZVwPm1Si1dP2oD%2B1O28SgLnBYzbpNB0VRwD1iqc_xEJY0ZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to