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

echarts實(shí)現(xiàn)一個(gè)3d效果柱形圖

這篇具有很好參考價(jià)值的文章主要介紹了echarts實(shí)現(xiàn)一個(gè)3d效果柱形圖。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

效果圖:

echarts里3d圓柱狀圖,echarts,echarts,3d,javascript
思路是:
通過(guò)數(shù)組循環(huán)生成多個(gè)echarts實(shí)例盒子,生成的柱形圖只有一條數(shù)據(jù),是由多個(gè)圖表設(shè)置barGap: '-100%'實(shí)現(xiàn)重疊,并通過(guò)設(shè)置柱形圖中間顏色到邊上顏色的漸變形成類似3d的視覺(jué)效果,實(shí)際每一個(gè)柱形圖是由以下幾個(gè)圖表實(shí)現(xiàn)的:??

  1. 內(nèi)層背景的body(bar)
  2. 內(nèi)層背景的頂部圓圈 (pictorialBar)
  3. 外層綠色的實(shí)際值柱形圖 (bar)
  4. 外層頂部的圓圈 (pictorialBar)
  5. 外層底部的圓圈 (pictorialBar)
    以及底部的圓盤是一個(gè)切圖??
    echarts里3d圓柱狀圖,echarts,echarts,3d,javascript

技術(shù)棧

vue3 TypeScript echarts
準(zhǔn)備:
需要安裝echarts和echarts-gl

yarn add echarts
yarn add echarts-gl

代碼:
template:

<div class="bottom-bar">
    <div v-for="item, index in barList" :key="index" class="bottom-item">
        <img class="bar-bottom" src="@/assets/images/fiveWater/bar-bottom.png" alt="">
        <div class="top-rate num-18 mgb12">
            {{ item.rate }}%
        </div>
        <div :ref="ref => item.dom = ref" class="bar-box mgb12" />
        <div class="bottom-name pang-18">
            {{ item.name }}
        </div>
    </div>
</div>

javascript:

import 'echarts-gl'
import * as echarts from 'echarts'

const barList = reactive([
	{ name: '基本能力', rate: 98, total: 100, done: 98, dom: ref() },
	{ name: '考核情況', rate: 100, total: 100, done: 100, dom: ref() },
	{ name: '推進(jìn)情況', rate: 90, total: 100, done: 90, dom: ref() },
])
onMounted(() => {
    initBar()
})

const initBar = () => {
    data.barList.forEach((item) => {
        const series = [item.done]
        const staticData = toRaw(item)
        const output_3DBarCharts = echarts.init(item.dom)
        const options = get3DOptions(staticData, series)
        output_3DBarCharts.setOption(options)
        window.addEventListener('resize', () => {
            output_3DBarCharts.resize()
        })
    })
}
const get3DOptions = (xData: { name: string; rate: number; total: number; done: number }, seriesData: number[]) => {
    const { total, done } = xData
    const options = {
        grid: {
            left: 0,
            right: 0,
            top: 7,
            bottom: 20
        },
        tooltip: {
            trigger: 'axis',
            axisPointer: {
                type: 'line' // 默認(rèn)為直線,可選為:'line' | 'shadow'
            },
            textStyle: {
                fontFamily: 'TRENDS'
            },
            formatter: (params: any[]) => {
                let str = `<div>${params[0].axisValue}:</div>`
                str += `<div>完成數(shù):${done}個(gè)</div>`
                str += `<div>總數(shù):${total}個(gè)</div>`
                return str
            }
        },
        legend: {
            show: true,
            icon: 'circle',
            orient: 'horizontal',
            top: '90.5%',
            right: 'center',
            itemWidth: 16.5,
            itemHeight: 6,
            textStyle: {
                color: '#C9C8CD',
                fontSize: 14
            }
        },
        xAxis: [{
            show: false,
            data: [xData.name],
            axisLabel: {
                show: true,
                textStyle: {
                    color: '#aaaaaa',
                    fontSize: 12
                },
                margin: 30, // 刻度標(biāo)簽與軸線之間的距離。
            },
            axisLine: {
                show: false // 不顯示x軸
            },
            axisTick: {
                show: false // 不顯示刻度
            },
            boundaryGap: true,
            splitLine: {
                show: false,
                width: 1,
                lineStyle: {
                    type: 'solid',
                    color: '#03202E'
                }
            }
        }],
        yAxis: [{
            show: false,
            axisLabel: {
                interval: 'auto',
                show: true,
                textStyle: {
                    fontSize: 14,
                    color: '#fff',
                },
            },
            splitLine: {
                show: false,
                lineStyle: {
                    color: 'rgba(49,176,255,0.05)',
                },
            },
            axisTick: {
                show: false,
            },
            axisLine: {
                show: true,
                lineStyle: {
                    color: 'rgba(49,176,255,0.5)',
                },
            },
        }],
        series: [
        // 柱頂圓片 背景
            {
                name: '',
                type: 'pictorialBar',
                symbolSize: [52, 20], // 調(diào)整截面形狀
                symbolOffset: [0, -6],
                z: 12,
                symbolPosition: 'end',
                label: {
                    show: false,
                    position: 'top',
                    textStyle: {
                        color: '#fff'
                    }
                },
                itemStyle: {
                    normal: {
                        color: () => {
                            return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                                { offset: 0, color: 'rgba(0, 58, 77, 1)' },
                                { offset: 1, color: 'rgba(0, 158, 209, 1)' },
                            ])
                        },
                    }
                },
                data: [total]
            },
            // 柱體 背景
            {
                name: '',
                type: 'bar',
                barWidth: '100%',
                itemStyle: {
                    color: () => {
                        return new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                            { offset: 0, color: 'rgba(0, 58, 77, 1)' },
                            { offset: 0.5, color: 'rgba(0, 58, 77, 0)' },
                            { offset: 1, color: 'rgba(0, 58, 77, 1)' },
                        ])
                    },
                    opacity: 1
                },
                data: [total]
            },

            { // 頂部園片 數(shù)據(jù)實(shí)體
                name: '',
                type: 'pictorialBar',
                symbolSize: [52, 20], // 調(diào)整截面形狀
                symbolOffset: [0, -6],
                z: 13,
                symbolPosition: 'end',
                itemStyle: {
                    normal: {
                        color: () => {
                            return new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                                { offset: 0, color: 'rgba(159, 255, 224, 0.8)' },
                                { offset: 1, color: 'rgba(75, 210, 187, 0.8)' },
                            ])
                        },
                    }
                },
                data: seriesData || []
            },
            { // 柱體 數(shù)據(jù)實(shí)體
                name: '',
                type: 'bar',
                barWidth: '100%',
                barGap: '-100%',
                itemStyle: {
                    normal: {
                        color: () => {
                            return new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                                { offset: 0, color: 'rgba(0, 58, 77, 1)' },
                                { offset: 0.5, color: 'rgba(113,286,181, .7)' },
                                { offset: 1, color: 'rgba(0, 58, 77, 1)' },
                            ])
                        },
                    }
                },
                data: seriesData || []
            },
            { // 柱底圓片
                name: '',
                type: 'pictorialBar',
                symbolSize: [58, 18], // 調(diào)整截面形狀
                symbolOffset: [0, 8],
                z: 12,
                itemStyle: {
                    color: () => {
                        return new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                            { offset: 0, color: 'rgba(0, 58, 77, 1)' },
                            { offset: 0.5, color: 'rgba(113,286,181, .7)' },
                            { offset: 1, color: 'rgba(0, 58, 77, 1)' },
                        ])
                    },
                },
                data: seriesData || []
            },
        ]
    }
    return options
}

css樣式文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-611801.html

.bottom-bar {
   display: flex;
   justify-content: space-between;
   margin-top: 25px;

   .bar-bottom {
       position: absolute;
       bottom: 27px;
       left: 50%;
       z-index: -1;
       width: 80px;
       transform: translateX(-50%);
   }

   .bottom-item {
       position: relative;
       display: flex;
       flex-direction: column;
       align-items: center;
   }

   .bar-box {
       width: 52px;
       height: 80px;
   }
}

到了這里,關(guān)于echarts實(shí)現(xiàn)一個(gè)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)文章

  • python可視化——3D柱形圖

    python可視化——3D柱形圖

    ? ?

    2024年02月06日
    瀏覽(100)
  • 【Python】如何使用matlibplot繪制3D柱形圖

    【Python】如何使用matlibplot繪制3D柱形圖

    (1)構(gòu)造需要顯示的數(shù)據(jù) 如下圖所示,X坐標(biāo)取值為[0,1,2,3,4],Y坐標(biāo)取值為[0,1,2,3,4,5,6,7,8],每一個(gè)(X,Y)組合的值Z=X+Y,所需要繪制的圖就是在X,Y所對(duì)應(yīng)的坐標(biāo)位置上面根據(jù)Z的值來(lái)繪制柱形圖。 (2)坐標(biāo)設(shè)置 將坐標(biāo)網(wǎng)格化, X=[0,1,2,3,4],Y=[0,1,2,3,4,5,6,7,8]網(wǎng)格化的結(jié)果,如下圖

    2024年02月16日
    瀏覽(23)
  • Echarts 3d餅狀圖

    Echarts 3d餅狀圖

    記錄使用Echarts 實(shí)現(xiàn)3D餅狀圖的過(guò)程。 效果圖: 1.首先安裝echarts 3d插件 2.封裝組件 封裝方法

    2024年02月11日
    瀏覽(15)
  • Matplotlib可視化數(shù)據(jù)分析圖表下(常用圖表的繪制、折線圖、柱形圖、直方圖、餅形圖、散點(diǎn)圖、面積圖、熱力圖、箱形圖、3D圖表、繪制多個(gè)圖表、雙y軸可視化圖表、顏色漸變圖)

    Matplotlib可視化數(shù)據(jù)分析圖表下(常用圖表的繪制、折線圖、柱形圖、直方圖、餅形圖、散點(diǎn)圖、面積圖、熱力圖、箱形圖、3D圖表、繪制多個(gè)圖表、雙y軸可視化圖表、顏色漸變圖)

    本文來(lái)自《Python數(shù)據(jù)分析從入門到精通》_明日科技編著 本節(jié)介紹常用圖表的繪制,主要包括繪制折線圖、繪制柱形圖、繪制直方圖、繪制餅形圖、繪制散點(diǎn)圖、繪制面積圖、繪制熱力圖、繪制箱型圖、繪制3D圖表、繪制多個(gè)子圖表以及圖表的保存。對(duì)于常用的圖表類型以繪制

    2023年04月23日
    瀏覽(43)
  • Cesium和Echarts的完美集成展示3D柱狀圖、折線圖和餅狀圖

    在本文中,我們將介紹如何將Cesium和Echarts兩個(gè)強(qiáng)大的數(shù)據(jù)可視化工具進(jìn)行集成,實(shí)現(xiàn)在Cesium地球上展示3D柱狀圖、折線圖和餅狀圖的功能。Cesium是一個(gè)用于創(chuàng)建基于Web的地球?yàn)g覽和可視化應(yīng)用程序的JavaScript庫(kù),而Echarts是一個(gè)功能強(qiáng)大的數(shù)據(jù)可視化庫(kù),支持多種圖表類型。 首

    2024年02月04日
    瀏覽(228)
  • 前端vue自定義柱形圖 選中更改柱形圖顏色及文字標(biāo)注顏色

    前端vue自定義柱形圖 選中更改柱形圖顏色及文字標(biāo)注顏色

    隨著技術(shù)的發(fā)展,開發(fā)的復(fù)雜度也越來(lái)越高,傳統(tǒng)開發(fā)方式將一個(gè)系統(tǒng)做成了整塊應(yīng)用,經(jīng)常出現(xiàn)的情況就是一個(gè)小小的改動(dòng)或者一個(gè)小功能的增加可能會(huì)引起整體邏輯的修改,造成牽一發(fā)而動(dòng)全身。 通過(guò)組件化開發(fā),可以有效實(shí)現(xiàn)單獨(dú)開發(fā),單獨(dú)維護(hù),而且他們之間可以隨

    2024年02月12日
    瀏覽(27)
  • 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)
  • Echarts實(shí)現(xiàn)3D地球加衛(wèi)星環(huán)繞效果

    Echarts實(shí)現(xiàn)3D地球加衛(wèi)星環(huán)繞效果

    通過(guò)echarts實(shí)現(xiàn)自動(dòng)旋轉(zhuǎn)3D地球加衛(wèi)星環(huán)繞效果 全部使用 按需使用 代碼如下: 衛(wèi)星環(huán)繞效果通過(guò)scatter3D實(shí)現(xiàn),將symbolSize設(shè)置為0,通過(guò)label-textStyle-backgroundColor-image設(shè)置衛(wèi)星圖片,代碼如下: 衛(wèi)星伴隨地球自轉(zhuǎn),缺點(diǎn)在于速度與地球相同,暫時(shí)未找到更好的替代方法。 完整代

    2024年02月17日
    瀏覽(22)
  • echarts使用二維地圖實(shí)現(xiàn)好看的3D效果

    echarts使用二維地圖實(shí)現(xiàn)好看的3D效果

    內(nèi)容概要: 使用echarts的二維地圖模擬三維立體動(dòng)態(tài)風(fēng)格的地圖效果,地圖邊界還帶有動(dòng)態(tài)流動(dòng)線條效果,既有三維的立體效果,又避免了三維地圖占用內(nèi)存資源高的問(wèn)題。 目標(biāo)人群: 前端開發(fā)工程師,大屏可視化開發(fā)人員。 使用場(chǎng)景: 使用echarts二維地圖模擬三維地圖效果

    2024年02月11日
    瀏覽(26)
  • Pyecharts繪制圖表大全——柱形圖

    Pyecharts繪制圖表大全——柱形圖

    說(shuō)明:本文代碼資料等來(lái)源于Pyecharts官網(wǎng),進(jìn)行了一些重要節(jié)點(diǎn)的備注說(shuō)明梳理,便于學(xué)習(xí)。 今日學(xué)習(xí)柱形圖! 目錄 百分比柱形圖 ?x軸標(biāo)簽旋轉(zhuǎn) ?堆疊數(shù)據(jù) ?動(dòng)態(tài)宏觀經(jīng)濟(jì)指標(biāo)圖 ?通過(guò) dict 進(jìn)行配置柱形圖 ?區(qū)域選擇組件配置項(xiàng) ?區(qū)域縮放配置項(xiàng) ?好全的工具箱! ?類似于

    2024年02月05日
    瀏覽(62)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

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

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

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包