import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public' import { ConsumptionProportionConfig } from './index' import { CreateComponentType } from '@/packages/index.d' import cloneDeep from 'lodash/cloneDeep' import dataJson from './data.json' import { getParametricEquation, getPie3D } from './3dPie' import { chartInitConfig } from '@/settings/designSetting' export const includes = ['legend'] // 其它配置 const otherConfig = { dateTime: { selectValue: 'day', dataset: [ { label: '当天', value: 'day' }, { label: '本周', value: 'week' }, { label: '当月', value: 'month' }, { label: '本季度', value: 'quarter' }, { label: '当年', value: 'year' } ] }, } let total = 0 dataJson.source.forEach(item => { total += item.value; }) const series = getPie3D(dataJson.source, 0.8); const option = { ...otherConfig, renderer: 'canvas', backgroundColor: 'transparent', legend: { show:false, }, // color: ['rgba(255, 215, 0, 1)', 'rgba(74, 144, 226, 1)', 'rgba(80, 227, 194, 1)', 'rgba(126, 211, 33, 1)', 'rgba(144, 19, 254, 1)'], dataset: { ...dataJson }, labelLine: { show: true, lineStyle: { color: '#7BC0CB', }, }, label: { show: false, }, xAxis3D: { min: -1.2, max: 1.2, }, yAxis3D: { min: -1.2, max: 1.2, }, zAxis3D: { min: -1.2, max: 1.2, }, grid3D: { show: false, boxHeight: 6, top: '20%', viewControl: { distance: 180, alpha: 20, beta: -60, autoRotate: false, // 自动旋转 }, }, series: series, } export default class Config extends PublicConfigClass implements CreateComponentType { public key: string = ConsumptionProportionConfig.key public chartConfig = cloneDeep(ConsumptionProportionConfig) public option = echartOptionProfixHandle(option, includes) public attr = { ...chartInitConfig, x: 0, y: 0, w: 450, h: 320, zIndex: 1 } }