vue使用Highcharts实现3D饼图

本文实例为大家分享了vue使用Highcharts实现3D饼图的具体代码,供大家参考,具体内容如下

1.安装vue-highcharts和highcharts

npm install vue-highcharts --save
npm install highcharts --save

2.option.js

let all={
    pie:{
        chart: {
            type: 'pie',
            options3d:
                {
                    enabled: true,
                    alpha: 70,//展示顶部看到的范围
                    beta: 0
                }
        }
        ,
        title: {
            text: '2014年某网站不同浏览器访问量占比'
        }
        ,
        tooltip: {
            pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
        }
        ,
        plotOptions: {
            pie: {
                allowPointSelect: false,
                cursor: 'pointer',
                depth: 75,//3D图的高度
                dataLabels:
                    {
                        distance:50,
                        enabled: true,
                        format: '{point.name}'
                    }
            }
        }
        ,
        series: [{
            type: 'pie',
            name: '浏览器占比',
            label: {
                normal: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    show: true,
                    textStyle: {
                        fontSize: '30',
                        fontWeight: 'bold'
                    }
                }
            },
            labelLine: {
                normal: {
                    show: false
                }
            },
            data: [
                {name: 'Firefox', y: 45.0, sliced: true,},
                {name: 'IE', y: 26.8, sliced: true,},
                {
                    name: 'Chrome',
                    y: 12.8,
                    sliced: true,//每个部分的间隙
                },
                {name: 'Safari', y: 8.5, sliced: true,},
                {name: 'Opera', y: 6.9, sliced: true,},
                {name: 'Others', y: 0.7, sliced: true,}
            ]
        }]
    }
}
export default  all

3.charts.vue

<template>
    <div class="x-bar">
        <div :id="id"
             :option="option"></div>
    </div>
</template>
<script>
    import HighCharts from 'highcharts'
    import VueHighCharts from 'vue-highcharts'
    import highcharts3d from 'highcharts/highcharts-3d'
    export default {
        // 验证类型
        props: {
            id: {
                type: String
            },
            option: {
                type: Object
            }
        },
        mounted() {
            highcharts3d(HighCharts)
            HighCharts.chart(this.id,this.option)
        }
    }
</script>

4.marry.vue

<template>
    <div>
        <div class="bootTitle ">
        <span class="bigFoot" style="margin-left: 4%">3.请制定规划目标,报告会根据填入的信息生成。</span>
        <span class="smallFoot ml-1" style="color:#b9b9bd ">全部规划确认上传可</span>
        <span class="smallFoot ml-1"><a style="color: #54a0ff" href=" " rel="external nofollow" >预览生涯仿真图</ a></span>
        <span style="float: right; margin-right: 3%"  >
            <yh-button class="yh-small yh-primary" style="border-radius: 8px">下一步</yh-button>
        </span>
         </div>
        <div>
            <div  style="border-bottom: 1px #eaeaea solid;width: 90%;margin-left: 5%;margin-top: 2%;margin-bottom:10px;height: 60px;line-height: 60px">
                <span style="font-size: 24px; letter-spacing:1px;margin-left: 1%">预计结婚时间为{{date}}年,婚礼总预算¥200,0000元</span>
                <span style="float: right;margin-right: 1%"><yh-button style="border-radius: 8px">关联产品</yh-button></span>
                <span style="float: right;margin-right: 2%"><yh-button class=" yh-primary" style="border-radius: 8px">确认规划</yh-button></span>
            </div>
            <span style="width: 90%;margin-left: 6%;color: #54a0ff;height:22px;margin-top: 5%">重新配置参数</span>
            <div id="app">
                <x-chart :id="id" :option="option"></x-chart>
            </div>
        </div>
    </div>
</template>
 
<script>
    // 导入chart组件
    import XChart from '../../charts'
    // 导入chart组件模拟数据
    import options from '../../../chart-options/options'
    export default {
        name: "marriage-planning",
        data() {
            let option = options.pie;
            return {
                id: 'test',
               date:"2020",
                option: option
            };
        },
        components: {
            XChart
        },
        methods: {
 
        },
        created: function() {},
        mounted: function() {
 
        }
    }
</script>

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持我们。

(0)

相关推荐

  • 在vue项目中引用Antv G2,以饼图为例讲解

    我就废话不多说了,大家还是直接看代码吧~ npm install @antv/g2 --save template内容: <template> <div id="pieChart"></div> </template> js部分: ​//引入G2组件 import G2 from "@antv/g2"; ​ export default { name:"", //数据部分 data(){ retur

  • vue使用ECharts实现折线图和饼图

    在开发后台管理项目时,需要统计后台用户数据,以折线图和饼图的形式显示,这边采用apache-echarts来实现需求. 1.安装echarts和引入 npm install echarts --save import * as echarts from 'echarts'; 2.使用echarts实现pie图 <template> <div id="chartPie" class="pie-wrap"></div> </te

  • vue实现echart饼图legend显示百分比的方法

    本文主要介绍了vue使用echart的饼图数据部分展示百分比,分享给大家,具体如下: 效果图 实现源码 option = { title : { text: '某站点用户访问来源', subtext: '纯属虚构', x:'center' }, tooltip : { trigger: 'item', formatter: "{a} <br/>{b} : {c} ({d}%)" }, legend: { orient: 'vertical', // 布局方式,默认为水平布局

  • 在Vue中使用highCharts绘制3d饼图的方法

    highcharts是国外知名基于javascript的图表库.由于中文官网的vue中使用highcharts配置繁琐并且需要引入jquery作为依赖,所以弃用. 接下来,给各位伙伴简要的讲叙下highcharts在vue中的使用和配置方法. 首先使用 npm在你的项目中安装vue-highcharts npm install vue-highcharts --save 由于vue-highcharts依赖于highcharts,我们还需要安装后者 npm install highcharts

  • vue+highcharts实现3D饼图效果

    本文实例为大家分享了vue+highcharts实现3D饼图效果的具体代码,供大家参考,具体内容如下 这是最终效果 <template> <div class="big-box">   <div class="com-container" ref="container" style="width:380px;height:300px;">   </div>   <div c

  • vue使用Highcharts实现3D饼图

    本文实例为大家分享了vue使用Highcharts实现3D饼图的具体代码,供大家参考,具体内容如下 1.安装vue-highcharts和highcharts npm install vue-highcharts --save npm install highcharts --save 2.option.js let all={     pie:{         chart: {             type: 'pie',             options3d:          

  • vue使用Highcharts实现不同高度的3D环形图

    本文实例为大家分享了Highcharts实现不同高度的3D环形图的具体代码,供大家参考,具体内容如下 要实现的效果: 完整代码如下: // 修改3d饼图绘制过程 var each = Highcharts.each,     round = Math.round,     cos = Math.cos,     sin = Math.sin,     deg2rad = Math.deg2rad; Highcharts.wrap(Highcharts.seriesTypes.pie.protot

  • html+js+highcharts绘制圆饼图表的简单实例

    实例如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type&q

  • iOS绘制3D饼图的实现方法

    实现核心 1.压缩饼图,使饼图有3D的效果,并不是真正的画了个3D圆柱 2.绘制厚度,带阴影效果,让看上去像是圆柱的高 3.路径添加好了,用颜色填充后绘制一下,添加阴影后还需绘制一遍 饼图添加阴影的思考 之前这加阴影的一段不是很明白,为啥设颜色和阴影都要draw一次 进过反复的测试,我自己分析了一下,每次draw一下想当于,把当前的设置画出来,再次draw就在这基础上,再画最近的设置,这里加颜色和阴影就像是一层一层的画上去.要是不draw的话,再设置颜色相当于重新设置了颜色,之前设置的颜色就无效

  • 读取数据库的数据并整合成3D饼图在jsp中显示详解

    前言 本文主要给大家介绍的是关于读取数据库数据整合成3D饼图并在jsp中显示的相关内容,分享出来供大家参考学习,下面话不多说,来一起看看详细的介绍: 方法如下: 首先我将生成饼图的方法独立写成一个PieChar.java类,详细代码如下:(数据库需要自己建,如有需要的话) import java.io.IOException; import java.sql.SQLException; import org.jfree.chart.ChartFactory; import org.jfree.c

  • jQuery插件HighCharts绘制2D饼图效果示例【附demo源码下载】

    本文实例讲述了jQuery插件HighCharts绘制2D饼图效果.分享给大家供大家参考,具体如下: 1.实例代码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>HighCharts 2D饼图</title> <script type="text/javascript" src="js/jquery-1.

  • Vue.js+HighCharts实现动态请求展示时序数据

    本文实例为大家分享了Vue.js+HighCharts实现动态请求展示时序数据的具体代码,供大家参考,具体内容如下 <template>   <el-container>     <el-header>       <el-menu :default-active="activeIndex" class="el-menu-header" mode="horizontal" @select="ha

  • Vue引入highCharts实现数据可视化

    本文实例为大家分享了Vue引入highCharts实现数据可视化的具体代码,供大家参考,具体内容如下 效果图 文档Api地址 安装 npm install highcharts-vue 在main.js进行全局配置 import HighchartsVue from 'highcharts-vue' Vue.use(HighchartsVue) <highcharts :options="chartOptions"></highcharts> <scrip

随机推荐