Change border/background in Google Charts AnnotationChart - Javascript Google Chart

Javascript examples for Google Chart:Chart Configuration

Description

Change border/background in Google Charts AnnotationChart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Annotation Chart Example</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> 
      <div id="chart_div" style="width: 900px; height: 500px;"></div> 
      <script type="text/javascript">
      google.charts.load('current', {'packages':['annotationchart']});
      google.charts.setOnLoadCallback(drawChart);
      function drawChart() {//  w w  w .  ja va  2  s .  co  m
        var data = new google.visualization.DataTable();
        data.addColumn('date', 'Date');
        data.addColumn('number', 'Kepler-22b mission');
        data.addColumn('string', 'Kepler title');
        data.addColumn('string', 'Kepler text');
        data.addColumn('number', 'Gliese 163 mission');
        data.addColumn('string', 'Gliese title');
        data.addColumn('string', 'Gliese text');
        data.addRows([
          [new Date(2314, 2, 15), 12400, undefined, undefined,10645, undefined, undefined],
          [new Date(2314, 2, 16), 24045, 'Lalibertines', 'First encounter',12374, undefined, undefined],
          [new Date(2314, 2, 17), 35022, 'Lalibertines', 'They are very tall',15766, 'Gallantors', 'First Encounter'],
          [new Date(2314, 2, 18), 12284, 'Lalibertines', 'Attack on our crew!',34334, 'Gallantors', 'Statement of shared principles'],
          [new Date(2314, 2, 19), 8476, 'Lalibertines', 'Heavy casualties',66467, 'Gallantors', 'Mysteries revealed'],
          [new Date(2314, 2, 20), 0, 'Lalibertines', 'All crew lost',79463, 'Gallantors', 'Omniscience achieved']
        ]);
        var chart = new google.visualization.AnnotationChart(document.getElementById('chart_div'));
var options = {
    displayAnnotations: true,
    displayZoomButtons: false,
    displayExactValues: false,
    displayDateBarSeparator: true,
    chart: {
      backgroundColor: 'blue',
      chartArea: {
       backgroundColor: '#FFF000'
      }
    }
};
        chart.draw(data, options);
      }

      </script>  
   </body>
</html>

Related Tutorials