|
@@ -1,38 +1,38 @@
|
|
<template>
|
|
<template>
|
|
- <div class="wrap-container sn-container" id="cityrank">
|
|
|
|
- <div class="sn-content">
|
|
|
|
- <div class="sn-title">柱状图</div>
|
|
|
|
- <div class="sn-body">
|
|
|
|
- <div class="wrap-container">
|
|
|
|
- <div class="chart" id="chart_left1"></div>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
|
|
+ <div class="wrap-container sn-container" id="cityrank">
|
|
|
|
+ <div class="sn-content">
|
|
|
|
+ <div class="sn-title">柱状图</div>
|
|
|
|
+ <div class="sn-body">
|
|
|
|
+ <div class="wrap-container">
|
|
|
|
+ <div class="chart" id="chart_left1"></div>
|
|
|
|
+ </div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
+ </div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
- import screenfull from "screenfull";
|
|
|
|
|
|
+import screenfull from "screenfull";
|
|
|
|
|
|
- export default {
|
|
|
|
- name: "CityRank",
|
|
|
|
- data() {
|
|
|
|
- return {
|
|
|
|
- fullscreen: false
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- mounted() {
|
|
|
|
- this.getEchartLeft1();
|
|
|
|
- },
|
|
|
|
- methods: {
|
|
|
|
- getEchartLeft1() {
|
|
|
|
- // 实例化对象
|
|
|
|
- let myChart = echarts.init(document.getElementById('chart_left1'));
|
|
|
|
- let charts = { // 按顺序排列从大到小
|
|
|
|
- cityList: ['湖北', '香港', '广东', '湖南', '四川', '浙江', '上海'],
|
|
|
|
- cityData: [68149, 8300, 2035, 1020, 843, 1300, 1473],
|
|
|
|
- function(p) {
|
|
|
|
- return p.name + ":" + this.cityData(p.value);
|
|
|
|
|
|
+export default {
|
|
|
|
+ name: "CityRank",
|
|
|
|
+ data() {
|
|
|
|
+ return {
|
|
|
|
+ fullscreen: false
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ mounted() {
|
|
|
|
+ this.getEchartLeft1();
|
|
|
|
+ },
|
|
|
|
+ methods: {
|
|
|
|
+ getEchartLeft1() {
|
|
|
|
+ // 实例化对象
|
|
|
|
+ let myChart = echarts.init(document.getElementById('chart_left1'));
|
|
|
|
+ let charts = { // 按顺序排列从大到小
|
|
|
|
+ cityList: ['湖北', '香港', '广东', '湖南', '四川', '浙江', '上海'],
|
|
|
|
+ cityData: [68149, 8300, 2035, 1020, 843, 1300, 1473],
|
|
|
|
+ function(p) {
|
|
|
|
+ return p.name + ":" + this.cityData(p.value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -73,47 +73,48 @@
|
|
|
|
|
|
// 指定配置和数据
|
|
// 指定配置和数据
|
|
let option = {
|
|
let option = {
|
|
- 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_left1');
|
|
|
|
- if (!screenfull.isEnabled) {//判断是否支持全屏
|
|
|
|
- this.$message({
|
|
|
|
- message: '您的浏览器暂时不支持全屏切换',
|
|
|
|
- type: 'warning'
|
|
|
|
- })
|
|
|
|
- return false
|
|
|
|
- }
|
|
|
|
- screenfull.toggle(element)
|
|
|
|
|
|
+ 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_left1');
|
|
|
|
+ if (!screenfull.isEnabled) {
|
|
|
|
+ //判断是否支持全屏
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '您的浏览器暂时不支持全屏切换',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ })
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ screenfull.toggle(element)
|
|
|
|
|
|
- },
|
|
|
|
- }
|
|
|
|
},
|
|
},
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- color: color,
|
|
|
|
- tooltip: {
|
|
|
|
- trigger: 'item',
|
|
|
|
|
|
+ },
|
|
|
|
+ color: color,
|
|
|
|
+ tooltip: {
|
|
|
|
+ trigger: 'item',
|
|
|
|
+ },
|
|
|
|
+ grid: {
|
|
|
|
+ borderWidth: 0,
|
|
|
|
+ top: '5%',
|
|
|
|
+ left: '2%',
|
|
|
|
+ right: '2%',
|
|
|
|
+ bottom: '0%',
|
|
|
|
+ containLabel: true
|
|
|
|
+ },
|
|
|
|
+ xAxis: [{
|
|
|
|
+ type: 'value',
|
|
|
|
+ axisTick: {
|
|
|
|
+ show: false
|
|
},
|
|
},
|
|
- grid: {
|
|
|
|
- borderWidth: 0,
|
|
|
|
- top: '5%',
|
|
|
|
- left: '2%',
|
|
|
|
- right: '2%',
|
|
|
|
- bottom: '0%',
|
|
|
|
- containLabel: true
|
|
|
|
|
|
+ axisLine: {
|
|
|
|
+ show: false
|
|
},
|
|
},
|
|
- xAxis: [{
|
|
|
|
- type: 'value',
|
|
|
|
- axisTick: {
|
|
|
|
- show: false
|
|
|
|
- },
|
|
|
|
- axisLine: {
|
|
|
|
- show: false
|
|
|
|
- },
|
|
|
|
splitLine: {
|
|
splitLine: {
|
|
show: false
|
|
show: false
|
|
},
|
|
},
|
|
@@ -207,6 +208,7 @@
|
|
.sn-container {
|
|
.sn-container {
|
|
width: 99%;
|
|
width: 99%;
|
|
height: 99%;
|
|
height: 99%;
|
|
|
|
+
|
|
.chart {
|
|
.chart {
|
|
height: 99%;
|
|
height: 99%;
|
|
width: 99%;
|
|
width: 99%;
|