|
@@ -722,9 +722,10 @@
|
|
|
}, function(res) {
|
|
|
// 绑定数据到页面
|
|
|
if (res.success) {
|
|
|
+ console.log('res.data: ', res.data)
|
|
|
hyData = res.data.map(item => ({
|
|
|
value: item.zb, // 使用 amt 作为 value
|
|
|
- name: item.title, // 使用 title 作为 name
|
|
|
+ name: item.title + (item.id ? '_' + item.id : ''), // 使用 title 作为 name
|
|
|
}));
|
|
|
|
|
|
initHy();
|
|
@@ -892,21 +893,20 @@
|
|
|
trigger: 'item',
|
|
|
formatter: '{b}: {c} ({d}%)'
|
|
|
},
|
|
|
+ color: ['#1b9b06', '#dc1718', '#9908d7', '#faca1e',
|
|
|
+ '#FEE23D', '#249766', '#FF2123', '#C13DFF',],
|
|
|
series: [
|
|
|
{
|
|
|
- name: '饼图示例',
|
|
|
+ name: '饼图',
|
|
|
type: 'pie',
|
|
|
- radius: ['50%', '80%'],
|
|
|
- avoidLabelOverlap: false,
|
|
|
+ radius: ['50%', '78%'],
|
|
|
+ center: ['50%', '50%'],
|
|
|
labelLine: {
|
|
|
- length: 5,
|
|
|
- length2: 30,
|
|
|
+ length2: 80,
|
|
|
// maxSurfaceAngle: 80
|
|
|
},
|
|
|
- color: ['#FEE23D', '#249766', '#FF2123', '#C13DFF',],
|
|
|
-
|
|
|
label: {
|
|
|
- // alignTo: 'edge',
|
|
|
+ alignTo: 'edge',
|
|
|
position: 'outside',
|
|
|
// margin: 2,
|
|
|
formatter: '{data|{c}}{unit| %}\n{name|{b}}',
|
|
@@ -928,43 +928,148 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+ labelLayout: {
|
|
|
+ moveOverlap: 'shiftY',
|
|
|
+ height: 36,
|
|
|
+ },
|
|
|
itemStyle: {
|
|
|
- // borderWidth: 5,
|
|
|
- // borderColor: '#2971e0',
|
|
|
+ borderWidth: 1,
|
|
|
+ borderColor: '#7e7e7e',
|
|
|
},
|
|
|
- data: hyData,
|
|
|
- emphasis: {
|
|
|
- itemStyle: {
|
|
|
- shadowBlur: 200,
|
|
|
- shadowOffsetX: 0,
|
|
|
- shadowOffsetY: 0,
|
|
|
- shadowColor: '#296edf'
|
|
|
+ data: hyData.map((item, index) => (
|
|
|
+ {
|
|
|
+ ...item,
|
|
|
+ itemStyle: {
|
|
|
+ color: [
|
|
|
+ {
|
|
|
+ type: 'radial',
|
|
|
+ x: 0.5,
|
|
|
+ y: 0.5,
|
|
|
+ r: 0.5,
|
|
|
+ colorStops: [
|
|
|
+ {offset: 0, color: '#1bb705'},
|
|
|
+ {offset: 1, color: '#157c09'}
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'radial',
|
|
|
+ x: 0.5,
|
|
|
+ y: 0.5,
|
|
|
+ r: 0.5,
|
|
|
+ colorStops: [
|
|
|
+ {offset: 0, color: '#f72122'},
|
|
|
+ {offset: 1, color: '#a00104'}
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'radial',
|
|
|
+ x: 0.5,
|
|
|
+ y: 0.5,
|
|
|
+ r: 0.5,
|
|
|
+ colorStops: [
|
|
|
+ {offset: 0, color: '#55109f'},
|
|
|
+ {offset: 1, color: '#540b94'}
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'radial',
|
|
|
+ x: 0.5,
|
|
|
+ y: 0.5,
|
|
|
+ r: 0.5,
|
|
|
+ colorStops: [
|
|
|
+ {offset: 0, color: '#fcd62c'},
|
|
|
+ {offset: 1, color: '#f4b70c'}
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ ][index]
|
|
|
+ }
|
|
|
}
|
|
|
+ )),
|
|
|
+ emphasis: {
|
|
|
+ // itemStyle: {
|
|
|
+ // shadowBlur: 200,
|
|
|
+ // shadowOffsetX: 0,
|
|
|
+ // shadowOffsetY: 0,
|
|
|
+ // shadowColor: '#296edf'
|
|
|
+ // }
|
|
|
},
|
|
|
-
|
|
|
}
|
|
|
, {
|
|
|
- name: '外边框',
|
|
|
+ name: '内圈',
|
|
|
type: 'pie',
|
|
|
- clockWise: false,
|
|
|
- radius: ['83%', '83%'],//边框大小
|
|
|
- center: ['50%', '50%'],//边框位置
|
|
|
- // radius: ['80%', '85%'],
|
|
|
- data: [{
|
|
|
- value: 10,
|
|
|
- itemStyle: {
|
|
|
- normal: {
|
|
|
- borderWidth: 4,//设置边框粗细
|
|
|
- borderColor: '#2971e0'//边框颜色
|
|
|
+ radius: ['30%', '50%'],//边框大小
|
|
|
+ center: ['50%', '50%'],
|
|
|
+ label: {
|
|
|
+ show: false
|
|
|
+ },
|
|
|
+ itemStyle: {
|
|
|
+ shadowBlur: 5,
|
|
|
+ shadowColor: '#142213'
|
|
|
+ },
|
|
|
+ data: hyData.map((item, index) => (
|
|
|
+ {
|
|
|
+ ...item,
|
|
|
+ itemStyle: {
|
|
|
+ color: [
|
|
|
+ {
|
|
|
+ type: 'linear',
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ x2: 1,
|
|
|
+ y2: -1,
|
|
|
+ colorStops: [
|
|
|
+ { offset: 0, color: '#0d5e2a' },
|
|
|
+ { offset: 1, color: '#0c4e22' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'linear',
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ x2: 1,
|
|
|
+ y2: -1,
|
|
|
+ colorStops: [
|
|
|
+ { offset: 0, color: '#80152d' },
|
|
|
+ { offset: 1, color: '#720a23' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'linear',
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ x2: 1,
|
|
|
+ y2: -1,
|
|
|
+ colorStops: [
|
|
|
+ { offset: 0, color: '#55109f' },
|
|
|
+ { offset: 1, color: '#540b94' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ type: 'linear',
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ x2: 1,
|
|
|
+ y2: -1,
|
|
|
+ colorStops: [
|
|
|
+ { offset: 0, color: '#a27f25' },
|
|
|
+ { offset: 1, color: '#ae821d' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ ][index]
|
|
|
}
|
|
|
}
|
|
|
- }]
|
|
|
+ )),
|
|
|
+ emphasis: {
|
|
|
+ disabled: true,
|
|
|
+ scale: false,
|
|
|
+ label: {
|
|
|
+ show: false
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
],
|
|
|
-
|
|
|
};
|
|
|
-
|
|
|
+ console.log('option: ', option);
|
|
|
myChart5.setOption(option);
|
|
|
// 监听窗口大小变化,动态调整图表大小
|
|
|
window.addEventListener('resize', function() {
|