Hide the tooltip on the trendline on a google chart - Javascript Google Chart

Javascript examples for Google Chart:Line Chart

Description

Hide the tooltip on the trendline on a google chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Scatter Chart Example</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.js"></script> 
   </head> 
   <body> 
      <script type="text/javascript" src="https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1','packages':['corechart']}]}"></script> 
      <div id="chart_div" style="width: 900px; height: 500px;"></div> 
      <script type="text/javascript">
google.setOnLoadCallback(drawChart);/*  w ww  . j a  va 2 s  .c om*/
function drawChart() {
   var data = google.visualization.arrayToDataTable([
    ['Diameter', 'Age'],
    [8, 37], [4, 19.5], [11, 52], [4, 22], [3, 16.5], [6.5, 32.8], [14, 72]]);
  var options = {
    title: 'Age of sugar maples vs. trunk diameter, in inches',
    hAxis: {title: 'Diameter'},
    vAxis: {title: 'Age'},
      focusTarget:  'datum',
    legend: 'none',
      trendlines: { 0: {tooltip: false} }    
  };
  var chart = new google.visualization.ScatterChart(document.getElementById('chart_div'));
          google.visualization.events.addListener(chart, 'onmouseover', function(e){
              $('svg *:contains("* x")').each(function(){
                  $(this).text('')
              })
          })
  chart.draw(data, options);
      }

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

Related Tutorials