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: {
initChart1 () {
let myChart = echarts.init(this.$refs['echart1'])
let option = {
tooltip: {
formatter: data => {
return `${data[0].name}
${data[0].seriesName}:${data[0].value}亿
${data[1].seriesName}:${data[1].value}亿`
},
trigger: 'axis',
// axisPointer: {
// type: 'cross',
// },
},
grid: {
top: '16%',
right:'3%',
left: '5%',
bottom: '15%',
},
legend: {
data: ["预算额", "已签合同额",'产值认定额','结算额','结算额'],
x:'center',
y:'10px',
textStyle: {
color: 'rgba(250,250,250,0.6)',
},
},
xAxis: {
data: title.map(item=>item.name),
axisLine: {
show: true, //隐藏X轴轴线
lineStyle: {
color: '#005094',
width: 1,
},
},
axisTick: {
show: false, //隐藏X轴刻度
},
axisLabel: {
show: true,
rotate: 40,
textStyle: {
color: '#fff',//'rgba(255,255,255,0.6)', //X轴文字颜色
},
},
},
yAxis: [
{
type: 'value',
name: '亿元',
nameTextStyle: {
color: 'rgba(255,255,255,0.6)',
},
splitLine: {
show: true,
lineStyle: {
color: '#68b4dd66',
type: 'dashed',
},
},
axisLine: {
show: true,
lineStyle: {
color: '#3D7495',
},
},
axisLabel: {
show: true,
textStyle: {
color: 'rgba(250,250,250,0.6)',
},
},
},
],
series: [
{
name: '预算额',
type: 'bar',
barWidth: 5,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#71D5FF',
},
{
offset: 1,
color: '#082550',
},
]),
},
},
data: title.map(item=>item.value),
},
{
name: '已签合同额',
type: 'bar',
barWidth: 5,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#4D6FF6',
},
{
offset: 1,
color: '#082550',
},
]),
},
},
data: title.map(item=>item.value2),
},
{
name: '产值认定额',
type: 'bar',
barWidth: 5,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#877CFC',
},
{
offset: 1,
color: '#082550',
},
]),
},
},
data: title.map(item=>item.value2),
},
{
name: '结算额',
type: 'bar',
barWidth: 5,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#52BF80',
},
{
offset: 1,
color: '#082550',
},
]),
},
},
data: title.map(item=>item.value2),
},
{
name: '付款额',
type: 'bar',
barWidth: 5,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#CADD62',
},
{
offset: 1,
color: '#082550',
},
]),
},
},
data: title.map(item=>item.value2),
},
],
}
myChart.setOption(option)
tools.loopShowTooltip(myChart, option, {
nterval: 2000,
loopSeries: true,
})
},
initChart2 () {
let myChart = echarts.init(this.$refs['echart2'])
let option = {
title: {
text: '固定资产',
textStyle: {
color: '#69C0FF',
fontSize: 16,
fontWeight: 500
},
top: '10',
left: '10'
},
textStyle: {
color: '#fff',
},
tooltip: {
trigger: "axis",
formatter: function (params) {
var tip = params[0].axisValue + '
' + params[0].marker + params[0].data[1] + ':' + params[0].data[2] + '个,' + params[0].data[3] + '亿元' + '
' + params[1].marker + params[1].data[1] + ':' + params[1].data[2] + '个,' + params[1].data[3] + '亿元';
return tip
},
axisPointer: {
lineStyle: {
type: 'dashed',
width: 2,
color: 'rgba(255,255,255,0.6)'
},
animation: true
}
},
grid: {
top: '25%',
right: '5%',
left: '15%',
bottom: '15%',
},
yAxis: {
type:'value',
splitLine: {
show: true,
lineStyle: {
color: '#68b4dd66',
type: 'dashed',
},
},
axisLine: {
show: false
},
axisLabel: {
show: true,
formatter: '{value}',
textStyle: {
color: 'rgba(250,250,250,0.6)',
},
},
nameTextStyle: {
color: '#ebf8ac',
fontSize: 16,
},
},
xAxis: {
type:'value',
axisLine: {
show: true, //隐藏X轴轴线
lineStyle: {
color: '#005094',
width: 1,
},
},
axisTick: {
show: false, //隐藏X轴刻度
},
axisLabel: {
show: true,
textStyle: {
color: 'rgba(255,255,255,0.6)', //X轴文字颜色
fontSize: 12,
},
},
},
series: [
// {
// name: '特别监管',
// type: 'scatter',
// symbol: 'circle',//'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'
// symbolSize: function (data) {
// return Math.sqrt(data[2]) * 3;
// },
// label: {
// emphasis: {
// show: true,
// formatter: function (param) {
// return param.data[2];
// },
// position: 'top'
// }
// },
// itemStyle: {
// normal: {
// color: '#40A9FF'
// }
// },
// data: [
// ['项目储备', '特别监管', 14, 12.05],
// ['项目立项', '特别监管', 2, 1.25],
// ['可研论证', '特别监管', 10, 32.69],
// ['投资决策', '特别监管', 15, 28.53],
// ]
// },
// {
// name: '备案',
// type: 'scatter',
// symbol: 'circle',//'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'
// symbolSize: function (data) {
// return Math.sqrt(data[2]) * 3;
// },
// label: {
// emphasis: {
// show: true,
// formatter: function (param) {
// return param.data[2];
// },
// position: 'top'
// }
// },
// itemStyle: {
// normal: {
// color: '#45DAD1'
// }
// },
// data: [
// ['项目储备', '备案', 27, 23.86],
// ['项目立项', '备案', 1, 1.05],
// ['可研论证', '备案', 14, 18.46],
// ['投资决策', '备案', 40, 38.86],
// ]
// },
]
}
myChart.setOption(option)
tools.loopShowTooltip(myChart, option, {
nterval: 2000,
loopSeries: true,
})
},
initChart3 () {
let myChart = echarts.init(this.$refs['echart3'])
let option = {
tooltip: {
formatter: data => {
return `${data[0].name}
${data[0].seriesName}:${data[0].value}亿
${data[1].seriesName}:${data[1].value}亿`
},
trigger: 'axis',
// axisPointer: {
// type: 'cross',
// },
},
grid: {
top: '16%',
right:'3%',
left: '10%',
bottom: '25%',
},
legend: {
data: ["高风险", "中风险",'低风险'],
x:'center',
y:'10px',
textStyle: {
color: 'rgba(250,250,250,0.6)',
},
},
xAxis: {
data: title.map(item=>item.name),
axisLine: {
show: true, //隐藏X轴轴线
lineStyle: {
color: '#005094',
width: 1,
},
},
axisTick: {
show: false, //隐藏X轴刻度
},
axisLabel: {
show: true,
rotate: 40,
textStyle: {
color: '#fff',//'rgba(255,255,255,0.6)', //X轴文字颜色
},
},
},
yAxis: [
{
type: 'value',
name: '亿元',
nameTextStyle: {
color: 'rgba(255,255,255,0.6)',
},
splitLine: {
show: true,
lineStyle: {
color: '#68b4dd66',
type: 'dashed',
},
},
axisLine: {
show: true,
lineStyle: {
color: '#3D7495',
},
},
axisLabel: {
show: true,
textStyle: {
color: 'rgba(250,250,250,0.6)',
},
},
},
],
series: [
{
name: '高风险',
type: 'bar',
barWidth: 5,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#69c0ff',
},
{
offset: 1,
color: '#082550',
},
]),
},
},
data: echart3.map(item=>item.value),
},
{
name: '中风险',
type: 'bar',
barWidth: 5,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#957DFF',
},
{
offset: 1,
color: '#082550',
},
]),
},
},
data: echart3.map(item=>item.value2),
},
{
name: '低风险',
type: 'bar',
barWidth: 5,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#957DFF',
},
{
offset: 1,
color: '#082550',
},
]),
},
},
data: echart3.map(item=>item.value3),
},
],
}
myChart.setOption(option)
tools.loopShowTooltip(myChart, option, {
nterval: 2000,
loopSeries: true,
})
},
initChart4 () {
let myChart = echarts.init(this.$refs['echart4'])
option = {
title: {
text: ''
},
legend: {
data: ['类型1', '类型2', '类型3', '类型4', '类型5'],
textStyle: {
color: '#9DB9EB',
},
},
splitArea: { // 坐标轴在 grid 区域中的分隔区域,默认不显示。
show: true,
areaStyle: { // 分隔区域的样式设置。
color: ['yellow'],
// 分隔区域颜色。分隔区域会按数组中颜色的顺序依次循环设置颜色。默认是一个深浅的间隔色。
}
},
radar: {
// shape: 'circle',
center: ['50%', '60%'],
radius: 40,
indicator: [
{ name: '类型1', max: 100000 },
{ name: '类型2', max: 100000 },
{ name: '类型3', max: 100000 },
{ name: '类型4', max: 100000 },
{ name: '类型5', max: 100000 },
],
axisLine: { // 设置雷达图中间射线的颜色
lineStyle: {
color: '#c0c0c0',
},
},
splitLine: { //网格颜色设置
show: true,
lineStyle: {
width: 1,
color: '#1e83e4',
},
},
splitArea: { //设置图表颜色,show的值为true
show: false,
areaStyle: {
// color:"#c1ddf8", //一般设置方式
//设置渐变背景色 new echarts.graphic.LinearGradient(a,b,c,d,arr)
//a ,b,c,d值可为0,1 a:1表示arr中的颜色右到左;c:1 arr中的颜色左到右
//b:1表示arr中的颜色下到上;d:1表示arr中的颜色上到下
color: new echarts.graphic.LinearGradient(0, 1, 0, 0, [
{ offset: 0, color: '#c1ddf8' }, // 0% 处的颜色
{ offset: 1, color: '#1e83e4' }// 100% 处的颜色
], false)
}
}
},
series: [
{
name: '',
type: 'radar',
symbol: 'circle', // 单个数值点的样式,还可以取值'rect','angle'等
symbolSize: 0, // 数值点的大小
data: [
{
value: echart4[0],
name: '类型1',
itemStyle: { //该数值区域样式设置
normal: {
color: '#2CC6FF', //背景颜色,还需设置areaStyle
lineStyle: {
color: '#2CC6FF', //边框颜色
},
},
},
label: { //显示value中具体的数值
normal: {
show: false,
textStyle: { //更改数值样式
color: '#43EDE3'
}
},
},
areaStyle: { //设置区域背景颜色透明度
normal: {
width: 1,
opacity: 0.8,
},
},
},
{
value: echart4[1],
name: '类型2',
itemStyle: { //该数值区域样式设置
normal: {
color: '#D87AFF', //背景颜色,还需设置areaStyle
lineStyle: {
color: '#2CC6FF', //边框颜色
},
},
},
label: { //显示value中具体的数值
normal: {
show: false,
textStyle: { //更改数值样式
color: '#43EDE3'
}
},
},
areaStyle: { //设置区域背景颜色透明度
normal: {
width: 1,
opacity: 0.8,
},
},
}
]
}
]
};
tools.loopShowTooltip(myChart, option, {
interval: 2000,
loopSeries: true,
});
myChart.setOption(option)
},
initChart5 () {
let myChart = echarts.init(this.$refs['echart5'])
let option = {
tooltip: {
formatter: data => {
return `${data[0].name}
${data[0].seriesName}:${data[0].value}亿
${data[1].seriesName}:${data[1].value}亿`
},
trigger: 'axis',
// axisPointer: {
// type: 'cross',
// },
},
grid: {
top: '16%',
right:'3%',
left: '3%',
bottom: '25%',
},
legend: {
data: ["预算额", "合同额","结算额","支付额"],
x:'center',
y:'10px',
textStyle: {
color: 'rgba(250,250,250,0.6)',
},
},
xAxis: {
data: title.map(item=>item.name),
axisLine: {
show: true, //隐藏X轴轴线
lineStyle: {
color: '#005094',
width: 1,
},
},
axisTick: {
show: false, //隐藏X轴刻度
},
axisLabel: {
show: true,
rotate: 40,
textStyle: {
color: '#fff',//'rgba(255,255,255,0.6)', //X轴文字颜色
},
},
},
yAxis: [
{
type: 'value',
name: '亿元',
nameTextStyle: {
color: 'rgba(255,255,255,0.6)',
},
splitLine: {
show: true,
lineStyle: {
color: '#68b4dd66',
type: 'dashed',
},
},
axisLine: {
show: true,
lineStyle: {
color: '#3D7495',
},
},
axisLabel: {
show: true,
textStyle: {
color: 'rgba(250,250,250,0.6)',
},
},
},
],
series: [
{
name: '预算额',
type: 'bar',
barWidth: 10,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#69c0ff',
},
{
offset: 1,
color: '#082550',
},
]),
},
},
data: title.map(item=>item.value),
},
{
name: '合同额',
type: 'bar',
barWidth: 10,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#957DFF',
},
{
offset: 1,
color: '#082550',
},
]),
},
},
data:title.map(item=>item.value2),
},
{
name: '结算额',
type: 'bar',
barWidth: 10,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#957DFF',
},
{
offset: 1,
color: '#082550',
},
]),
},
},
data:title.map(item=>item.value3),
},
{
name: '支付额',
type: 'bar',
barWidth: 10,
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
{
offset: 0,
color: '#957DFF',
},
{
offset: 1,
color: '#082550',
},
]),
},
},
data:title.map(item=>item.value4),
},
],
}
myChart.setOption(option)
tools.loopShowTooltip(myChart, option, {
nterval: 2000,
loopSeries: true,
})
},
},
})