0
votes

Below is my Google Combo Chart code and it works fine. I have also attached the output as an image. enter image description here My New requirement is in the second image enter image description here

i.e I want the confidence line bubbles should display their respective values, now it shows only on hover. I have tried the annotation property of the Chart but it works only for the bar columns, I want to work it in the above line i.e Confidence lines. Please reply

var data3 = google.visualization.arrayToDataTable([['Staff','Understanding','Confidence','Hurdle'],
['Customer Planning',40,95,80],
['Passionate Selling',63,93,80],
['Negotiating Revenue & Profit Growth',60,92,80],
['Category & Shopper Execution',60,90,80],
['Value Chain Integration',76,98,80]]);

     var options = {title:"Staff Details",
              width:'100%', height:600,seriesType: "bars",series:{1: {type: "line",pointSize: 6},2: {type: "line",pointSize: 6}},
              vAxis: {title: "", 'minValue': 0, 'maxValue': 100},
              colors: ['#259edd', '#ffc000', '#ff0000'],
              hAxis: {title: "Competency",'minValue': 0, 'maxValue': 100, slantedText: true, slantedTextAngle:60 },
              chartArea: {height: '60%',top:10}
      };        

    var chart           =   new google.visualization.ComboChart(bar_chart_div);
    chart.draw(data3, options);
1

1 Answers

1
votes

You can add annotations to line charts...
But I haven't found a way to add them to the point itself, as in the image.

google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawDashboard);

function drawDashboard() {
  var data = google.visualization.arrayToDataTable([
    ['Name', 'Donuts eaten'],
    ['Michael' , 5],
    ['Elisa', 7],
    ['Robert', 3],
    ['John', 2],
    ['Jessica', 6],
    ['Aaron', 1],
    ['Margareth', 8]
  ]);

  var options = {
    title: 'Company Performance',
    curveType: 'function',
    legend: { position: 'bottom' },
    pointSize: 10
  };

  var view = new google.visualization.DataView(data);
  view.setColumns([0, 1, {
    calc: "stringify",
    sourceColumn: 1,
    type: "string",
    role: "annotation"
  }]);

  var chart = new google.visualization.LineChart(document.getElementById('chart'));
  chart.draw(view, options);
}
<script src="https://www.google.com/jsapi"></script>
<div id="chart"></div>