123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363 |
- let app = new Vue({
- el: '#app',
- data () {
- return {
- time: '',
- timer: '',
- }
- },
- created () {
- this.time = formatDate()
- this.timer = setInterval(() => {
- this.time = formatDate()
- })
- },
- beforeDestroy () {
- if (this.timer) {
- clearInterval(this.timer);
- }
- },
- mounted () {
- setTimeout(() => {
- this.initChart1()
- this.initChart2()
- this.initChart3()
- this.initChart4()
- this.initChart5()
- })
- },
- methods: {
- format (percentage) {
- return '230.10亿'
- },
- initChart1 () {
- let myChart = echarts.init(this.$refs['echart1'])
- let option = {
- tooltip: {
- trigger: 'item',
- },
- legend: {
- bottom: '5%',
- orient: 'vertical',
- textStyle: {
- color: '#9DB9EB',
- },
- data: ['先进产能', '传统产能']
- },
- series: [
- {
- name: '',
- type: 'pie',
- radius: ['40%', '50%'],
- center: ['50%', '40%'],
- labelLine: {
- normal: {
- lineStyle: {
- width: 1,
- },
- },
- },
- data: [
- { value: 1048, name: '先进产能' },
- { value: 735, name: '传统产能' }
- ],
- itemStyle: {
- normal: {
- color: function (colors) {
- var colorList = ['#a79c57', '#cc8c29', '#91a65f', '#383062', '#034a39'];
- return colorList[colors.dataIndex];
- }
- },
- },
- label: {
- normal: {
- show: false,
- },
- },
- labelLine: {
- normal: {
- show: false
- }
- },
- },
- ],
- }
- myChart.setOption(option)
- tools.loopShowTooltip(myChart, option, {
- nterval: 10000,
- loopSeries: true,
- })
- },
- initChart2 () {
- let myChart = echarts.init(this.$refs['echart2'])
- option = {
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow',
- },
- },
- grid: {
- top: '15%',
- right: '10',
- left: '30',
- bottom: '10%',
- },
- xAxis: {
- data: ['2020', '2021', '2022'],
- axisLine: {
- show: true, //隐藏X轴轴线
- lineStyle: {
- color: '#005094',
- width: 1,
- },
- },
- axisTick: {
- show: true, //隐藏X轴刻度
- },
- axisLabel: {
- show: true,
- rotate: 15,
- textStyle: {
- color: 'rgba(255,255,255,0.6)', //X轴文字颜色
- fontSize: 12,
- },
- },
- },
- yAxis: [
- {
- name: '单位亿吨',
- type: 'value',
- nameTextStyle: {//y轴上方单位的颜色
- color: '#fff',
- fontSize: '10px'
- },
- splitLine: {
- show: true,
- lineStyle: {
- color: '#68b4dd66',
- type: 'dashed',
- },
- },
- axisLine: {
- show: false
- },
- axisLabel: {
- show: true,
- formatter: '{value}',
- textStyle: {
- color: 'rgba(250,250,250,0.6)',
- },
- },
- },
- ],
- series: [
- {
- name: '实际值',
- type: 'bar',
- barWidth: 15,
- itemStyle: {
- normal: {
- color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
- {
- offset: 0,
- color: '#69c0ff',
- },
- {
- offset: 1,
- color: '#082550',
- },
- ]),
- },
- },
- data: [70, 52, 33],
- }
- ],
- }
- myChart.setOption(option);
- tools.loopShowTooltip(myChart, option, {
- nterval: 2000,
- loopSeries: true,
- });
- },
- initChart3 () {
- let myChart = echarts.init(this.$refs['echart3'])
- let option = {
- tooltip: {
- trigger: 'item',
- },
- legend: {
- bottom: '5%',
- orient: 'vertical',
- textStyle: {
- color: '#9DB9EB',
- },
- data: ['先进产能', '传统产能']
- },
- series: [
- {
- name: '',
- type: 'pie',
- radius: ['40%', '50%'],
- center: ['50%', '40%'],
- labelLine: {
- normal: {
- lineStyle: {
- width: 1,
- },
- },
- },
- data: [
- { value: 1048, name: '先进产能' },
- { value: 735, name: '传统产能' }
- ],
- itemStyle: {
- normal: {
- color: function (colors) {
- var colorList = ['#a79c57', '#cc8c29', '#91a65f', '#383062', '#034a39'];
- return colorList[colors.dataIndex];
- }
- },
- },
- label: {
- normal: {
- show: false,
- },
- },
- labelLine: {
- normal: {
- show: false
- }
- },
- },
- ],
- }
- myChart.setOption(option)
- tools.loopShowTooltip(myChart, option, {
- nterval: 10000,
- loopSeries: true,
- })
- },
- initChart4 () {
- let myChart = echarts.init(this.$refs['echart4'])
- let option = {
- tooltip: {
- trigger: 'item',
- },
- legend: {
- bottom: '5%',
- orient: 'horizontal',
- textStyle: {
- color: '#9DB9EB',
- },
- data: ['产业转型', '数字化转型', '其他项目']
- },
- series: [
- {
- name: '',
- type: 'pie',
- radius: ['40%', '50%'],
- center: ['50%', '40%'],
- labelLine: {
- normal: {
- lineStyle: {
- width: 1,
- },
- },
- },
- data: [
- { value: 1048, name: '产业转型' },
- { value: 735, name: '数字化转型' },
- { value: 735, name: '其他项目' }
- ],
- itemStyle: {
- normal: {
- color: function (colors) {
- var colorList = ['#a79c57', '#cc8c29', '#91a65f', '#383062', '#034a39'];
- return colorList[colors.dataIndex];
- }
- },
- },
- label: {
- normal: {
- show: false,
- },
- },
- labelLine: {
- normal: {
- show: false
- }
- },
- },
- ],
- }
- myChart.setOption(option)
- tools.loopShowTooltip(myChart, option, {
- nterval: 10000,
- loopSeries: true,
- })
- },
- initChart5 () {
- let myChart = echarts.init(this.$refs['echart5'])
- let option = {
- tooltip: {
- trigger: 'item',
- },
- legend: {
- bottom: '5%',
- orient: 'horizontal',
- textStyle: {
- color: '#9DB9EB',
- },
- data: ['传统产业改造提升', '战略性新兴产业发展壮大']
- },
- series: [
- {
- name: '',
- type: 'pie',
- radius: ['40%', '50%'],
- center: ['50%', '40%'],
- labelLine: {
- normal: {
- lineStyle: {
- width: 1,
- },
- },
- },
- data: [
- { value: 1048, name: '传统产业改造提升' },
- { value: 735, name: '战略性新兴产业发展壮大' }
- ],
- itemStyle: {
- normal: {
- color: function (colors) {
- var colorList = ['#a79c57', '#cc8c29', '#91a65f', '#383062', '#034a39'];
- return colorList[colors.dataIndex];
- }
- },
- },
- label: {
- normal: {
- show: false,
- },
- },
- labelLine: {
- normal: {
- show: false
- }
- },
- },
- ],
- }
- myChart.setOption(option)
- tools.loopShowTooltip(myChart, option, {
- nterval: 10000,
- loopSeries: true,
- })
- },
- },
- })
|