Vertical labels with google charts API?

前端 未结 9 1645
傲寒
傲寒 2020-12-13 03:07

Anyone know how to get x-axis labels to be vertical with google charts API?

I need to fit a lot of labels in a small chart.

Thanks

9条回答
  •  感动是毒
    2020-12-13 03:43

    Yes!

    Set hAxis.slantedText to true and then set hAxis.slantedTextAngle=90. Like so...

    var ac = new google.visualization.ComboChart(document.getElementById('visualization'));
        ac.draw(data, {
          title : 'Equipment Performance Chart',
          isStacked:true,
          vAxis: {
            viewWindowMode: 'explicit',
            viewWindow: {
                max: 100
                },
            title: "Percentage"
            },
          hAxis: {
            title: "Area",
            slantedText:true,
            slantedTextAngle:90
            },
          seriesType: "bars",
    
        });
    

提交回复
热议问题