Is this possible to do.. I have code for two Google charts in the same 
external js file. When I load the html page, only the last chart in the js 
file will show on the page.

Below is my code. Do I need to somehow separate the two pieces of code?

// JavaScript Document

      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['Year', 'Number Commissioned'],
          ['1989',1],
  ['1991',2],
  ['1992',1],
      ['1993',3],
  ['1995',3],
          ['1996',1],
          ['1997',2],
  ['1998',3],
  ['1999',1],
  ['2000',5],
  ['2002',5],
  ['2003',1],
  ['2004',9],
  ['2005',1],
  ['2006',8],
  ['2007',11],
   ['2008',18],
  ['2009',13],
      ['2010',31],
  ['2011',12],
  ['2012',18],
  ['2013',13],
  ['2014',6]
        ]);

        var options = {
          title: 'Number of Art Commissioned Each Year',
          legend: { position: 'bottom' },
          titlePosition: 'out',
          titleTextStyle: { fontSize: 16 },
          width: '80%'
            
                };

        var chart = new 
google.visualization.LineChart(document.getElementById('linechartbyyear'));

        chart.draw(data, options);
      };

//NEW CHART - Barchart

      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ["Neighborhood","Pieces of Art"],
["Shaw",21],
["Columbia Heights",10],
["Anacostia",9],
["Old City",8],
["Downtown",8],
["Dupont Circle",7],
["Saint Elizabeth's",7],
["Congress Heights",6],
["Adams Morgan",5],
["Mount Vernon",4]

        ]);

        var options = {
          title: 'Top 10 Neighborhoods with the Most Art',
          vAxis: {title: 'Neighborhood',  titleTextStyle: {color: 'red'}, 
fontSize: 16},
          width: '100%',
          titleTextStyle: { fontSize: 16 }
                      
        };

        var chart = new 
google.visualization.BarChart(document.getElementById('barchartbyneighborhood'));

        chart.draw(data, options);
      }

Thanks in advance for the help.

Delinda

-- 
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 http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to