Google Charts title of a chart - Javascript Google Chart

Javascript examples for Google Chart:Chart Configuration

Description

Google Charts title of a chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> 
      <script type="text/javascript">
      google.charts.load('current', {'packages':['bar']});
      google.charts.setOnLoadCallback(drawChart);
      function drawChart() {//from  ww w.  ja  v a  2 s .c  o  m
        var data = google.visualization.arrayToDataTable([
          ['Year', 'Sales', 'Expenses', 'Profit'],
          ['2014', 1000, 400, 200],
          ['2015', 1170, 460, 250],
          ['2016', 660, 1120, 300],
          ['2017', 1030, 540, 350]
        ]);
        var options = {
          chart: {
            title: 'Company\'Performance',
            subtitle: 'Sales, Expenses, and Profit: 2014-2017',
          },
          bars: 'horizontal' 
        };
        var chart = new google.charts.Bar(document.getElementById('barchart_material'));
        chart.draw(data, google.charts.Bar.convertOptions(options));
      }
    
      </script> 
   </head> 
   <body> 
      <div id="barchart_material" style="width: 900px; height: 500px;"></div>  
   </body>
</html>

Related Tutorials