duancai1904 2016-01-18 07:07
浏览 71

谷歌柱形图线点

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条回答 默认 最新

  • doulouli8686 2016-01-18 18:27
    关注

    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>

    </div>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line