I use echarts to visualize a custom svg map.
However, for every first npm start, it will always return error at Cannot read properties of undefined (reading 'regions')
But when I re-compile in vscode (just simply press ctrl + s), the website will refresh and successfully get the output.
Please help to out for this issue which has been bordered me for a long time!
also kindly refer to the source code and svg file for your review. thanks.
Current Behavior
Got Error at Cannot read properties of undefined (reading 'regions')
Expected Behavior
Can show the output without error
souce code
import React, { useRef, useEffect } from "react";
import * as echarts from "echarts";
import mapData from "./map.svg";
export default function Heatmap(){
const ref = useRef(null);
let mapInstance = null;
@CarsonLoi, there is very minimal chance to get React help here.
Your ECharts code is working fine - Demo.
Duplicate of #16902 (reading 'regions' error)
Version
5.4.2
I use echarts to visualize a custom svg map. However, for every first npm start, it will always return error at Cannot read properties of undefined (reading 'regions') But when I re-compile in vscode (just simply press ctrl + s), the website will refresh and successfully get the output.
Please help to out for this issue which has been bordered me for a long time! also kindly refer to the source code and svg file for your review. thanks.
Current Behavior
Got Error at Cannot read properties of undefined (reading 'regions')
Expected Behavior
Can show the output without error
souce code
import React, { useRef, useEffect } from "react"; import * as echarts from "echarts"; import mapData from "./map.svg";
export default function Heatmap(){ const ref = useRef(null); let mapInstance = null;
}
svg file