|
@@ -12,6 +12,7 @@
|
|
|
<script>
|
|
<script>
|
|
|
// import { getPie3D, getParametricEquation } from 'chart.js' // 工具类js,页面路径自己修改
|
|
// import { getPie3D, getParametricEquation } from 'chart.js' // 工具类js,页面路径自己修改
|
|
|
import * as echarts from 'echarts'
|
|
import * as echarts from 'echarts'
|
|
|
|
|
+import { param } from '@/utils'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: 'Chart',
|
|
name: 'Chart',
|
|
@@ -200,6 +201,7 @@ export default {
|
|
|
typeof pieData[i].itemStyle.opacity !== 'undefined' ? itemStyle.opacity = pieData[i].itemStyle.opacity : null
|
|
typeof pieData[i].itemStyle.opacity !== 'undefined' ? itemStyle.opacity = pieData[i].itemStyle.opacity : null
|
|
|
|
|
|
|
|
seriesItem.itemStyle = itemStyle
|
|
seriesItem.itemStyle = itemStyle
|
|
|
|
|
+ // seriesItem.itemStyle = pieData[i].itemStyle
|
|
|
}
|
|
}
|
|
|
series.push(seriesItem)
|
|
series.push(seriesItem)
|
|
|
}
|
|
}
|
|
@@ -211,13 +213,47 @@ export default {
|
|
|
console.log(series[i])
|
|
console.log(series[i])
|
|
|
series[i].pieData.startRatio = startValue / sumValue
|
|
series[i].pieData.startRatio = startValue / sumValue
|
|
|
series[i].pieData.endRatio = endValue / sumValue
|
|
series[i].pieData.endRatio = endValue / sumValue
|
|
|
- series[i].parametricEquation = getParametricEquation(series[i].pieData.startRatio, series[i].pieData.endRatio, false, false, k, series[i].pieData.value)
|
|
|
|
|
|
|
+ series[i].parametricEquation = getParametricEquation(series[i].pieData.startRatio, series[i].pieData.endRatio, true, false, k, 1)
|
|
|
|
|
|
|
|
startValue = endValue
|
|
startValue = endValue
|
|
|
|
|
|
|
|
legendData.push(series[i].name)
|
|
legendData.push(series[i].name)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // 补充一个透明的圆环,用于支撑高亮功能的近似实现。
|
|
|
|
|
+ series.push({
|
|
|
|
|
+ name: 'mouseoutSeries',
|
|
|
|
|
+ type: 'surface',
|
|
|
|
|
+ parametric: true,
|
|
|
|
|
+ wireframe: {
|
|
|
|
|
+ show: false
|
|
|
|
|
+ },
|
|
|
|
|
+ itemStyle: {
|
|
|
|
|
+ opacity: 1,
|
|
|
|
|
+ color: 'rgba(255,255,255,0.02)'
|
|
|
|
|
+ },
|
|
|
|
|
+ parametricEquation: {
|
|
|
|
|
+ u: {
|
|
|
|
|
+ min: 0,
|
|
|
|
|
+ max: Math.PI * 2,
|
|
|
|
|
+ step: Math.PI / 20
|
|
|
|
|
+ },
|
|
|
|
|
+ v: {
|
|
|
|
|
+ min: 0,
|
|
|
|
|
+ max: Math.PI,
|
|
|
|
|
+ step: Math.PI / 1.4
|
|
|
|
|
+ },
|
|
|
|
|
+ x: function(u, v) {
|
|
|
|
|
+ return Math.sin(v) * Math.sin(u) + Math.sin(u)
|
|
|
|
|
+ },
|
|
|
|
|
+ y: function(u, v) {
|
|
|
|
|
+ return Math.sin(v) * Math.cos(u) + Math.cos(u)
|
|
|
|
|
+ },
|
|
|
|
|
+ z: function(u, v) {
|
|
|
|
|
+ return Math.cos(v) > 0 ? 0.1 : -0.1
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
// 准备待返回的配置项,把准备好的 legendData、series 传入。
|
|
// 准备待返回的配置项,把准备好的 legendData、series 传入。
|
|
|
const option = {
|
|
const option = {
|
|
|
tooltip: {
|
|
tooltip: {
|
|
@@ -227,9 +263,19 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ // visualMap: {
|
|
|
|
|
+ // show: false,
|
|
|
|
|
+ // dimension: 2,
|
|
|
|
|
+ // min: -1,
|
|
|
|
|
+ // max: 1,
|
|
|
|
|
+ // inRange: {
|
|
|
|
|
+ // // color: ['#000de4', '#4575b4', '#74add1',]
|
|
|
|
|
+ // }
|
|
|
|
|
+ // },
|
|
|
legend: {
|
|
legend: {
|
|
|
data: legendData,
|
|
data: legendData,
|
|
|
position: 'right',
|
|
position: 'right',
|
|
|
|
|
+ selectedMode: false,
|
|
|
right: '5%',
|
|
right: '5%',
|
|
|
top: '10%',
|
|
top: '10%',
|
|
|
// height: '',
|
|
// height: '',
|
|
@@ -239,6 +285,30 @@ export default {
|
|
|
fontSize: this.EchartfontSize(14)
|
|
fontSize: this.EchartfontSize(14)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ labelLine: {
|
|
|
|
|
+ show: true,
|
|
|
|
|
+ lineStyle: {
|
|
|
|
|
+ // color: '#7BC0CB'
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ label: {
|
|
|
|
|
+ show: true,
|
|
|
|
|
+ position: 'outside',
|
|
|
|
|
+ textStyle: {
|
|
|
|
|
+ color: '#ffffff',
|
|
|
|
|
+ fontSize: this.EchartfontSize(200)
|
|
|
|
|
+ }
|
|
|
|
|
+ // rich: {
|
|
|
|
|
+ // b: {
|
|
|
|
|
+ // color: '#7BC0CB',
|
|
|
|
|
+ // fontSize: this.EchartfontSize(20),
|
|
|
|
|
+ // lineHeight: this.EchartfontSize(100)
|
|
|
|
|
+ // },
|
|
|
|
|
+ // c: {
|
|
|
|
|
+ // fontSize: this.EchartfontSize(20)
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+ },
|
|
|
xAxis3D: {
|
|
xAxis3D: {
|
|
|
min: -1,
|
|
min: -1,
|
|
|
max: 1
|
|
max: 1
|
|
@@ -251,59 +321,101 @@ export default {
|
|
|
min: -1,
|
|
min: -1,
|
|
|
max: 1
|
|
max: 1
|
|
|
},
|
|
},
|
|
|
- labelLine: {
|
|
|
|
|
- show: true,
|
|
|
|
|
- lineStyle: {
|
|
|
|
|
- color: '#ffffff'
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- label: {
|
|
|
|
|
- show: true,
|
|
|
|
|
- position: 'outside',
|
|
|
|
|
- },
|
|
|
|
|
grid3D: {
|
|
grid3D: {
|
|
|
|
|
+ top: '-10%',
|
|
|
show: false,
|
|
show: false,
|
|
|
- boxHeight: 10,
|
|
|
|
|
|
|
+ boxHeight: 20,
|
|
|
environment: undefined,
|
|
environment: undefined,
|
|
|
viewControl: {
|
|
viewControl: {
|
|
|
- distance: 200,
|
|
|
|
|
|
|
+ distance: 260,
|
|
|
alpha: 25,
|
|
alpha: 25,
|
|
|
- beta: 130
|
|
|
|
|
|
|
+ // beta: 130,
|
|
|
|
|
+ beta: 0,
|
|
|
|
|
+ rotateSensitivity: 0, // 设置为0无法旋转
|
|
|
|
|
+ zoomSensitivity: 0, // 设置为0无法缩放
|
|
|
|
|
+ panSensitivity: 0, // 设置为0无法平移
|
|
|
|
|
+ autoRotate: false // 自动旋转
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
},
|
|
},
|
|
|
series: series
|
|
series: series
|
|
|
}
|
|
}
|
|
|
return option
|
|
return option
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 传入数据生成 option
|
|
|
|
|
- this.option = getPie3D([{
|
|
|
|
|
- name: '已消除',
|
|
|
|
|
|
|
+ const optionData = [{
|
|
|
|
|
+ name: '完成',
|
|
|
value: 3,
|
|
value: 3,
|
|
|
itemStyle: {
|
|
itemStyle: {
|
|
|
opacity: 0.5,
|
|
opacity: 0.5,
|
|
|
- color: 'rgba(0,127,244,.8)'
|
|
|
|
|
|
|
+ color: 'rgba(33,229,248,0.8)'
|
|
|
}
|
|
}
|
|
|
- },
|
|
|
|
|
|
|
|
|
|
- {
|
|
|
|
|
- name: '未消除',
|
|
|
|
|
|
|
+ }, {
|
|
|
|
|
+ name: '剩余',
|
|
|
value: 1,
|
|
value: 1,
|
|
|
itemStyle: {
|
|
itemStyle: {
|
|
|
opacity: 0.5,
|
|
opacity: 0.5,
|
|
|
- color: 'rgba(209,126,23,.8)'
|
|
|
|
|
|
|
+ color: 'rgba(217,187,62,0.8)'
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- ], 2)
|
|
|
|
|
|
|
+ ]
|
|
|
|
|
+
|
|
|
|
|
+ // 传入数据生成 option
|
|
|
|
|
+ this.option = getPie3D(optionData, 0)
|
|
|
|
|
+
|
|
|
|
|
+ this.option.series.push({
|
|
|
|
|
+ name: '', // 自己根据场景修改
|
|
|
|
|
+ type: 'pie',
|
|
|
|
|
+ hoverAnimation: false, // 悬停不放大
|
|
|
|
|
+ labelLine: {
|
|
|
|
|
+ length: this.EchartfontSize(30),
|
|
|
|
|
+ length2: this.EchartfontSize(20)
|
|
|
|
|
+ },
|
|
|
|
|
+ label: {
|
|
|
|
|
+ position: 'outside',
|
|
|
|
|
+ textStyle: {
|
|
|
|
|
+ color: '#ffffff',
|
|
|
|
|
+ fontSize: this.EchartfontSize(13)
|
|
|
|
|
+ },
|
|
|
|
|
+ formatter: (params) => {
|
|
|
|
|
+ const arr = [
|
|
|
|
|
+ `{a|${params.name}}`,
|
|
|
|
|
+ `{b|${params.value}}`
|
|
|
|
|
+ ]
|
|
|
|
|
+ return arr.join(' ')
|
|
|
|
|
+ },
|
|
|
|
|
+ rich: {
|
|
|
|
|
+ a: {
|
|
|
|
|
+ color: '#ffffff',
|
|
|
|
|
+ fontSize: this.EchartfontSize(13)
|
|
|
|
|
+ },
|
|
|
|
|
+ b: {
|
|
|
|
|
+ color: 'rgba(33,229,248)',
|
|
|
|
|
+ fontSize: this.EchartfontSize(13),
|
|
|
|
|
+ verticalAlign: 'top',
|
|
|
|
|
+ align: 'center'
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ startAngle: 25, // 起始角度,支持范围[0, 360]。
|
|
|
|
|
+ clockwise: false, // 饼图的扇区是否是顺时针排布。上述这两项配置主要是为了对齐3d的样式
|
|
|
|
|
+ radius: ['50%', '50%'],
|
|
|
|
|
+ center: ['50%', '58%'],
|
|
|
|
|
+ data: optionData,
|
|
|
|
|
+ itemStyle: {
|
|
|
|
|
+ opacity: 0 // 这里必须是0,不然2d的图会覆盖在表面
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
-<style lang='less' scoped>
|
|
|
|
|
|
|
+<style lang="less" scoped>
|
|
|
.chart-container {
|
|
.chart-container {
|
|
|
position: relative;
|
|
position: relative;
|
|
|
width: 100%;
|
|
width: 100%;
|
|
@@ -325,13 +437,13 @@ export default {
|
|
|
left: 0;
|
|
left: 0;
|
|
|
right: 0;
|
|
right: 0;
|
|
|
top: 0;
|
|
top: 0;
|
|
|
- bottom: -1vw;
|
|
|
|
|
|
|
+ bottom: -5vw;
|
|
|
z-index: 1;
|
|
z-index: 1;
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
background-repeat: no-repeat;
|
|
background-repeat: no-repeat;
|
|
|
background-image: url('/static/images/chart_opacity_bg.png');
|
|
background-image: url('/static/images/chart_opacity_bg.png');
|
|
|
- background-size: 60% 80%;
|
|
|
|
|
- background-position: center 70%;
|
|
|
|
|
|
|
+ background-size: 22vh 15vh;
|
|
|
|
|
+ background-position: center 28%;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
</style>
|
|
</style>
|