vue HighCharts 饼图 3D效果

下载依赖

 npm install  highcharts -S

main.js 引入依赖


import highcharts from "highcharts";
import highcharts3d from "highcharts/highcharts-3d";
highcharts3d(highcharts);

使用页面

 allData.questionsCount =[{
    
        name:'占比1',
        y:'50',
        rate:'50%',

    },
{
    
        name:'占比2',
        y:'50',
        rate:'50%',

    },
]
import HighCharts from "highcharts";

<template>
  <div id="pie1"></div>
</template>


   const init = () => {
            // 图表配置
            var options = {
                chart: {
                    type: "pie",
                    options3d: {
                        enabled: true,
                        alpha: 45,
                        beta: 0,
                    },
                    backgroundColor: "transparent",
                },
                title: {
                    style: {
                        color: "transparent",
                    },
                },
                credits: {
                    //关闭版权信息的标签
                    enabled: false,
                },
                tooltip: {
                    backgroundColor: "#F5F8FA",
                    borderColor: "transparent",
                    formatter: function () {
                        var s =
                            this.point.options.name +
                            ":" +
                            this.point.options.y;
                        return s;
                    },
                    animation: true, // 是否启用动画效果
                    style: {
                        // 文字内容相关样式\
                        fontSize: "14px",
                        fontFamily: "Alibaba PuHuiTi",
                        color: "#666666",
                    },
                },
                plotOptions: {
                    pie: {
                        size: "100%",
                        allowPointSelect: true,
                        cursor: "pointer",
                        depth: 50,
                        showInLegend: false,
                        dataLabels: {
                            enabled: true,
                            style: {
                                color: "rgba(93, 245, 255, 1)",
                                fontSize: "12px",
                                fontWeight: "500",
                            },
                        },
                    },
                },
                series: [
                    {
                        type: "pie",
                        name: "占比",
                        data: allData.questionsCount,
                        colors: ["#0ebd92", "#3f9f30", "#87aecb"],
                        center: ["50%", "30%"],
                    },
                ],
            };
            // 图表初始化函数
            allData.chart = HighCharts.chart("pie1", options);
            window.addEventListener("resize", resizeTheChart);
        };

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值