Skip to content

Commit a75b57f

Browse files
committed
测试map
1 parent ec181f6 commit a75b57f

File tree

3 files changed

+116
-2
lines changed

3 files changed

+116
-2
lines changed

src/components/MainPage/analytics.vue

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,85 @@ export default {
132132
}
133133
},
134134
mapChartOption: {},
135-
visitListData: []
135+
visitListData: [],
136+
mapOption : {
137+
tooltip: {
138+
show: false
139+
},
140+
geo: {
141+
map: "china",
142+
roam: false,// 一定要关闭拖拽
143+
zoom: 1.23,
144+
center: [105, 36], // 调整地图位置
145+
label: {
146+
normal: {
147+
show: false, //关闭省份名展示
148+
fontSize: "10",
149+
color: "rgba(0,0,0,0.7)"
150+
},
151+
emphasis: {
152+
show: false
153+
}
154+
},
155+
itemStyle: {
156+
normal: {
157+
areaColor: "#0d0059",
158+
borderColor: "#389dff",
159+
borderWidth: 1, //设置外层边框
160+
shadowBlur: 5,
161+
shadowOffsetY: 8,
162+
shadowOffsetX: 0,
163+
shadowColor: "#01012a"
164+
},
165+
emphasis: {
166+
areaColor: "#184cff",
167+
shadowOffsetX: 0,
168+
shadowOffsetY: 0,
169+
shadowBlur: 5,
170+
borderWidth: 0,
171+
shadowColor: "rgba(0, 0, 0, 0.5)"
172+
}
173+
}
174+
},
175+
series: [
176+
{
177+
type: "map",
178+
map: "china",
179+
roam: false,
180+
zoom: 1.23,
181+
center: [105, 36],
182+
// geoIndex: 1,
183+
// aspectScale: 0.75, //长宽比
184+
showLegendSymbol: false, // 存在legend时显示
185+
label: {
186+
normal: {
187+
show: false
188+
},
189+
emphasis: {
190+
show: false,
191+
textStyle: {
192+
color: "#fff"
193+
}
194+
}
195+
},
196+
itemStyle: {
197+
normal: {
198+
areaColor: "#0d0059",
199+
borderColor: "#389dff",
200+
borderWidth: 0.5
201+
},
202+
emphasis: {
203+
areaColor: "#17008d",
204+
shadowOffsetX: 0,
205+
shadowOffsetY: 0,
206+
shadowBlur: 5,
207+
borderWidth: 0,
208+
shadowColor: "rgba(0, 0, 0, 0.5)"
209+
}
210+
}
211+
}
212+
]
213+
}
136214
}
137215
},
138216
methods: {
@@ -164,6 +242,7 @@ export default {
164242
}
165243
});
166244
},
245+
// 渲染列表
167246
setVisitList: function () {
168247
let that = this;
169248
this.SQFrontAjax({
@@ -179,13 +258,20 @@ export default {
179258
that.visitListData = data;
180259
}
181260
});
261+
},
262+
// 渲染地图
263+
setMap:function (){
264+
let map,that=this;
265+
map = that.$echarts.init(document.getElementById('line-chart'));
266+
map.setOption(that.mapOption);
182267
}
183268
},
184269
mounted: function () {
185270
Store.commit("ChangeActive", 5);// 切换Topbar高亮
186271
187272
this.setLineChart();
188273
this.setVisitList();
274+
// this.setMap();
189275
}
190276
}
191277
</script>

src/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import CommonFunction from './util/util';
66
import './static/iconfont/iconfont.css';
77
import store from './store';
88
import VueParticles from 'vue-particles'; // 离子动画背景
9-
import * as echarts from 'echarts'
9+
import * as echarts from 'echarts';
10+
// import './static/map/china'; // 引入中国地图数据
1011

1112
Vue.use(VueParticles);
1213
Vue.config.productionTip = false;

src/static/map/china.js

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)