react-google-charts
react-google-charts copied to clipboard
Redrawing on resize
It doesn't seem to be redrawing on resize for me, I have my widths set to 100%.
I have another Component that uses this type of google chart react-analytics-widget
And that redraws when resizing as expected.
Really frustrating bug, however, I was able to fix it with html+css (at least with PieChart)
<div className="google-chart"><Chart
controls={[]}
ref={chart => this.chart = chart}
width={this.props.width}
height={this.props.height}
chartType={this.props.chartType}
loader={<div>Loading Chart</div>}
data={data}
options={this.props.options}
legendToggle
/></div>
.google-chart {
display: flex;
flex-flow: column;
}
.google-chart svg {
width: 100% !important;
}
.google-chart div[dir=ltr] {
width: 100% !important;
}
I've found a similar issue where the graph only resizes up but not down in 3.0.15. I think you just need:
.google-chart div[dir] {
width: 100% !important;
}
In case you're user is using a rtl font.