style:雷达图
Showing
3 changed files
with
217 additions
and
1 deletions
| 1 | <template> | ||
| 2 | <div id="jgChart" /> | ||
| 3 | </template> | ||
| 4 | |||
| 5 | <script> | ||
| 6 | export default { | ||
| 7 | data () { | ||
| 8 | return { | ||
| 9 | }; | ||
| 10 | }, | ||
| 11 | methods: { | ||
| 12 | drawInit () { | ||
| 13 | let datavalue = [26, 300, 2000, 1200, 800]; | ||
| 14 | let ii = -1; | ||
| 15 | var chartDom = document.getElementById('jgChart'); | ||
| 16 | var myChart = this.$echarts.init(chartDom); | ||
| 17 | var option; | ||
| 18 | option = { | ||
| 19 | radar: { | ||
| 20 | indicator: [ | ||
| 21 | { name: '原则监管', max: 2600 }, | ||
| 22 | { name: '时效监管', max: 2600 }, | ||
| 23 | { name: '证书监管', max: 3600 }, | ||
| 24 | { name: '年限监管', max: 2600 }, | ||
| 25 | { name: '内容监管', max: 2600 }, | ||
| 26 | ], | ||
| 27 | name: { | ||
| 28 | rich: { | ||
| 29 | a: { | ||
| 30 | color: '#606266' | ||
| 31 | }, | ||
| 32 | b: { | ||
| 33 | color: '#409EFF', | ||
| 34 | align: 'center', | ||
| 35 | } | ||
| 36 | }, | ||
| 37 | formatter: (a, b) => { | ||
| 38 | ii++; | ||
| 39 | return `{a|${a}}\n{b|${datavalue[ii]}}` | ||
| 40 | } | ||
| 41 | } | ||
| 42 | }, | ||
| 43 | series: [ | ||
| 44 | { | ||
| 45 | type: 'radar', | ||
| 46 | symbol: 'none',//去掉拐点的圈 | ||
| 47 | itemStyle: { | ||
| 48 | color: '#409EFF' | ||
| 49 | }, | ||
| 50 | data: [ | ||
| 51 | { | ||
| 52 | value: datavalue, | ||
| 53 | } | ||
| 54 | ] | ||
| 55 | } | ||
| 56 | ] | ||
| 57 | }; | ||
| 58 | myChart.setOption(option); | ||
| 59 | } | ||
| 60 | }, | ||
| 61 | mounted () { | ||
| 62 | this.drawInit() | ||
| 63 | } | ||
| 64 | } | ||
| 65 | </script> | ||
| 66 | <style scoped> | ||
| 67 | #jgChart { | ||
| 68 | width: 100%; | ||
| 69 | height: 360px; | ||
| 70 | } | ||
| 71 | </style> |
| 1 | <template> | ||
| 2 | <div class="map"> | ||
| 3 | <div class="map-box" ref="mapContain" /> | ||
| 4 | </div> | ||
| 5 | </template> | ||
| 6 | |||
| 7 | <script> | ||
| 8 | export default { | ||
| 9 | data () { | ||
| 10 | return { | ||
| 11 | mapName: "汉中市", | ||
| 12 | listArr: [{ | ||
| 13 | name: '汉台区', | ||
| 14 | value: '6000' | ||
| 15 | }, | ||
| 16 | { | ||
| 17 | name: '南郑区', | ||
| 18 | value: '8000' | ||
| 19 | }, | ||
| 20 | { | ||
| 21 | name: '城固县', | ||
| 22 | value: '3000' | ||
| 23 | }, | ||
| 24 | { | ||
| 25 | name: '洋县', | ||
| 26 | value: '7000' | ||
| 27 | }, | ||
| 28 | { | ||
| 29 | name: '西乡县', | ||
| 30 | value: '1000' | ||
| 31 | }, | ||
| 32 | { | ||
| 33 | name: '镇巴县', | ||
| 34 | value: '2000' | ||
| 35 | }, | ||
| 36 | { | ||
| 37 | name: '勉县', | ||
| 38 | value: '600' | ||
| 39 | }, | ||
| 40 | { | ||
| 41 | name: '留坝县', | ||
| 42 | value: '3000' | ||
| 43 | }, | ||
| 44 | { | ||
| 45 | name: '佛坪县', | ||
| 46 | value: '1000' | ||
| 47 | }, | ||
| 48 | { | ||
| 49 | name: '宁强县', | ||
| 50 | value: '1000' | ||
| 51 | }, | ||
| 52 | { | ||
| 53 | name: '略阳县', | ||
| 54 | value: '1000' | ||
| 55 | }], //城市json | ||
| 56 | max: "9000", //最大value值 | ||
| 57 | min: "500", // 最小value值 | ||
| 58 | }; | ||
| 59 | }, | ||
| 60 | methods: { | ||
| 61 | drawProvinceMap (mapName) { | ||
| 62 | this.mapName = mapName; | ||
| 63 | // 引入区域数据 | ||
| 64 | require('./hanzhong.js'); | ||
| 65 | let _this = this; | ||
| 66 | let myChart8 = this.$echarts.init(this.$refs.mapContain); | ||
| 67 | const option = { | ||
| 68 | visualMap: { | ||
| 69 | min: 0, | ||
| 70 | max: _this.max, | ||
| 71 | top: "bottom", | ||
| 72 | right: 10, | ||
| 73 | splitNumber: 6, | ||
| 74 | seriesIndex: [0], | ||
| 75 | itemWidth: 20, // 每个图元的宽度 | ||
| 76 | itemGap: 2, // 每两个图元之间的间隔距离,单位为px | ||
| 77 | pieces: [ // 自定义每一段的范围,以及每一段的文字 | ||
| 78 | { gte: 6000, label: '6000以上', color: '#035cf5' }, // 不指定 max,表示 max 为无限大(Infinity)。 | ||
| 79 | { gte: 2000, lte: 6000, label: '2000-6000', color: '#3375e4' }, | ||
| 80 | { gte: 1000, lte: 2000, label: '1000-2000', color: '#6797ef' }, | ||
| 81 | { gte: 500, lte: 1000, label: '500-1000', color: '#96b5ef' }, | ||
| 82 | ], | ||
| 83 | textStyle: { | ||
| 84 | color: '#737373' | ||
| 85 | } | ||
| 86 | }, | ||
| 87 | // 数据移入显示 | ||
| 88 | tooltip: { | ||
| 89 | trigger: "item", | ||
| 90 | formatter: function (params) { | ||
| 91 | return params.value ? params.name + ':' + params.value + '件' : params.name + ':' + '0件' | ||
| 92 | }, | ||
| 93 | // 边框颜色 | ||
| 94 | borderColor: "#CB000C", | ||
| 95 | // 边框宽度 | ||
| 96 | borderWidth: "1", | ||
| 97 | }, | ||
| 98 | series: [ | ||
| 99 | { | ||
| 100 | type: "map", | ||
| 101 | map: this.mapName, | ||
| 102 | itemStyle: { | ||
| 103 | normal: { //正常状态 | ||
| 104 | label: { | ||
| 105 | show: true, | ||
| 106 | formatter: '{b}', //地图上显示的数据,分别对应data中的name和value | ||
| 107 | color: '#fff', | ||
| 108 | }, | ||
| 109 | areaColor: '#409EFF' //地图区域的颜色 | ||
| 110 | }, | ||
| 111 | emphasis: { | ||
| 112 | label: { show: true }, | ||
| 113 | areaColor: "#67C23A", //鼠标进入时的颜色 | ||
| 114 | }, | ||
| 115 | }, | ||
| 116 | data: _this.listArr, | ||
| 117 | }, | ||
| 118 | ], | ||
| 119 | }; | ||
| 120 | myChart8.setOption(option); | ||
| 121 | }, | ||
| 122 | }, | ||
| 123 | mounted () { | ||
| 124 | // 初始化数据 | ||
| 125 | this.drawProvinceMap("汉中市"); | ||
| 126 | } | ||
| 127 | } | ||
| 128 | </script> | ||
| 129 | <style scoped> | ||
| 130 | .map { | ||
| 131 | width: 100%; | ||
| 132 | } | ||
| 133 | |||
| 134 | .map-box { | ||
| 135 | display: inline-block; | ||
| 136 | width: 100%; | ||
| 137 | height: 80vh; | ||
| 138 | } | ||
| 139 | </style> | ... | ... |
| ... | @@ -30,10 +30,14 @@ | ... | @@ -30,10 +30,14 @@ |
| 30 | </div> | 30 | </div> |
| 31 | <div class="jgHome-center"> | 31 | <div class="jgHome-center"> |
| 32 | <el-card> | 32 | <el-card> |
| 33 | <hzMap /> | ||
| 33 | </el-card> | 34 | </el-card> |
| 34 | </div> | 35 | </div> |
| 35 | <div class="jgHome-right"> | 36 | <div class="jgHome-right"> |
| 36 | <el-card> | 37 | <el-card> |
| 38 | <div slot="header"> | ||
| 39 | <jgChart /> | ||
| 40 | </div> | ||
| 37 | </el-card> | 41 | </el-card> |
| 38 | </div> | 42 | </div> |
| 39 | </div> | 43 | </div> |
| ... | @@ -41,9 +45,11 @@ | ... | @@ -41,9 +45,11 @@ |
| 41 | 45 | ||
| 42 | <script> | 46 | <script> |
| 43 | import barChart from './components/barChart' | 47 | import barChart from './components/barChart' |
| 48 | import hzMap from './components/map' | ||
| 49 | import jgChart from './components/jgChart' | ||
| 44 | export default { | 50 | export default { |
| 45 | name: "jgHome", | 51 | name: "jgHome", |
| 46 | components: { barChart }, | 52 | components: { barChart, hzMap, jgChart }, |
| 47 | data () { | 53 | data () { |
| 48 | return { | 54 | return { |
| 49 | } | 55 | } | ... | ... |
-
Please register or sign in to post a comment