Google charts not showing axis labels

ぐ巨炮叔叔 提交于 2020-01-06 02:00:31

问题


This is not for the image charts.
I have the following code that generates the right chart but the labels don't show. The chart div is in an other div that is used as a tab on my page.
When I run the function when the tab containing the chart is not selected, the chart appears with no labels. When I run the function with the tab selected, the labels appear.

  drawChart()
  }

   function drawChart() {
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Weeks');
    data.addColumn('number', 'Indice');

    data.addRows(arrIndice1);

    var options = {
      width:"900",
      height:"500",
      legend: "none",
      title: 'Indice 1',
      chartArea:{left:20,top:50,width:"85%",height:"75%"} 
    };

    var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
    chart.draw(data, options);
  }

回答1:


chartArea options seem to cover the axis labels when they increase the chart size. Try removing the chartArea:{left:20,top:50,width:"85%",height:"75%"} part.



来源:https://stackoverflow.com/questions/9486908/google-charts-not-showing-axis-labels

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!