123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- <template>
- <div class="wrap-container sn-container">
- <div class="sn-content">
- <div class="sn-title">玫瑰图</div>
- <div class="sn-body">
- <div class="wrap-container">
- <div class="chart" id="chart_right2"></div>
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- import screenfull from 'screenfull'
- export default {
- name: "RoseCon",
- data() {
- return {
- fullscreen: false
- }
- },
- mounted() {
- let myChart = echarts.init(document.getElementById('chart_right2'));
- this.getEchartRight2();
- window.addEventListener('resize', () => {
- myChart.resize()
- })
- },
- methods: {
- reload() {
- this.$router.go(0);
- },
- getEchartRight2() {
- let myChart = echarts.init(document.getElementById('chart_right2'));
- let option = {
- color: ['#EAEA26', '#906BF9', '#FE5656', '#01E17E', '#3DD1F9', '#FFAD05', '#4465fc'],
- toolbox: {
- feature: {
- mytool: {
- show: true,
- title: "全屏",
- icon: 'path://M181 357.5V181.2h176.4c14.3 0 25.9-11.6 25.9-25.9v-31.1c0-14.3-11.6-25.9-25.9-25.9H118c-11 0-20 9-20 20v239.4c0 14.3 11.6 25.9 25.9 25.9H155c14.4-0.1 26-11.7 26-26.1zM668.6 181.2H845v176.4c0 14.3 11.6 25.9 25.9 25.9H902c14.3 0 25.9-11.6 25.9-25.9V118.2c0-11-9-20-20-20H668.6c-14.3 0-25.9 11.6-25.9 25.9v31.1c0 14.3 11.6 26 25.9 26zM357.4 845.2H181V668.8c0-14.3-11.6-25.9-25.9-25.9H124c-14.3 0-25.9 11.6-25.9 25.9v239.4c0 11 9 20 20 20h239.4c14.3 0 25.9-11.6 25.9-25.9v-31.1c-0.1-14.4-11.7-26-26-26zM845 668.8v176.4H668.6c-14.3 0-25.9 11.6-25.9 25.9v31.1c0 14.3 11.6 25.9 25.9 25.9H908c11 0 20-9 20-20V668.8c0-14.3-11.6-25.9-25.9-25.9H871c-14.4 0-26 11.6-26 25.9z',
- onclick: function () {
- const element = document.getElementById('chart_right2');
- if (!screenfull.isEnabled) {//判断是否支持全屏
- this.$message({
- message: '您的浏览器暂时不支持全屏切换',
- type: 'warning'
- })
- return false
- }
- screenfull.toggle(element)
- },
- }
- },
- },
- tooltip: {
- trigger: 'item',
- formatter: '{b} : {c} ({d}%)'
- },
- polar: {},
- angleAxis: {
- interval: 1,
- type: 'category',
- data: [],
- z: 10,
- axisLine: {
- show: false,
- lineStyle: {
- color: '#0B4A6B',
- width: 5,
- type: 'solid'
- },
- },
- axisLabel: {
- interval: 0,
- show: true,
- color: '#0B4A6B',
- margin: 8,
- fontSize: 16
- },
- },
- radiusAxis: {
- min: 40,
- max: 120,
- interval: 20,
- axisLine: {
- show: false,
- lineStyle: {
- color: '#0B3E5E',
- width: 1,
- type: 'solid'
- },
- },
- axisLabel: {
- formatter: '{value} %',
- show: false,
- padding: [0, 0, 20, 0],
- color: '#0B3E5E',
- fontSize: 16
- },
- splitLine: {
- lineStyle: {
- color: '#0B3E5E',
- width: 2,
- type: "solid"
- }
- }
- },
- calculable: true,
- series: [{
- type: 'pie',
- radius: ['6%', '10%'],
- hoverAnimation: false,
- labelLine: {
- normal: {
- show: false,
- length: 30,
- length2: 50
- },
- emphasis: {
- show: false
- }
- },
- tooltip: {
- show: false
- },
- data: [{
- name: '',
- value: 0,
- itemStyle: {
- normal: {
- color: '#0B4A6B'
- }
- }
- }]
- }, {
- type: 'pie',
- radius: ['90%', '95%'],
- hoverAnimation: false,
- labelLine: {
- normal: {
- show: false,
- length: 30,
- length2: 50
- },
- emphasis: {
- show: false
- }
- },
- tooltip: {
- show: false
- },
- data: [{
- name: '',
- value: 0,
- itemStyle: {
- normal: {
- color: '#0B4A6B'
- }
- }
- }]
- },{
- stack: 'a',
- type: 'pie',
- radius: ['20%', '80%'],
- roseType: 'area',
- zlevel: 10,
- label: {
- normal: {
- show: true,
- formatter: '{b}',
- textStyle: {
- fontSize: 12,
- },
- position: 'outside'
- },
- emphasis: {
- show: false
- }
- },
- labelLine: {
- normal: {
- show: true,
- length: 15,
- length2: 50,
- lineStyle: {
- type: 'dotted'
- }
- },
- emphasis: {
- show: true
- }
- },
- data: [{
- value: 1173,
- name: '香港'
- },{
- value: 131,
- name: '台湾'
- },{
- value: 108,
- name: '上海'
- },{
- value: 41,
- name: '广东'
- },{
- value: 36,
- name: '四川'
- },{
- value: 22,
- name: '福建'
- },{
- value: 20,
- name: '内蒙古'
- }]
- }]
- }
- myChart.setOption(option, true);
- window.addEventListener('resize', () => {
- // myChart.resize();
- });
- },
- },
- beforeDestroy() {
- }
- };
- </script>
- <style lang="scss" scoped>
- .sn-container {
- width: 99%;
- height: 99%;
- //position: relative;
- .chart {
- height: 90%;
- width: 90%;
- margin-bottom: 1%;
- margin-left: 7%;
- }
- }
- </style>
|