TypeError: Cannot read property getWidth of null↵ at ZRender.getWidth
no exception
When calling echarts.getWidth() where echarts is an instance returned from onChartReady callback.
Stack trace:
"TypeError: Cannot read property 'getWidth' of null
at ZRender.getWidth (http://localhost:3000/assets/vendors~dashboard.chunk.js:132736:25)
at ECharts.push../node_modules/echarts/lib/echarts.js.echartsProto.getWidth (http://localhost:3000/assets/vendors~dashboard.chunk.js:59885:19)
at makeData (http://localhost:3000/assets/dashboard.chunk.js:1500:52)
Container should have width and height when init. Please provide minimum full code including HTML part.
@damiangreen hello~I have met the same problem. Have you solve it ? Would you mind provide some advices? thanks~~
Noticing same thing despite setting a width to the closest parent / container.
I'm not sure if i got to the bottom of it but i did somehting like this
if (echarts) {
try {
const greaterValue = min(echarts.getWidth(), echarts.getHeight())
largestSymbolSize = greaterValue / 4
smallestSymbolSize = greaterValue / 16
symbolSizeDelta = largestSymbolSize - smallestSymbolSize
} catch (err) {
// tslint:disable-next-line:no-empty
}
}
Most helpful comment
@damiangreen hello~I have met the same problem. Have you solve it ? Would you mind provide some advices? thanks~~