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