2016-11-13 75 views
0

使用谷歌可视化API,有没有一种方法来创建一个列标题缩写的表,但在一个饼图使用相同的数据集显示完整的列标签?谷歌可视化缩写列标签

这里是JavaScript的一个SNIPPIT:

//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> 
+0

我注意到有一种方法可以为标题行指定css类(https://developers.google.com/chart/interactive/docs/gallery/table#configuration-options),所以认为可能有一个css解决方案会限制我的单元格宽度。 – mjr

+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; 
} 

这将是完美的,如果我能得到全文弹出悬停(超过顶部邻居专栏),但我对此没有任何好运。