Format vAxis to Percent

29 views
Skip to first unread message

Chelsea Pitcher

unread,
Sep 14, 2017, 11:47:35 AM9/14/17
to Google Visualization API
Hi there, 

I can't seem to get my vAxis to display a percentage, but my tooltips are displaying percentages. Anyone have an idea on how to fix? Thanks a bunch! Here is the code:

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

        function drawChart() {
            query.send(handleQueryResponse);
        }

        function handleQueryResponse(response) {
            var data = response.getDataTable();
            var chart = new google.visualization.ColumnChart(document.getElementById('student_chart'));
            var options = {
                isStacked: 'false',
                title: 'Number of Unique Students by Year',
                curveType: 'function',
                legend: { gridlines: 'bottom' },
                colors: ['red', 'yellow', 'green'],
                pointSize: 20,
                series: {
                vAxis: {format: "###'%'"},
                    
                }
            };

            chart.draw(data, options);
        }
    </script>
</head>
<body>
    <div id="student_chart" style="width: 900px; height: 500px"></div>
</body>
</html>



Reply all
Reply to author
Forward
0 new messages