Skip to content

Commit

Permalink
Merge pull request #9 from ziwu7/1209
Browse files Browse the repository at this point in the history
【完善】ECharts-JSX重写地图图表
  • Loading branch information
ziwu7 authored Dec 13, 2024
2 parents 7986606 + 483e409 commit 6694a50
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions source/page/Map/component/EChartsMap.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import 'echarts-jsx/dist/renderers/SVG';
import 'echarts-jsx/dist/components/geo';

import { DataObject } from 'dom-renderer';
import { EChartsOption, EChartsType, init, registerMap } from 'echarts';
import { observable } from 'mobx';
Expand Down Expand Up @@ -117,14 +120,21 @@ export class EChartsMap
properties.name = long2short(properties.name);

registerMap(mapName, data);

chart.setOption(chartOptions);


this.renderChart(chartOptions);
this.adjustLabel();

chart.hideLoading();
}

renderChart(chartOptions: EChartsOption) {
return (
<ec-svg-renderer >
<ec-geo
map={this.mapName}
data={chartOptions.options[0].series[0]?.data}
/>
</ec-svg-renderer>
);
}
updateChartData = (newData: Province[]) =>
this.chart.setOption({
series: [
Expand Down

0 comments on commit 6694a50

Please sign in to comment.