highcharts绘制3D图表

最近做项目中需求要求3D图表展现,开始比较懵逼,后来网上找的了highcharts图表,之前都是用的百度的echarts做平面图

一、基本介绍

二、绘制一个饼图的

  • 1、效果图如下

    这里写图片描述

  • 2、具体代码

    <!DOCTYPE HTML>
    <html>
    <head>
        <meta charset="utf-8">
        <link rel="icon" href="https://static.jianshukeji.com/highcharts/images/favicon.ico">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="https://img.hcharts.cn/jquery/jquery-1.8.3.min.js"></script>
        <script src="https://img.hcharts.cn/highcharts/highcharts.js"></script>
        <!--3d图表需要的2d就不需要-->
        <script src="https://img.hcharts.cn/highcharts/highcharts-3d.js"></script>
        <!-- <script src="https://img.hcharts.cn/highcharts/modules/exporting.js"></script> -->
        <!-- <script src="https://img.hcharts.cn/highcharts-plugins/highcharts-zh_CN.js"></script> -->
        <!-- 颜色的可以不引入,单独自己设置颜色 -->
        <!-- <script src="https://img.hcharts.cn/highcharts/themes/sand-signika.js"></script> -->
    </head>
    <body>
        <div id="container" style="height: 400px;width:400px;"></div>
        <script>
            $(function () {
                $('#container').highcharts({
                    chart: {
                        backgroundColor:'#e5e5e5',
                        type: 'pie',
                        options3d: {
                            enabled: true,
                            alpha: 45,
                            beta: 0
                        }
                    },
                    // 设置导出按钮
                    exporting:{
                        // 不显示出来
                        enabled:false
                    },
                    title: {
                        text: '2014年某网站不同浏览器访问量占比'
                    },
                    tooltip: {
                        pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
                    },
                    plotOptions: {
                        pie: {
                            allowPointSelect: true,
                            cursor: 'pointer',
                            depth: 35,
                            dataLabels: {
                                enabled: true,
                                format: '{point.name}'
                            }
                        }
                    },
                    // 版权
                    credits:{
                        enabled:false
                    },
                    series: [{
                        type: 'pie',
                        name: '浏览器占比',
                        data: [
                            {
                                name:'Firefox',
                                y:25.0,
                                id:'fox',
                                color:'#630',
                                // 文字提示
                                dataLabels:{
                                    enabled:false
                                }
                            },
                            ['IE', 26.8],
                            {
                                name: 'Chrome',
                                y: 12.8,
                                sliced: true,
                                selected: true
                            },
                            ['Safari', 8.5],
                            ['Opera', 6.2],
                            ['Others', 0.7]
                        ]
                    }]
                });
            });
        </script>
    </body>
    </html>
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

水痕01

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值