如何在柱形图上显示注释?

时间:2019-05-29 08:49:43

标签: javascript charts google-visualization

我有一个普通的材料柱形图,但是我无法弄清楚如何在每个类别中有多个列的图表上显示注释。这有可能吗?这是正常的工作图。我希望在每一列之内或之外都能看到每一列的分数。

  <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
    google.charts.load('current', { 'packages': ['corechart', 'bar'] });
    google.charts.setOnLoadCallback(drawChart);

    function drawChart() {
        var data = google.visualization.arrayToDataTable([
            ['Size 0-100', 'You', 'Them', 'Norm', ],
            ['Something1', 44, 55,73.5],
            ['Something2', 44, 66, 87.7],
            ['Something3', 33, 78,87.4 ],
            ['Something4', 32, 12, 89.5],
            ['Something5', 11, 80,74.1],               
        ]);
        var options = {  
            chart: {
                title: 'Values',
                subtitle: 'Your score',   
            },     
            colors: ['#00797B', '#EAF579', '#DCDCDC'],
            vAxis: {                    
                minValue: 0,
                maxValue: 100,
            },
            legend: {
                position: "none",
            },
             hAxis : { 
                        textStyle : {
                            fontSize: 18 // or the number you want
                        }
                    }
        };
        var chart = new google.charts.Bar(document.getElementById('columnchart_material'));

        chart.draw(data, google.charts.Bar.convertOptions(options));
    }
</script>
 <div id="columnchart_material" style="width: 100%; height: 600px;"></div>

0 个答案:

没有答案