data-vis-ui
Version:
## [使用文档](https://temp-static-domain.jd.com/data-vis-ui)
36 lines (33 loc) • 1.07 kB
JavaScript
import React, { useMemo } from 'react';
import * as echarts from 'echarts';
import suyangGeoJson from './data_full/shuyang_full.json';
import ReactEcharts from 'echarts-for-react';
import { merge } from 'lodash';
import { getOption } from './data';
import "./index.css";
var ChinaMap = function ChinaMap(_ref) {
var data = _ref.data,
_ref$width = _ref.width,
width = _ref$width === void 0 ? 1134 : _ref$width,
_ref$height = _ref.height,
height = _ref$height === void 0 ? 1104 : _ref$height,
optionProps = _ref.optionProps;
// 地图初始化
var options = getOption(data); // 按需求注入对应地图数据
echarts.registerMap('沭阳县', suyangGeoJson);
useMemo(function () {
if (optionProps) {
options = merge(options, optionProps);
}
}, [optionProps]);
return /*#__PURE__*/React.createElement("div", {
className: 'content_center_map'
}, /*#__PURE__*/React.createElement(ReactEcharts, {
option: options,
style: {
width: width,
height: height
}
}));
};
export default ChinaMap;