国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

Echarts 3D立體柱狀圖(源碼+例圖)

這篇具有很好參考價(jià)值的文章主要介紹了Echarts 3D立體柱狀圖(源碼+例圖)。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

Echarts 3D立體柱狀圖,3D長(zhǎng)方體柱狀圖,直接cope源碼可用(源碼+例圖)

廢話不多說,直接上代碼?。。?

echarts graphic 立方體,ECharts圖表,Vue,前端,echarts,vue,vue.js,1024程序員節(jié)文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-616161.html

// HTML 代碼
<div id="litiBar" style="width:100%;height:400px" ></div>

// JS 代碼
data(){
  return {
    chart:null
  }
};
mounted(){
    // 3D立體柱狀圖
    this.litiBar();
},
methods:{
    litiBar() {
            this.chart = echarts.init(document.getElementById('litiBar'));
            // 創(chuàng)建立方體正面圖形
            const cubeShape1 = echarts.graphic.extendShape({
                shape: {
                x: 0,
                y: 0,
                width: 110, // 長(zhǎng)方體寬度
                zWidth: 8, // 陰影折角高
                zHeight: 4 // 陰影折角寬
                },
                buildPath: (ctx, shape) => {
                const api = shape.api;
                const xAxisPoint = api.coord([shape.xValue, 0]);
                const p0 = [shape.x, shape.y];
                const p1 = [shape.x - shape.width / this.xAxisText.length, shape.y];
                const p4 = [shape.x + shape.width / this.xAxisText.length, shape.y];
                const p2 = [xAxisPoint[0] - shape.width / this.xAxisText.length, xAxisPoint[1]];
                const p3 = [xAxisPoint[0] + shape.width / this.xAxisText.length, xAxisPoint[1]];
        
                // 繪制正面
                ctx.moveTo(p0[0], p0[1]); //0
                ctx.lineTo(p1[0], p1[1]); //1
                ctx.lineTo(p2[0], p2[1]); //2
                ctx.lineTo(p3[0], p3[1]); //3
                ctx.lineTo(p4[0], p4[1]); //4
                ctx.lineTo(p0[0], p0[1]); //0
                ctx.closePath();
                }
            })

            // 創(chuàng)建立方體的頂和側(cè)面
            const cubeShape2 = echarts.graphic.extendShape({
                shape: {
                x: 0,
                y: 0,
                width: 110,
                zWidth: 8,
                zHeight: 4
                },
                buildPath: (ctx, shape) => {
                const api = shape.api;
                const xAxisPoint = api.coord([shape.xValue, 0]);
                const p1 = [shape.x - shape.width / this.xAxisText.length, shape.y];
                const p4 = [shape.x + shape.width / this.xAxisText.length, shape.y];
                const p6 = [shape.x + shape.width / this.xAxisText.length + shape.zWidth, shape.y - shape.zHeight];
                const p7 = [shape.x - shape.width / this.xAxisText.length + shape.zWidth, shape.y - shape.zHeight];
                const p3 = [xAxisPoint[0] + shape.width / this.xAxisText.length, xAxisPoint[1]];
                const p5 = [xAxisPoint[0] + shape.width / this.xAxisText.length + shape.zWidth, xAxisPoint[1] - shape.zHeight];
        
                // 繪制側(cè)面
                ctx.moveTo(p4[0], p4[1]); //4
                ctx.lineTo(p3[0], p3[1]); //3
                ctx.lineTo(p5[0]+6, p5[1]-6); //5
                ctx.lineTo(p6[0]+7, p6[1]-8); //6
                ctx.lineTo(p4[0], p4[1]); //4
        
                // 繪制頂部
                ctx.moveTo(p4[0], p4[1]); //4
                ctx.lineTo(p6[0]+7, p6[1]-8); //6
                ctx.lineTo(p7[0]+7, p7[1]-8); //7
                ctx.lineTo(p1[0], p1[1]); //1
                ctx.lineTo(p4[0], p4[1]); //4
                ctx.closePath();
                }
            })

            echarts.graphic.registerShape('cubeShape1', cubeShape1)
            echarts.graphic.registerShape('cubeShape2', cubeShape2)
            this.initECharts()
        },
   initECharts() {
            const option = {
                title: {
                    left: 20,
                    top: 20
                },
                textStyle:{
                    fontSize:15,
                    color: '#10D5DF'
                },
                tooltip: {},
                xAxis: {
                    type: 'category',
                    //  max: 'dataMax',// 柱狀圖以數(shù)據(jù)最大的為頂點(diǎn)
                    data: this.xAxisText,
                    interval: 0,
                    axisLabel: {
                        color: '#44f0ff'
                    },
                    axisTick: {
                        show: false,
                    },// 隱藏X刻度線
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: 'rgba(28, 180, 215,0.5)'
                        }
                    }
                },
                yAxis: {
                    type: 'value',
                    splitLine: {
                        lineStyle:{
                            color: 'rgba(224,224,224,0.1)'// 分割軸線的顏色
                        }
                    },
                    axisLine: {
                        show: true,
                        lineStyle: {
                            color: 'rgba(28, 180, 215,0.5)'
                        }
                    }
                },
                 grid: {
                    top: 80,
                    bottom: 30
                },
                series: [{
                    // name: '銷量統(tǒng)計(jì)',
                    type: 'custom',
                    label: {
                        show: true,
                        position: 'top',
                    },
                    // barWidth:20,
                    renderItem: (params, api) => {
                        let location = api.coord([api.value(0), api.value(1)])
                        return {
                            type: 'group',
                            children: [{
                                type: 'cubeShape1', // 正方體正面
                                shape: {
                                api,
                                xValue: api.value(0),
                                yValue: api.value(1),
                                x: location[0],
                                y: location[1]
                                },
                                style: {
                                fill: new echarts.graphic.LinearGradient(0,0,0,1, [{
                                    offset: 0.1,
                                    color: 'rgba(27, 202, 242, 1)'
                                    
                                },{
                                    offset: 1,
                                    color: 'rgba(29, 111, 130, 1)'
                                }])
                                }
                            }, {
                                type: 'cubeShape2', // 正方體側(cè)面和頂
                                shape: {
                                api,
                                xValue: api.value(0),
                                yValue: api.value(1),
                                x: location[0],
                                y: location[1]
                                },
                                style: {
                                fill: new echarts.graphic.LinearGradient(0,0,0,1, [{
                                    offset: 0.1,
                                    color: 'rgba(29, 111, 130, 1)'
                                },{
                                    offset: 1,
                                    color: 'rgba(27, 202, 242, 1)'
                                }])
                                }
                            }]
                        }
                    },
                    data: this.yAxisData
                }]
            }
            this.chart.setOption(option)
        },
}

到了這里,關(guān)于Echarts 3D立體柱狀圖(源碼+例圖)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • echarts-3D立體餅圖(1)

    echarts-3D立體餅圖(1)

    先看效果圖 1、echarts的版本使用的是: script src=\\\"https://cdn.bootcdn.net/ajax/libs/echarts/5.4.1/echarts.min.js\\\"/script script src=\\\"https://cdn.bootcdn.net/ajax/libs/echarts-gl/2.0.8/echarts-gl.js\\\"/script 2、餅圖可自旋轉(zhuǎn),鼠標(biāo)移上也可轉(zhuǎn)動(dòng),不想讓旋轉(zhuǎn)grid3D:{viewControl:{autoRotate:false}} 3、 3D餅圖主義echarts的

    2024年02月09日
    瀏覽(24)
  • echarts 3D立體圖(江蘇版)

    echarts 3D立體圖(江蘇版)

    npm install echarts@4.9.0 echarts-gl@1.0.1 --legacy-peer-deps 安裝echarts插件和echarts 3D地圖插件 配置main.js 新建vue文件 如需改樣式點(diǎn)這里 npm install echarts@4.9.0 echarts-gl@1.0.1 --legacy-peer-deps 安裝echarts插件和echarts 3D地圖插件 配置main.js 新建vue文件 如需改樣式點(diǎn)這里

    2024年02月12日
    瀏覽(21)
  • echarts 實(shí)現(xiàn) 3d 柱狀圖

    echarts 實(shí)現(xiàn) 3d 柱狀圖

    實(shí)現(xiàn)要求 能夠調(diào)整大小 實(shí)現(xiàn)3d效果,可以改變顏色 前置環(huán)境 效果 調(diào)整大小和顏色 代碼 baseCharts.vue 使用 10.12 更新 效果 代碼 使用

    2024年02月11日
    瀏覽(20)
  • echarts 3D 柱狀圖

    echarts 3D 柱狀圖

    注意: 這里主要就是基于各類圖表,更多的使用 Echarts 的各類配置項(xiàng); 以下代碼都可以復(fù)制到 Echarts 官網(wǎng),直接預(yù)覽; 注意: 以下背景圖來(lái)源于網(wǎng)絡(luò),如果失效請(qǐng)自行替換; echarts 環(huán)形圖:多層嵌套,自定義 legend 位置、顏色,中間插入數(shù)據(jù)及文字,顏色漸變; 文字鏈接:

    2024年02月11日
    瀏覽(34)
  • Echarts-3D柱狀圖

    通過Echarts的echarts.graphic.extendShape實(shí)現(xiàn)真正的3D柱狀圖 思路就是通過調(diào)整頂部面(CubeTop)、左側(cè)面(CubeLeft)、右側(cè)面(CubeRight)來(lái)決定柱狀圖的寬窄 建議優(yōu)先調(diào)整頂部面,一般c1不需要?jiǎng)?然后在build-bar-option中引用即可 這里主要就是把series中的內(nèi)容復(fù)制過來(lái)直接用就行了

    2024年02月08日
    瀏覽(19)
  • echarts5 3D柱狀圖

    div ref=\\\"echartsQinggan\\\" style=\\\"width: 100%;height: 100%;\\\"/div ? ? async getData() { ///調(diào)用接口獲取數(shù)據(jù) ? ?this.Count1=[1,2,3] ?this.Count2=[4,5,6] ?this.Count3=[7,null,8] this.$nextTick(() = { ? ? ? ? this.qinganFun() ? ? ? }) ? ? }, ? ? qinganFun() { ? ? ? // 獲取DOM節(jié)點(diǎn)并初始化 ? ? ? const hotTheme = this.$echarts.i

    2024年03月18日
    瀏覽(19)
  • vue使用echarts與echarts-gl實(shí)現(xiàn)3d地圖與 3d柱狀圖

    vue使用echarts與echarts-gl實(shí)現(xiàn)3d地圖與 3d柱狀圖

    目錄 前言 一、下載echarts與echarts gl 二、vue引入與頁(yè)面使用 1.引入 2.頁(yè)面引入echarts-gl 三、下載地圖數(shù)據(jù) 四、使用地圖 1、html初始化地圖放入位置: 2、data創(chuàng)建變量 3、創(chuàng)建地圖 4、鉤子函數(shù)渲染地圖 5、渲染完成效果 總結(jié) 提示:本項(xiàng)目使用vue,請(qǐng)?zhí)崆按罱ê胿ue項(xiàng)目 本次需求

    2024年02月12日
    瀏覽(27)
  • echarts實(shí)現(xiàn)3D柱狀圖(視覺層面)和3D餅圖

    echarts實(shí)現(xiàn)3D柱狀圖(視覺層面)和3D餅圖

    原理: 立體圖形從一個(gè)方向只能看到三個(gè)面,于是我們通過echarts圖表實(shí)現(xiàn) 頂部,明面,和暗面。 效果圖如下: 需要四份數(shù)據(jù), 兩個(gè)柱子的數(shù)據(jù)+X軸數(shù)據(jù)+顏色數(shù)據(jù), 通過 setData 和 setColor 生成需要的數(shù)據(jù),橫向柱狀圖同理,參照代碼中注釋。 以下是完整案例代碼: 3D餅圖沒

    2024年02月16日
    瀏覽(24)
  • vue echarts實(shí)現(xiàn)3D效果柱狀圖

    vue echarts實(shí)現(xiàn)3D效果柱狀圖

    在vue2項(xiàng)目里面,研究了哈,這里記錄下eacharts 實(shí)現(xiàn)3D效果柱狀圖 在main.js引入eacharts 展示效果:大屏demo

    2024年02月15日
    瀏覽(30)
  • echarts3d柱狀圖

    echarts3d柱狀圖

    ?

    2024年02月21日
    瀏覽(20)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包