echarts [Bug] Cannot read properties of undefined (reading 'regions') -- GeoCreator.getFilledRegions

ctehm74n  于 4个月前  发布在  Echarts
关注(0)|答案(6)|浏览(106)

Version

5.3.2

No response

Steps to Reproduce

-Create a Geo Map
-Display it

ChartOptions: any = {
// backgroundColor: '#000',
title: {
text: '',
left: 'center',
textStyle: {
color: '#2a333d'
}
},
geo: {
map: 'world',
roam: true,
label: {
emphasis: {
show: false,
}
},
silent: true,
itemStyle: {
normal: {
borderColor: ' #111 '
},
emphasis: {
areaColor: '#2a333d'
},
},
},
series: [
{
type: 'scatter',
progressive: 1e6,
coordinateSystem: 'geo',
symbolSize: '15',
zoomScale: 0.222,
blendMode: 'source-over',
large: true,
postEffect: {
enable: true
},
dimensions: ['lng', 'lat'],
silent: true,
data: []
}
],
};

this.client.get("/assets/worldmap.json").subscribe((data: any) => {
  var worldMap = echarts.getMap('world');
  if (worldMap == null) {
    echarts.registerMap('world', data);
  }
  this.LoadData();
});

-In load Data
this.ChartOptions.series[0].data.push(item);

if (this.ChartInstance) {
this.ChartInstance.setOption(this.ChartOptions);
}

-Html

<div echarts [options]="ChartOptions" [theme]="Theme" class="chart" *ngIf="ChartOptions" style="height:100%; width:100%" (chartInit)="OnChartInit($event)"></div>

Current Behavior

A console error appears and the map does not whereas it was working fine for almost a year and suddenly stopped

Expected Behavior

the map to appear

Environment

- OS: Windows 
- Browser: Chrome
- Framework:Angular

Any additional comments?

No response

krugob8w

krugob8w1#

Meet the same problem on version v5.4.1. You can see the demo here https://codepen.io/librabyte/pen/dyjNPXW .
Any suggestion would be appreciated, thanks for your efforts on this awesome project!

kse8i1jr

kse8i1jr2#

After reading docs from Echarts https://echarts.apache.org/handbook/en/basics/release-note/v5-upgrade-guide/#built-in-geojson-removed, here is the explain:
Built-in GeoJSON Removed
v5 removes the built-in geoJSON (previously in the echarts/map folder). These geoJSON files were always sourced from third parties. If users still need them, they can go get them from the old version, or find more appropriate data and register it with ECharts via the registerMap interface.

4ktjp1zp

4ktjp1zp4#

@librabyte what was the fix exactly?

8wtpewkr

8wtpewkr5#

@MohammedAlSafwan, file /assets/worldmap.json does not exist anymore.
Here is how to use the geoJson world file with your code.

vof42yt1

vof42yt16#

How you then used it?
@MohammedAlSafwan @librabyte

相关问题