| | |
| | | components: {}, |
| | | data() { |
| | | //这里存放数据 |
| | | return {}; |
| | | return { myChart }; |
| | | }, |
| | | mounted() { |
| | | this.lineChart(); |
| | | this.$bus.$on('resizeEchart', (res) => { |
| | | this.myChart.resize(); |
| | | }); |
| | | }, |
| | | //方法集合 |
| | | methods: { |
| | | lineChart() { |
| | | let option = { |
| | | title: { |
| | | text: "人员构成", |
| | | text: '人员构成', |
| | | textStyle: { |
| | | color: "#fff", |
| | | color: '#fff', |
| | | }, |
| | | }, |
| | | tooltip: { |
| | | trigger: "axis", |
| | | trigger: 'axis', |
| | | axisPointer: { |
| | | type: "shadow", |
| | | type: 'shadow', |
| | | }, |
| | | }, |
| | | // legend: {}, |
| | | grid: { |
| | | left: "0%", |
| | | right: "4%", |
| | | bottom: "0%", |
| | | left: '0%', |
| | | right: '4%', |
| | | bottom: '0%', |
| | | containLabel: true, |
| | | }, |
| | | xAxis: { |
| | | type: "value", |
| | | type: 'value', |
| | | boundaryGap: [0, 0.01], |
| | | axisLine: { |
| | | lineStyle: { |
| | | color: "#ccc", |
| | | color: '#ccc', |
| | | }, |
| | | }, |
| | | axisLabel: { |
| | | show: true, |
| | | textStyle: { |
| | | color: "#fff", |
| | | color: '#fff', |
| | | }, |
| | | }, |
| | | }, |
| | | yAxis: { |
| | | type: "category", |
| | | data: ["专科", "本科", "硕士", "博士及以上", "其他"], |
| | | type: 'category', |
| | | data: ['专科', '本科', '硕士', '博士及以上', '其他'], |
| | | axisLine: { |
| | | lineStyle: { |
| | | color: "#ccc", |
| | | color: '#ccc', |
| | | }, |
| | | }, |
| | | axisLabel: { |
| | | show: true, |
| | | textStyle: { |
| | | color: "#fff", |
| | | color: '#fff', |
| | | }, |
| | | }, |
| | | }, |
| | | series: [ |
| | | { |
| | | name: "人员构成", |
| | | type: "bar", |
| | | name: '人员构成', |
| | | type: 'bar', |
| | | // barWidth: 20, |
| | | data: [15, 120, 50, 40, 20], |
| | | itemStyle: { |
| | |
| | | barBorderRadius: [0, 10, 10, 0], |
| | | color: (params) => { |
| | | var colorList = [ |
| | | ["#00FCFF", "#008297"], |
| | | ["#0091FF", "#005EA4"], |
| | | ["#901698", "#F157EE"], |
| | | ["#40FBCB", "#009871"], |
| | | ["#FF515A", "#FFDD53"], |
| | | ["#6574E2", "#261164"], |
| | | ['#00FCFF', '#008297'], |
| | | ['#0091FF', '#005EA4'], |
| | | ['#901698', '#F157EE'], |
| | | ['#40FBCB', '#009871'], |
| | | ['#FF515A', '#FFDD53'], |
| | | ['#6574E2', '#261164'], |
| | | ]; |
| | | var colorItem = colorList[params.dataIndex]; |
| | | return new this.$echarts.graphic.LinearGradient( |
| | |
| | | }, |
| | | ], |
| | | }; |
| | | let myChart = this.$echarts.init(document.getElementById("echart35")); |
| | | myChart.setOption(option); |
| | | window.addEventListener("resize", function () { |
| | | myChart.resize(); |
| | | this.myChart = this.$echarts.init(document.getElementById('echart35')); |
| | | this.myChart.setOption(option); |
| | | window.addEventListener('resize', function () { |
| | | this.myChart.resize(); |
| | | }); |
| | | }, |
| | | }, |