Browse Source

优化需求

master
xuhuajiao 3 months ago
parent
commit
35499a6298
  1. 2
      src/utils/index.js
  2. 26
      src/views/components/echarts/typePie.vue

2
src/utils/index.js

@ -380,7 +380,7 @@ export function downloadFile(obj, name, suffix) {
const link = document.createElement('a')
link.style.display = 'none'
link.href = url
const fileName = parseTime(new Date()) + '-' + name + '.' + suffix
const fileName = name + '.' + suffix
link.setAttribute('download', fileName)
document.body.appendChild(link)
link.click()

26
src/views/components/echarts/typePie.vue

@ -5,6 +5,8 @@
<script>
import echarts from 'echarts'
// import theme from './theme.json'
// echarts.registerTheme('customTheme', theme)
import resize from '@/views/dashboard/mixins/resize'
export default {
@ -73,7 +75,7 @@ export default {
},
drawChart() {
const chartDom = document.getElementById('maintype')
this.chart = echarts.init(chartDom)
this.chart = echarts.init(chartDom, 'light')
let option = null
option = {
tooltip: {
@ -103,8 +105,8 @@ export default {
{
name: '档案门类',
type: 'pie',
radius: ['30%', '80%'],
center: ['35%', '40%'], //
radius: ['30%', '70%'],
center: ['35%', '50%'], //
roseType: 'area',
avoidLabelOverlap: true,
labelLine: {
@ -120,15 +122,15 @@ export default {
formatter: ' {d}%' // 线
},
borderColor: '#fff',
borderWidth: 4,
color: function(params) {
var colorItem = ['#0348F3', '#14C9C9', '#F8B722', '#722ED1', '#F4647B']
var colorList = []
for (var i = 0; i < option.series[0].data.length; i++) {
colorList.push(colorItem[i % 5])
}
return colorList[params.dataIndex]
}
borderWidth: 4
// color: function(params) {
// var colorItem = ['#0348F3', '#14C9C9', '#F8B722', '#722ED1', '#F4647B', '#055BF7', '#0036D6', '#1ECED4', '#0BA8A8', '#FFC833', '#EAB00F', '#8541E0', '#601CC0', '#FF758C', '#E94F67']
// var colorList = []
// for (var i = 0; i < option.series[0].data.length; i++) {
// colorList.push(colorItem[i % 5])
// }
// return colorList[params.dataIndex]
// }
}
},
emphasis: {

Loading…
Cancel
Save