问题
(This is regarding google-embed-api NOT google charts, Stack Overflow won't let me create a new tag without 1500 reputation)
Hello,
I'm not incredible at CSS, and am working on a project where I must present a bunch of columns per dimension using googles new charts embed API. The chart is created through a js call to gapi.analytics.googleCharts.DataChart() which creates what I want, perfectly, however the CSS settings in the JS call are overriding the one's I specify.
Calling gapi.analytics.googleCharts.DataChart()
Creates a google charts table, in the div below, with width set to 450px
The js created in-div css style overrides my CSS file's width : 100%
Any help would be huge, and thanks! -Alex
回答1:
I found the answer JIC anyone else is looking
Rather than try to override the styling in CSS, I found that google charts offers a width argument in the options elements. To set the chart width simply add options and define width in options: {width: '100%'}
chart: {
type: 'TABLE',
container: 'sessions_table',
options: {width: '100%'}
}
回答2:
chart: {
type: 'TABLE',
container: 'sessions_table',
options: {width: '100%'}
}
this is only work for Table charts.when it come's for Line charts you have to trigger the chart redraw on window resize.
You can see the code in this answer
来源:https://stackoverflow.com/questions/26393036/google-embed-api-how-to-change-chart-table-style-width