import { $echarts } from '../../index.js';

export default ({ dom, param, opt }) => {
    let { data, text, color } = param;

    /**
     * 数据处理
     */
    let seriesData = data;

    /**
     * 导出配置项
     */
    let option = {
        series: [
            {
                type: 'liquidFill',
                data: seriesData,
                radius: '104px',
                outline: {
                    show: false,
                },
                backgroundStyle: {
                    color: 'rgba(23, 42, 96, 1)',
                    borderColor: 'rgba(0, 0, 0, 0)',
                    borderWidth: 0,
                    shadowColor: 'rgba(0, 0, 0, 0)',
                    shadowBlur: 20,
                },
                shape: 'circle',
                label: {
                    position: ['50%', '50%'],
                    formatter: function () {
                        return text;
                    },
                    fontSize: 24,
                    color: '#fff',
                },
                itemStyle: {
                    color: color,
                },
            },
        ],
    };

    /**
     * 渲染
     */
    let extensOption = $echarts.extens(opt, option);

    let echarts = $echarts.render(dom, extensOption);
};
