react-google-charts icon indicating copy to clipboard operation
react-google-charts copied to clipboard

Redrawing on resize

Open botoxparty opened this issue 6 years ago • 2 comments

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.

botoxparty avatar May 06 '19 05:05 botoxparty

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

degr avatar Aug 20 '19 14:08 degr

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.

benbowler avatar Dec 12 '24 15:12 benbowler