Hi All!

Just reporting on this issue as well! 

I have tested it initially in Plunker and then on a plain HTML doc - as 
vanilla set-up (see code below). When using google.charts Line and Bar 
methods, it is impossible to show more than one chart on a single page. 
However if the older method - google.visualization and the corresponding 
visualization methods (LineChart and BarChart respectively) the problem 
disappears! 

The behaviour is basically only the first chart will be drawn and shown. 
Looking at the code generated by the lib, it shows the second chart drawn 
in DOM but it will seem that it is not displayed properly. 

So a bug in 1.1 beta??? The app does not report any issues in console... 

Here is the code which makes it all work (Firefox 41.0.1; Chrome 
45.0.2454.101 (64-bit) on Ubuntu 15.04 (64bit);): 
<html>
<head>
<script type="text/javascript" 
src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['bar','line',
 
'corechart']}]}"></script>
<script type="text/javascript">
google.setOnLoadCallback(drawChart);
function drawChart() {
  var data = google.visualization.arrayToDataTable([
    ['Day/Month', 'Sales', 'Goal'],
    ['Daily', 33549.17,47328.04],
    ['M-T-D', 96114.18,141984.12]
  ]);


  var data1 = google.visualization.arrayToDataTable([
    ['Day/Month', 'Bookings', 'Goal'],

    ['Daily', 37991.21,47659.09],

    ['M-T-D', 95610.47,142977.27]

  ]);
 var options = {
    colors: ['#e0aa0e', '#ecbb6e','green'],
    width: 800,
    chart: {
      title: 'Test Company Sales',
      subtitle: 'Sales vs Goal'
    }
  };
  var options1 = {
    colors: ['#e0440e', '#ec8f6e','green'],
    width: 800,
    chart: {
      title: 'Test Company Bookings',
      subtitle: 'Bookings'
    }
  };

  var chart = new google.charts.Bar(document.getElementById('sales'));
  chart.draw(data, options);
  var chart2 = new google.visualization.LineChart(document.getElementById(
'bookings'));

  chart2.draw(data1, options1);
}
</script>
</head>
<body>
<table width="100%">
    <tr><td>
       <div id="sales" style="display:block;width: 100%; height: 300;"
></div>
      </td></tr><tr><td>
    <div id="bookings"  style="display:block; border: 1px solid red;width: 
100%; height: 300;"></div>
   </td></tr>
</table>
    <br/>
   
</body>
</html>



On Monday, 5 October 2015 20:26:12 UTC+3, Roland Wornor wrote:
Quick question,


Up to about a week or so ago, I was able to use the google chart 
visualization package 1.1 to display two charts on my web page. Now I am 
only able to select one of the two charts at a time - and the selection is 
random. I don't remember changing anything and I am using google's out of 
the box examples nothing really custom. Did google Visualization API 
change? This code below worked up to about a week ago. Now only one of 
these charts will display at a time. I would like both to display.


<head>
<script type="text/javascript" src="
https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization
','version':'1.1','packages':['bar']}]}"/>
</head>
<body>
                <div class="container-fluid" 
style="width:100%;height:380px;background-color:#CAD6E0"> 
                  <div id="candidate_count" 
style="width:50%;padding:20px;float:left;margin-top:30px"></div>
                  <div id="avg_duration" 
style="width:50%;padding:20px;float:left;margin-top:30px"></div>           
   
                </div>
</body>
<script>
  google.setOnLoadCallback(drawChart);
  function drawChart() {
  var dataHires = google.visualization.arrayToDataTable([
    ['2015', 'Hires'],
    ['January', 30],
    ['February', 22],
    ['March', 45],
    ['April', 29],
    ['May', 18],
    ['June', 33],
    ['July', 30],
    ['August', 44],
    ['September', 18],
    ['October', 22],
    ['November', 14],
    ['December', 10]
  ]);


  var dataDuration = google.visualization.arrayToDataTable([
    ['2015', 'Days'],
    ['January', 12],
    ['February', 11],
    ['March', 16],
    ['April', 13],
    ['May', 14],
    ['June', 11],
    ['July', 10],
    ['August', 13],
    ['September', 14],
    ['October', 15],
    ['November', 14],
    ['December', 13]
  ]);


  var optionsHires = {
    chart: {
      title: 'Hires This Year (By Month)',
      subtitle: ''
    },
    width: 500,
    bars: 'vertical',
    vAxis: {format: 'decimal'},
    height: 250,
    colors: ['#2c94dc']
  };


  var optionsDuration = {
    chart: {
      title: 'Average Duration This Year (By Month)',
      subtitle: ''
    },
    width: 500,
    bars: 'vertical',
    vAxis: {format: 'decimal'},
    height: 250,
    colors: ['#00a08c']
  };


  var chartHires = new 
google.charts.Bar(document.getElementById('candidate_count'));
  chartHires.draw(dataHires, 
google.charts.Bar.convertOptions(optionsHires));
  var chartDuration = new 
google.charts.Bar(document.getElementById('avg_duration'));
  chartDuration.draw(dataDuration, 
google.charts.Bar.convertOptions(optionsDuration));


}
</script>
>
>
>

-- 
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 http://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/bd882c65-3d86-4f7b-b798-2b1595efccbe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to