Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【完善】ECharts-JSX 重写地图图表 #101

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open

Conversation

ziwu7
Copy link
Contributor

@ziwu7 ziwu7 commented Dec 13, 2024

已完成ECharts地图组件替换为ECharts-JSX 地图组件
Close #100

ziwu7 and others added 2 commits December 13, 2024 21:00
chart.setOption(chartOptions);


this.renderChart(chartOptions);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSX 渲染方法应由组件引擎调用,而不是组件作者直接调用。

Comment on lines 128 to 137
renderChart(chartOptions: EChartsOption) {
return (
<ec-svg-renderer >
<ec-geo
map={this.mapName}
data={chartOptions.options[0].series[0]?.data}
/>
</ec-svg-renderer>
);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
renderChart(chartOptions: EChartsOption) {
return (
<ec-svg-renderer >
<ec-geo
map={this.mapName}
data={chartOptions.options[0].series[0]?.data}
/>
</ec-svg-renderer>
);
}
render() {
const { options } = this.chartOptions;
return (
<ec-svg-renderer>
<ec-geo
map={this.mapName}
data={options[0].series[0]?.data}
/>
</ec-svg-renderer>
);
}

@ziwu7 ziwu7 requested a review from TechQuery December 18, 2024 12:42
@TechQuery
Copy link
Member

什么叫重写、重构?就是实现同样的效果,但完全抛弃旧代码,用新库的写法来写。

也就是说,原先所有基于 .setOption().on('event') 的代码全部改写成 JSX,不要再拘泥于以前的任何代码。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

用 ECharts-JSX 重写地图图表
2 participants