谷歌可视化缩写列标签

时间:2016-11-13 15:34:33

标签: javascript

使用谷歌可视化API,有没有办法让一个表格的列标题缩写,但是说使用相同数据集的饼图会显示完整的列标签?

以下是javascript的信息:

    //create the dashboard and table chart
    var dashboard = new google.visualization.Dashboard(
            document.getElementById('dashboard_div'));
    table = new google.visualization.ChartWrapper({
        'chartType': 'Table',
        'containerId': 'chart_div',
        'view': {'columns': ViewColumns},
        'options': {
            height: 400,
        },
    });
    dashboard.bind(table);

    //bind the data to the table
    baseData = new google.visualization.DataTable(response);
    dashboard.draw(baseData);

//add a column chart bound to the same data
var columnChart = new google.visualization.ChartWrapper({
    'chartType': 'ColumnChart',
    'containerId': 'column_chart_div',
    'options': {
        isStacked: true,
        height: 400,
        width: 800,
    },
});
columnChart.setDataTable(table.getDataTable());
columnChart.draw();

HTML:

  <div id="dashboard_div">
    <div id="column_chart_div" class="inline"> </div>
    <div id="chart_div"></div>

1 个答案:

答案 0 :(得分:0)

th.google-visualization-table-th {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50px;  
}

th.google-visualization-table-th:hover {
  white-space: nowrap;
  overflow: visible;
}

如果我可以在悬停时突出显示全文(在邻居列的顶部),这将是完美的,但我没有运气。