echarts实现3D柱状图(视觉层面)

news2024/10/7 11:45:39

一、第一种效果

效果图

使用步骤 

完整实例,copy就可直接使用

<template>
    <div :class="className" :style="{height:height,width:width}" />
</template>

<script>
    import echarts from 'echarts'
    require('echarts/theme/macarons') // echarts theme
    import resize from '@/views/dashboard/mixins/resize'

    export default {
        mixins: [resize],
        props: {
            className: {
                type: String,
                default: 'chart'
            },
            width: {
                type: String,
                default: '100%'
            },
            height: {
                type: String,
                default: '400px'
            },
            dataList: {
                type: Array,
                default: []
            }
        },
        data() {
            return {
                chart: null,
                xAxisData: ['数学', '语文', '英语', '物理', '化学'],
                data1: [200, 100, 200, 50, 100],
                data2: [300, 200, 300, 200, 300]
            }
        },
        mounted() {
            this.$nextTick(() => {
                this.initChart()
            })
        },
        beforeDestroy() {
            if (!this.chart) {
                return
            }
            this.chart.dispose()
            this.chart = null
        },
        watch: {
            dataList(val, oldVal) {//普通的watch监听
                this.initChart()
            }
        },
        methods: {
            initChart() {

                this.chart = echarts.init(this.$el, 'macarons')
                this.chart.setOption(
                    {
                        tooltip: {
                            trigger: 'item'
                        },
                        grid: {
                            top: '10%',
                            bottom: '20%',
                            right: '2%',
                            left: '10%'
                        },
                        legend: {
                            data: ['2021', '2022'],
                            left: '20px',
                            textStyle: {
                                color: '#FFFFFF'
                            }
                        },
                        graphic: [
                            {
                                type: 'image', // 图形元素类型
                                id: 'logo', // 更新或删除图形元素时指定更新哪个图形元素,如果不需要用可以忽略。
                                right: 'center', // 根据父元素进行定位 (居中)
                                bottom: '0%', // 根据父元素进行定位   (0%), 如果bottom的值是 0,也可以删除该bottom属性值。
                                z: 0, // 层叠
                                bounding: 'all', // 决定此图形元素在定位时,对自身的包围盒计算方式
                                style: {
                                    image:
                                        'https://img0.baidu.com/it/u=3846011338,1538056540&fm=253&fmt=auto&app=138&f=PNG?w=889&h=500', // 这里一定要注意、注意,必须是https开头的图片路径地址
                                    width: 800,
                                    height: 400
                                }
                            }
                        ],
                        xAxis: {
                            data: this.xAxisData,
                            axisTick: {
                                show: false
                            },
                            axisLine: {
                                show: false
                            },
                            axisLabel: {
                                interval: 0,
                                textStyle: {
                                    color: '#fff',
                                    fontSize: 20
                                },
                                margin: 40
                            }
                        },
                        yAxis: {
                            splitLine: {
                                show: false
                            },
                            axisTick: {
                                show: true,
                                alignWithLabel: true,
                                inside: true
                            },
                            axisLine: {
                                show: true
                            },
                            axisLabel: {
                                textStyle: {
                                    color: '#fff',
                                    fontSize: 20
                                }
                            }
                        },
                        series: [
                            // 底部的光晕
                            {
                                name: '',
                                type: 'pictorialBar',
                                tooltip: {
                                    show: false
                                },
                                symbolSize: [90, 40],
                                symbolOffset: [0, 20],
                                z: 1,
                                itemStyle: {
                                    normal: {
                                        color: 'transparent',
                                        borderColor: '#26B2E8',
                                        borderType: 'solid',
                                        borderWidth: 1
                                    }
                                },
                                data: [1, 1, 1, 1, 1]
                            },

                            {
                                name: '2021',
                                type: 'bar',
                                barWidth: 45,
                                barGap: '-100%',
                                z: 0,
                                itemStyle: {
                                    color: '#E8CCFF',
                                    opacity: 0.7
                                },
                                data: this.data2
                            },
                            {
                                name: '2022',
                                type: 'bar',
                                barWidth: 45,
                                barGap: '-100%',
                                itemStyle: {
                                    color: '#FF9A22'
                                },
                                data: this.data1
                            },
                            //头部、中部、尾部圆片
                            {
                                name: '2021', // 头部
                                type: 'pictorialBar',
                                symbolSize: [45, 25],
                                symbolOffset: [0, -10],
                                z: 12,
                                symbolPosition: 'end',
                                itemStyle: {
                                    color: '#D28EFF',
                                    opacity: 1
                                },
                                data: this.data2
                            },
                            {
                                name: '2022',//中部
                                type: 'pictorialBar',
                                symbolSize: [45, 25],
                                symbolOffset: [0, -10],
                                z: 12,
                                symbolPosition: 'end',
                                itemStyle: {
                                    opacity: 1,
                                    color: '#FF3EFF'
                                },
                                data: this.data1
                            },
                            {
                                //三个最低下的圆片
                                name: '',
                                type: 'pictorialBar',
                                symbolSize: [45, 25],
                                symbolOffset: [0, 10],
                                z: 12,
                                itemStyle: {
                                    opacity: 1,
                                    color: 'red'
                                },
                                data: this.data1
                            }
                        ]
                    }
                )
            }
        }
    }
</script>
itemStyle: {
                                normal: {
                                    //这里是颜色
                                    color: function (params) {
                                        //注意,如果颜色太少的话,后面颜色不会自动循环,最好多定义几个颜色
                                        var colorList = ['#00A3E0', '#FFA100', '#ffc0ca', '#CCCCCC', '#749f83', '#04A035', '#8729D9', '#c207c9', '#c90762', '#c90707'];
                                        return colorList[params.dataIndex]
                                    }
                                }
                            }

附带网图背景

二、第二种效果

效果图

使用步骤 

完整实例,copy就可直接使用

<template>
    <div :class="className" :style="{height:height,width:width}" />
</template>

<script>
    import echarts from 'echarts'
    require('echarts/theme/macarons') // echarts theme
    import resize from '@/views/dashboard/mixins/resize'

    export default {
        mixins: [resize],
        props: {
            className: {
                type: String,
                default: 'chart'
            },
            width: {
                type: String,
                default: '100%'
            },
            height: {
                type: String,
                default: '400px'
            },
            dataList: {
                type: Array,
                default: []
            }
        },
        data() {
            return {
                chart: null,
                xAxisData: ['区域1', '区域2', '区域3', '区域4', '区域5', '区域6', '区域7', '区域8', '区域9'],
                colorArr: ['#0C628C', '#3887D5', '#2570BB'],
                barWidth: 30,
                data1: [6, 7, 3, 11, 33, 38, 22, 55, 66],
                bottomData: [1, 1, 1, 1, 1, 1, 1, 1, 1],
                topData: [100, 100, 100, 100, 100, 100, 100, 100, 100],
                names: ["区域"]
            }
        },
        mounted() {
            this.$nextTick(() => {
                this.initChart()
            })
        },
        beforeDestroy() {
            if (!this.chart) {
                return
            }
            this.chart.dispose()
            this.chart = null
        },
        watch: {
            dataList(val, oldVal) {//普通的watch监听
                this.initChart()
            }
        },
        methods: {
            initChart() {
                var color = {
                    type: 'linear',
                    x: 0,
                    x2: 1,
                    y: 0,
                    y2: 0,
                    colorStops: [
                        {
                            offset: 0,
                            color: this.colorArr[0]
                        },
                        {
                            offset: 0.5,
                            color: this.colorArr[0]
                        },
                        {
                            offset: 0.5,
                            color: this.colorArr[1]
                        },
                        {
                            offset: 1,
                            color: this.colorArr[1]
                        }
                    ]
                }
                this.chart = echarts.init(this.$el, 'macarons')
                this.chart.setOption(
                    {
                        tooltip: {
                            trigger: 'axis',
                            formatter: function (params) {
                                var str = params[0].name + ':'
                                params.filter(function (item) {
                                    if (item.componentSubType == 'bar' && item.seriesName === '数据') {
                                        str += item.value
                                    }
                                })
                                return str
                            }
                        },
                        grid: {
                            left: '0%',
                            right: '10%',
                            bottom: '3%',
                            containLabel: true
                        },
                        xAxis: [
                            {
                                type: 'category',
                                name: this.names[0],
                                data: this.xAxisData,
                                // 更改坐标轴颜色
                                axisLine: {
                                    lineStyle: {
                                        color: "#FFFFFF"
                                    },
                                    onZero: false
                                },
                                // x轴的字体样式
                                axisLabel: {
                                    interval: 0,
                                    textStyle: {
                                        color: "#FFFFFF", // 更改坐标轴文字颜色
                                        fontSize: 14, // 更改坐标轴文字大小
                                        fontFamily: 'MicrosoftYaHei'
                                    },
                                }

                            }
                        ],
                        yAxis: [
                            {
                                type: 'value',
                                name: '得分',
                                axisLabel: {
                                    formatter: '{value}',
                                    textStyle: {
                                        color: this.fontColorY, // 更改坐标轴文字颜色
                                        fontSize: 12, // 更改坐标轴文字大小
                                        fontFamily: 'MicrosoftYaHei'
                                    }
                                },
                                // 更改坐标轴颜色
                                axisLine: {
                                    lineStyle: {
                                        color: "#FFFFFF"
                                    }
                                },
                                // 网格线
                                splitLine: {
                                    // 网格线
                                    lineStyle: {
                                        type: 'solid',
                                        with: 0.5,
                                        color: this.borderColor
                                    }
                                }
                            }
                        ],
                        series: [
                            // 数据低下的圆片
                            {
                                name: '',
                                type: 'pictorialBar',
                                symbolOffset: ['0%', '50%'],
                                symbolSize: [this.barWidth - 4, (10 * (this.barWidth - 4)) / this.barWidth],
                                z: 12,
                                symbol: 'diamond',
                                itemStyle: {
                                    opacity: 1,
                                    color: color
                                    // color: 'transparent'
                                },
                                data: this.bottomData
                            },
                            // 数据的柱状图
                            {
                                name: '数据',
                                type: 'bar',
                                barWidth: this.barWidth,
                                itemStyle: {
                                    // lenged文本
                                    opacity: 1, // 这个是 透明度
                                    color: color
                                },

                                data: this.data1
                            },
                            // 替代柱状图 默认不显示颜色,是最下方柱图的value值 - 20
                            {
                                type: 'bar',
                                symbol: 'diamond',
                                barWidth: this.barWidth + 2,
                                itemStyle: {
                                    color: 'transparent'
                                },
                                data: this.data1
                            },
                            // 数据顶部的样式
                            {
                                name: '',
                                type: 'pictorialBar',
                                symbol: 'diamond',
                                symbolOffset: ['0%', '-50%'],
                                symbolSize: [this.barWidth, 10],
                                z: 12,
                                itemStyle: {
                                    normal: {
                                        opacity: 1,
                                        color: this.colorArr[2],
                                        label: {
                                            show: true, // 开启显示
                                            position: 'top', // 在上方显示
                                            textStyle: {
                                                // 数值样式
                                                color: '#FFFFFF',
                                                fontSize: 12,
                                                top: 50
                                            }
                                        }
                                    }
                                },
                                symbolPosition: 'end',
                                data: this.data1
                            },

                            // 阴影的顶部
                            {
                                name: '', // 头部
                                type: 'pictorialBar',
                                symbol: 'diamond',
                                symbolOffset: ['0%', '-50%'],
                                symbolSize: [this.barWidth, 10],
                                z: 12,
                                symbolPosition: 'end',
                                itemStyle: {
                                    color: 'blue',
                                    opacity: 0.3,
                                    borderWidth: 1,
                                    borderColor: 'rgba(18, 47, 133,1)'
                                },
                                data: this.topData
                            },
                            // 后面的背景
                            {
                                name: '',
                                type: 'bar',
                                barWidth: this.barWidth,
                                barGap: '-100%',
                                z: 0,
                                itemStyle: {
                                    color: 'rgba(18, 47, 133,0.3)'
                                },

                                data: this.topData
                            }
                        ]
                    }
                )
            }
        }
    }
</script>

三、第三种效果

效果图

使用步骤

完整实例,copy就可直接使用 

<template>
    <div :class="className" :style="{height:height,width:width}" />
</template>

<script>
    import echarts from 'echarts'
    require('echarts/theme/macarons') // echarts theme
    import resize from '@/views/dashboard/mixins/resize'

    export default {
        mixins: [resize],
        props: {
            className: {
                type: String,
                default: 'chart'
            },
            width: {
                type: String,
                default: '100%'
            },
            height: {
                type: String,
                default: '400px'
            },
            dataList: {
                type: Array,
                default: []
            }
        },
        data() {
            return {
                chart: null,
                MAX: [800, 800, 800, 800, 800, 800, 800],
                NAME: [2015, 2016, 2017, 2018, 2019, 2020, 2021],
                VALUE: [200, 400, 300, 500, 700, 300, 100],
                VALUE2: [500, 200, 700, 400, 300, 600, 400],
            }
        },
        mounted() {
            this.$nextTick(() => {
                this.initChart()
            })
        },
        beforeDestroy() {
            if (!this.chart) {
                return
            }
            this.chart.dispose()
            this.chart = null
        },
        watch: {
            dataList(val, oldVal) {//普通的watch监听
                this.initChart()
            }
        },
        methods: {
            initChart() {
                const offsetX = 16;
                const offsetY = 8;
                [-18, 18].forEach((customOffset, index) => {
                    const CubeLeft = echarts.graphic.extendShape({
                        shape: {
                            x: 0,
                            y: 0,
                        },
                        buildPath: function (ctx, shape) {
                            const xAxisPoint = shape.xAxisPoint;
                            const c0 = [shape.x - customOffset, shape.y];
                            const c1 = [shape.x - offsetX - customOffset, shape.y - offsetY];
                            const c2 = [xAxisPoint[0] - offsetX - customOffset, xAxisPoint[1] - offsetY];
                            const c3 = [xAxisPoint[0] - customOffset, xAxisPoint[1]];
                            ctx.moveTo(c0[0], c0[1]).lineTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).closePath();
                        },
                    });
                    const CubeRight = echarts.graphic.extendShape({
                        shape: {
                            x: 0,
                            y: 0,
                        },
                        buildPath: function (ctx, shape) {
                            const xAxisPoint = shape.xAxisPoint;
                            const c1 = [shape.x - customOffset, shape.y];
                            const c2 = [xAxisPoint[0] - customOffset, xAxisPoint[1]];
                            const c3 = [xAxisPoint[0] + offsetX - customOffset, xAxisPoint[1] - offsetY];
                            const c4 = [shape.x + offsetX - customOffset, shape.y - offsetY];
                            ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath();
                        },
                    });
                    const CubeTop = echarts.graphic.extendShape({
                        shape: {
                            x: 0,
                            y: 0,
                        },
                        buildPath: function (ctx, shape) {
                            const c1 = [shape.x - customOffset, shape.y];
                            const c2 = [shape.x + offsetX - customOffset, shape.y - offsetY];
                            const c3 = [shape.x - customOffset, shape.y - offsetX];
                            const c4 = [shape.x - offsetX - customOffset, shape.y - offsetY];
                            ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath();
                        },
                    });
                    echarts.graphic.registerShape('CubeLeft' + index, CubeLeft);
                    echarts.graphic.registerShape('CubeRight' + index, CubeRight);
                    echarts.graphic.registerShape('CubeTop' + index, CubeTop);
                });
                this.chart = echarts.init(this.$el, 'macarons')
                this.chart.setOption(
                    {
                        backgroundColor: '#012366',
                        grid: {
                            left: '1%',
                            right: '8%',
                            bottom: '5%',
                            top: '8%',
                            containLabel: true,
                        },
                        tooltip: {
                            trigger: 'axis',
                            axisPointer: {            // 坐标轴指示器,坐标轴触发有效
                                type: 'shadow'        // 默认为直线,可选为:'line' | 'shadow'
                            },
                            formatter: function (e) {
                                var str =
                                    e[2].axisValue +
                                    "<br>" +
                                    "<span style='display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:" +
                                    "rgba(225,155,172, 1)" +
                                    ";'></span>" +
                                    "课程数量 : " +
                                    e[2].value +
                                    "<br>" +
                                    "<span style='display:inline-block;margin-right:5px;border-radius:10px;width:10px;height:10px;background-color:" +
                                    "rgba(25,155,172, 1)" +
                                    ";'></span>" +
                                    "完成数量 : " +
                                    e[3].value;
                                return str;
                            },
                        },
                        legend: {
                            orient: 'vertical',
                            x: 'right',
                            y: 'center',
                            data: ['课程数量', '完成数量',]
                        },
                        xAxis: {
                            type: 'category',
                            data: this.NAME,
                            name:"年份",
                            axisLine: {
                                show: true,
                                lineStyle: {
                                    width: 2,
                                    color: '#7ca7d9',
                                },
                            },
                            axisTick: {
                                show: false,
                            },
                            axisLabel: {
                                fontSize: 14,
                            },
                        },
                        yAxis: {
                            type: 'value',
                            name:"数量",
                            minInterval: 1,
                            axisLine: {
                                show: true,
                                lineStyle: {
                                    width: 2,
                                    color: '#2B7BD6',
                                },
                            },
                            splitLine: {
                                show: true,
                                lineStyle: {
                                    color: 'rgba(201,217,241,0.23)',
                                },
                            },
                            axisTick: {
                                show: false,
                            },
                            axisLabel: {
                                fontSize: 14,
                            },
                        },

                        dataZoom: [{
                            show: true,
                            height: 10,
                            xAxisIndex: [
                                0
                            ],
                            bottom: 0,
                            start: 10,
                            end: 50,
                            handleIcon: 'path://M306.1,413c0,2.2-1.8,4-4,4h-59.8c-2.2,0-4-1.8-4-4V200.8c0-2.2,1.8-4,4-4h59.8c2.2,0,4,1.8,4,4V413z',
                            handleSize: '110%',
                            handleStyle: {
                                color: "#d3dee5",

                            },
                            textStyle: {
                                color: "#fff"
                            },
                            borderColor: "#90979c"


                        }, {
                            type: "inside",
                            show: true,
                            height: 15,
                            start: 1,
                            end: 10
                        }],
                        series: [
                            {
                                // 最大高度
                                type: 'custom',
                                renderItem: function (params, api) {
                                    const location = api.coord([api.value(0), api.value(1)])
                                    return {
                                        type: 'group',
                                        children: [{
                                            type: 'CubeLeft0',
                                            shape: {
                                                api,
                                                x: location[0],
                                                y: location[1],
                                                xAxisPoint: api.coord([api.value(0), 0])
                                            },
                                            style: {
                                                fill: `rgba(25,155,172, .1)`
                                            }
                                        }, {
                                            type: 'CubeRight0',
                                            shape: {
                                                api,
                                                x: location[0],
                                                y: location[1],
                                                xAxisPoint: api.coord([api.value(0), 0])
                                            },
                                            style: {
                                                fill: `rgba(25,155,172, .3)`
                                            }
                                        }, {
                                            type: 'CubeTop0',
                                            shape: {
                                                api,
                                                x: location[0],
                                                y: location[1],
                                                xAxisPoint: api.coord([api.value(0), 0])
                                            },
                                            style: {
                                                fill: `rgba(25,155,172, .4)`
                                            }
                                        }]
                                    }
                                },
                                data: this.MAX
                            },

                            {
                                // 最大高度
                                type: 'custom',
                                renderItem: function (params, api) {
                                    const location = api.coord([api.value(0), api.value(1)])
                                    return {
                                        type: 'group',
                                        children: [{
                                            type: 'CubeLeft1',
                                            shape: {
                                                api,
                                                x: location[0],
                                                y: location[1],
                                                xAxisPoint: api.coord([api.value(0), 0])
                                            },
                                            style: {
                                                fill: `rgba(225,155,172, .1)`
                                            }
                                        }, {
                                            type: 'CubeRight1',
                                            shape: {
                                                api,
                                                x: location[0],
                                                y: location[1],
                                                xAxisPoint: api.coord([api.value(0), 0])
                                            },
                                            style: {
                                                fill: `rgba(225,155,172, .3)`
                                            }
                                        }, {
                                            type: 'CubeTop1',
                                            shape: {
                                                api,
                                                x: location[0],
                                                y: location[1],
                                                xAxisPoint: api.coord([api.value(0), 0])
                                            },
                                            style: {
                                                fill: `rgba(225,155,172, .4)`
                                            }
                                        }]
                                    }
                                },
                                data: this.MAX
                            },
                            {
                                type: 'custom',
                                renderItem: (params, api) => {
                                    const location = api.coord([api.value(0), api.value(1)]);
                                    return {
                                        type: 'group',
                                        children: [
                                            {
                                                type: 'CubeLeft0',
                                                shape: {
                                                    api,
                                                    xValue: api.value(0),
                                                    yValue: api.value(1),
                                                    x: location[0] - 0,
                                                    y: location[1],
                                                    xAxisPoint: api.coord([api.value(0), 0]),
                                                },
                                                style: {
                                                    fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                                                        {
                                                            offset: 0,
                                                            color: 'rgba(25,155,172, .5)',
                                                        },
                                                        {
                                                            offset: 1,
                                                            color: 'rgba(25,155,172, .5)',
                                                        },
                                                    ]),
                                                },
                                            },
                                            {
                                                type: 'CubeRight0',
                                                shape: {
                                                    api,
                                                    xValue: api.value(0),
                                                    yValue: api.value(1),
                                                    x: location[0] - 0,
                                                    y: location[1],
                                                    xAxisPoint: api.coord([api.value(0), 0]),
                                                },
                                                style: {
                                                    fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                                                        {
                                                            offset: 0,
                                                            color: 'rgba(25,155,172, 1)',
                                                        },
                                                        {
                                                            offset: 1,
                                                            color: 'rgba(25,155,172, .5)',
                                                        },
                                                    ]),
                                                },
                                            },
                                            {
                                                type: 'CubeTop0',
                                                shape: {
                                                    api,
                                                    xValue: api.value(0),
                                                    yValue: api.value(1),
                                                    x: location[0] - 0,
                                                    y: location[1],
                                                    xAxisPoint: api.coord([api.value(0), 0]),
                                                },
                                                style: {
                                                    fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                                                        {
                                                            offset: 0,
                                                            color: 'rgba(25,155,172, .8)',
                                                        },
                                                        {
                                                            offset: 1,
                                                            color: 'rgba(25,155,172, .8)',
                                                        },
                                                    ]),
                                                },
                                            },
                                        ],
                                    };
                                },
                                data: this.VALUE,
                            },
                            {
                                type: 'custom',
                                renderItem: (params, api) => {
                                    const location = api.coord([api.value(0), api.value(1)]);
                                    return {
                                        type: 'group',
                                        children: [
                                            {
                                                type: 'CubeLeft1',
                                                shape: {
                                                    api,
                                                    xValue: api.value(0),
                                                    yValue: api.value(1),
                                                    x: location[0] - 0,
                                                    y: location[1],
                                                    xAxisPoint: api.coord([api.value(0), 0]),
                                                },
                                                style: {
                                                    fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                                                        {
                                                            offset: 0,
                                                            color: 'rgba(225,155,172, .5)',
                                                        },
                                                        {
                                                            offset: 1,
                                                            color: 'rgba(225,155,172, .5)',
                                                        },
                                                    ]),
                                                },
                                            },
                                            {
                                                type: 'CubeRight1',
                                                shape: {
                                                    api,
                                                    xValue: api.value(0),
                                                    yValue: api.value(1),
                                                    x: location[0] - 0,
                                                    y: location[1],
                                                    xAxisPoint: api.coord([api.value(0), 0]),
                                                },
                                                style: {
                                                    fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                                                        {
                                                            offset: 0,
                                                            color: 'rgba(225,155,172, 1)',
                                                        },
                                                        {
                                                            offset: 1,
                                                            color: 'rgba(225,155,172, .5)',
                                                        },
                                                    ]),
                                                },
                                            },
                                            {
                                                type: 'CubeTop1',
                                                shape: {
                                                    api,
                                                    xValue: api.value(0),
                                                    yValue: api.value(1),
                                                    x: location[0] - 0,
                                                    y: location[1],
                                                    xAxisPoint: api.coord([api.value(0), 0]),
                                                },
                                                style: {
                                                    fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                                                        {
                                                            offset: 0,
                                                            color: 'rgba(225,155,172, .8)',
                                                        },
                                                        {
                                                            offset: 1,
                                                            color: 'rgba(225,155,172, .8)',
                                                        },
                                                    ]),
                                                },
                                            },
                                        ],
                                    };
                                },
                                data: this.VALUE2,
                            },
                        ],
                    }
                )
            }
        }
    }
</script>

四、第四种效果

效果图

使用步骤

完整实例,copy就可直接使用

<template>
    <div :class="className" :style="{height:height,width:width}" />
</template>

<script>
    import echarts from 'echarts'
    require('echarts/theme/macarons') // echarts theme
    import resize from '@/views/dashboard/mixins/resize'

    export default {
        mixins: [resize],
        props: {
            className: {
                type: String,
                default: 'chart'
            },
            width: {
                type: String,
                default: '100%'
            },
            height: {
                type: String,
                default: '400px'
            },
            dataList: {
                type: Array,
                default: []
            }
        },
        data() {
            return {
                chart: null,
                targetData: [50, 60, 40, 80, 120, 90, 70],
                manualData: [22, 35, 30, 25, 12, 41, 51],
                mechanismData: [40, 45, 40, 55, 22, 46, 61],
                xData:['1月', '2月', '3月', '4月', '5月', '6月', '7月'],
                names:['手工', '机制', '目标值']
            }
        },
        mounted() {
            this.$nextTick(() => {
                this.initChart()
            })
        },
        beforeDestroy() {
            if (!this.chart) {
                return
            }
            this.chart.dispose()
            this.chart = null
        },
        watch: {
            dataList(val, oldVal) {//普通的watch监听
                this.initChart()
            }
        },
        methods: {
            initChart() {

                const color1 = {
                    type: 'linear',
                    x: 1,
                    y: 0,
                    x2: 1,
                    y2: 1,
                    colorStops: [
                        {
                            offset: 0,
                            color: '#9DCAF4'
                        },
                        {
                            offset: 0.8,
                            color: '#0B87FB'
                        }
                    ]
                };

                const color2 = {
                    type: 'linear',
                    x: 1,
                    y: 0,
                    x2: 1,
                    y2: 1,
                    colorStops: [
                        {
                            offset: 0,
                            color: '#31D5C7'
                        },
                        {
                            offset: 0.8,
                            color: 'rgba(29, 39, 115,0.2)'
                        }
                    ]
                };

                this.chart = echarts.init(this.$el, 'macarons')
                this.chart.setOption(
                    {
                        legend: {
                            data: this.names,
                            x: 'right',
                            textStyle: {
                                // 图例文字大小颜色
                                fontSize: 12,
                                color: '#ffffff'
                            }
                        },
                        tooltip: {
                            trigger: 'axis',
                            axisPointer: {
                                type: 'shadow' // 'shadow' as default; can also be 'line' or 'shadow'
                            }
                        },
                        grid: {
                            left: '1%',
                            right: '1%',
                            bottom: '2%',
                            top: '12%',
                            containLabel: true
                        },
                        xAxis: {
                            type: 'category',
                            data: this.xData,
                            axisLabel: {
                                color: '#fff'
                            },
                            axisLine: {
                                show: true,
                                lineStyle: {
                                    color: 'rgba(255, 255, 2555, 0.1)'
                                }
                            }
                        },
                        yAxis: [
                            {
                                type: 'value',
                                name: '制作数量',
                                axisLabel: {
                                    color: '#fff',
                                    axisLabel: {
                                        color: '#fff',
                                        //y轴文字的配置
                                        textStyle: {
                                            color: "#fff",
                                        },
                                    },
                                },
                                splitLine: {
                                    show: true,
                                    lineStyle: {
                                        color: 'rgba(255,255,255,0.2)'
                                    }
                                },
                                nameTextStyle: {
                                    //y轴上方单位的颜色
                                    color: "#fff",
                                },
                            },
                            {
                                type: 'value',
                                name: '目标值',
                                min: 0,
                                max: 250,
                                interval: 50,
                                axisLabel: {
                                    color: '#fff',
                                    //y轴文字的配置
                                    textStyle: {
                                        color: "#fff",
                                    },
                                },
                                splitLine: {
                                    show: false,
                                    lineStyle: {
                                        color: 'rgba(255,255,255,0.2)'
                                    }
                                },
                                nameTextStyle: {
                                    //y轴上方单位的颜色
                                    color: "#fff",
                                },
                            }
                        ],
                        series: [
                            {
                                itemStyle: {
                                    normal: {
                                        // 这里是用一个柱子,从左到右的渐变。也可以用两个柱子做从上往下的渐变,和上面的透明渐变一样用法
                                        color: color1
                                    }
                                },
                                data: this.manualData,
                                type: 'bar',
                                barWidth: 19,
                                z: 2,
                                name: this.names[0]
                            },
                            {
                                z: 3,
                                name: this.names[0],
                                type: 'pictorialBar',
                                // 柱子顶部
                                symbolPosition: 'end',
                                data: this.manualData,
                                symbol: 'diamond',
                                symbolOffset: ['-12', -11],
                                symbolRotate: 90,
                                symbolSize: [10, 21],
                                itemStyle: {
                                    normal: {
                                        borderWidth: 1,
                                        color: 'blue'
                                    }
                                },
                                tooltip: {
                                    show: false
                                }
                            },

                            {
                                itemStyle: {
                                    normal: {
                                        // 这里是用一个柱子,从左到右的渐变。也可以用两个柱子做从上往下的渐变,和上面的透明渐变一样用法
                                        color: color2
                                    }
                                },
                                data: this.mechanismData,
                                type: 'bar',
                                barWidth: 19,
                                z: 2,
                                name: this.names[1]
                            },
                            {
                                z: 3,
                                name: this.names[1],
                                type: 'pictorialBar',
                                // 柱子顶部
                                symbolPosition: 'end',
                                data: this.mechanismData,
                                symbol: 'diamond',
                                symbolOffset: [12, -11],
                                symbolRotate: 90,
                                symbolSize: [8, 19],
                                itemStyle: {
                                    normal: {
                                        borderWidth: 1,
                                        color: 'green'
                                    }
                                },
                                tooltip: {
                                    show: false
                                }
                            },

                            {
                                name: this.names[2],
                                type: 'line',
                                yAxisIndex: 1,
                                data: this.targetData,
                                itemStyle: {
                                    normal: {
                                        color: '#FFDE55', //圈圈的颜色
                                        lineStyle: {
                                            color: '#FFDE55' //线的颜色
                                        }
                                    }
                                }
                            }
                        ]
                    }
                )
            }
        }
    }
</script>

五、第五种效果

效果图

使用步骤

完整实例,copy就可直接使用

<template>
  <div :class="className" :style="{height:height,width:width}" />
</template>

<script>
  import echarts from 'echarts'
  require('echarts/theme/macarons') // echarts theme
  import resize from '@/views/dashboard/mixins/resize'

  export default {
    mixins: [resize],
    props: {
      className: {
        type: String,
        default: 'chart'
      },
      width: {
        type: String,
        default: '100%'
      },
      height: {
        type: String,
        default: '400px'
      },
      dataList: {
        type: Array,
        default: []
      },
      titleName: {
        type: String,
        default: 'echarts'
      },
      names: {
        type: Array,
        default: ['成本', '目标']
      }
    },
    data() {
      return {
        chart: null,
        sourceList: [],
        listData1: [],
        dataBottom: [],
        listData2: [],
        max: 0,
        maxDate1: 0,
        maxDate2: 0,
      }
    },
    mounted() {
      this.$nextTick(() => {
        this.initChart()
      })
    },
    beforeDestroy() {
      if (!this.chart) {
        return
      }
      this.chart.dispose()
      this.chart = null
    },
    watch: {
      dataList(val, oldVal) {//普通的watch监听
        this.initChart()
      }
    },
    methods: {
      initChart() {
        this.chart = echarts.init(this.$el, 'macarons')
        this.sourceList = []
        this.listData1 = []
        this.listData2 = []
        for (let i = 0; i < this.dataList.length; i++) {
          this.sourceList.push(this.dataList[i].techName)
          this.listData1.push((this.dataList[i].oneNum))
          this.dataBottom.push(1)
          this.listData2.push(this.dataList[i].twoNum)
        }
        this.sourceList = ["2024","2023","2022","2021","2020","2019","2018"]
          this.listData1 = [12,10,0,9,0,5,8]
          this.dataBottom = [1,1,1,1,1,1,1]
          this.listData2 = [11,12,15,6,22,15,10]
        //获取纵坐标最大值--start
        this.maxDate1 = this.listData1[0];
        for (let i = 0; i < this.listData1.length; i++) {
          let item = this.listData1[i];
          item > this.maxDate1 ? this.maxDate1 = item : this.maxDate1 = this.maxDate1;
        }
        this.maxDate2 = this.listData2[0];
        for (let i = 0; i < this.listData2.length; i++) {
          let item = this.listData2[i];
          item > this.maxDate2 ? this.maxDate2 = item : this.maxDate2 = this.maxDate2;
        }
        this.maxDate1 = this.maxDate1 + 1
        this.maxDate2 = this.maxDate2 + 1
        //获取纵坐标最大值--end
        this.chart.setOption({
          tooltip: {
            trigger: 'axis',
            axisPointer: {
              type: 'cross',
              label: {
                backgroundColor: '#6a7985'
              }
            },
            formatter: function (params) {
              var str = '<div style=" font-size: 16px;color:#FFFFFF">'
              str = str + params[0].name + '<br>'
              params.filter(function (item) {
                if (item.componentSubType === 'bar' || item.componentSubType === 'line') {
                  str = str + item.seriesName + ':' + item.data + '<br>'
                }
              })
              str = str + '</div>'
              return str;
            }
          },
          toolbox: {
            feature: {
              dataView: { show: true, readOnly: true },
              magicType: { show: true, type: ['line', 'bar'] },
              restore: { show: true },
              saveAsImage: { show: true, backgroundColor: '#79B9F5', name: this.titleName }
            },
            right: '20px',
          },
          grid: {
            left: '3%',
            right: '3%',
            bottom: '3%',
            containLabel: true
          },
          legend: {
            data: this.names,
            left: '20px',
            textStyle: {
              color: '#FFFFFF'
            }
          },
          xAxis: [
            {
              type: 'category',
              data: this.sourceList,
              axisLine: {
                //x轴线的颜色以及宽度
                show: true,
                lineStyle: {
                  color: "#FFFFFF",
                  type: "solid",
                },
              },
              axisPointer: {
                type: 'shadow'
              },
              axisLabel: {
                show: true,
                rotate: 45,    // 设置x轴标签旋转角度
                margin: 15
              }
            }
          ],
          yAxis: [
            {
              type: 'value',
              name: this.names[0],
              axisLabel: {
                //y轴文字的配置
                textStyle: {
                  color: "#fff",
                },
              },
              axisLine: {
                //y轴线的颜色以及宽度
                show: true,
                lineStyle: {
                  color: "#fff",
                  width: 1,
                  type: "solid",
                },
              },
              splitLine: {
                //分割线配置
                show: false,
                lineStyle: {
                  color: "#fff",
                },
              },
              nameTextStyle: {
                //y轴上方单位的颜色
                color: "#fff",
              },
              max: this.maxDate1
            },
            {
              type: 'value',
              name: this.names[1],
              axisLabel: {
                //y轴文字的配置
                textStyle: {
                  color: "#fff",
                },
              },
              axisLine: {
                //y轴线的颜色以及宽度
                show: true,
                lineStyle: {
                  color: "#fff",
                  width: 1,
                  type: "solid",
                },
              },
              splitLine: {
                //分割线配置
                show: false,
                lineStyle: {
                  color: "#fff",
                },
              },
              nameTextStyle: {
                //y轴上方单位的颜色
                color: "#fff",
              },
              //设置纵坐标最大值
              max: this.maxDate2
            },
          ],
          series: [
            {
              itemStyle: {
                normal: {
                  // 这里是用一个柱子,从左到右的渐变。也可以用两个柱子做从上往下的渐变,和上面的透明渐变一样用法
                  color: {
                    type: 'linear',
                    x: 1,
                    y: 0,
                    x2: 1,
                    y2: 1,
                    colorStops: [
                      { offset: 0, color: '#83bff6' },
                      { offset: 0.5, color: '#188df0' },
                      { offset: 1, color: 'blue' }
                    ]
                  }
                }
              },
              data: this.listData1,
              type: 'bar',
              barWidth: 40,
              tooltip: {
                valueFormatter: function (value) {
                  return value;
                }
              },
              z: 2,
              name: this.names[0]
            },
            // 底部的光晕
            {
              name: this.names[0],
              type: 'pictorialBar',
              tooltip: {
                show: false
              },
              symbolSize: [60, 20],
              symbolOffset: [0, 10],
              z: 1,
              itemStyle: {
                normal: {
                  color: 'transparent',
                  borderColor: '#26B2E8',
                  borderType: 'solid',
                  borderWidth: 2
                }
              },
              data: this.dataBottom
            },
            {
              //底部圆片
              name: this.names[0],
              type: 'pictorialBar',
              symbolSize: [40, 15],
              symbolOffset: [0, 5],
              z: 12,
              itemStyle: {
                opacity: 1,
                color: 'blue',
                borderColor: '#03529A'
              },
              data: this.dataBottom
            },
            //头部圆片
            {
              name: this.names[0], // 头部
              type: 'pictorialBar',
              symbolSize: [40, 15],
              symbolOffset: [0, -7],
              z: 3,
              symbolPosition: 'end',
              itemStyle: {
                color: '#188df0',
                opacity: 1
              },
              data: this.listData1
            },
            {
              name: this.names[1],
              type: 'line',
              z: 12,
              yAxisIndex: 1,
              tooltip: {
                valueFormatter: function (value) {
                  return value;
                }
              },
              lineStyle: {
                normal: {
                  width: 3 //折线宽度
                },
              },
              itemStyle: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                  { offset: 0, color: '#93CE07' },
                  { offset: 0.2, color: '#FBDB0F' },
                  { offset: 0.4, color: '#FC7D02' },
                  { offset: 0.6, color: '#FD0100' },
                  { offset: 0.8, color: '#AA069F' },
                  { offset: 1, color: '#AC3B2A' }
                ])
              },
              data: this.listData2
            }
          ]
        })
      }
    }
  }
</script>

六、3D饼图实现

vue中如何使用echarts和echarts-gl实现3D饼图环形饼图_echarts 3d饼图-CSDN博客

七、Echarts:象形柱图实现水塔水位的动画、水球图和液位柱子图 

Echarts:象形柱图实现水塔水位的动画、水球图和液位柱子图_echarts html 液位柱子图-CSDN博客

八、3D折线图实现

vue中如何使用echarts和echarts-gl实现三维折线图-CSDN博客

resize.js 

import { debounce } from '@/utils'

export default {
  data() {
    return {
      $_sidebarElm: null,
      $_resizeHandler: null
    }
  },
  mounted() {
    this.initListener()
  },
  activated() {
    if (!this.$_resizeHandler) {
      // avoid duplication init
      this.initListener()
    }

    // when keep-alive chart activated, auto resize
    this.resize()
  },
  beforeDestroy() {
    this.destroyListener()
  },
  deactivated() {
    this.destroyListener()
  },
  methods: {
    // use $_ for mixins properties
    // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
    $_sidebarResizeHandler(e) {
      if (e.propertyName === 'width') {
        this.$_resizeHandler()
      }
    },
    initListener() {
      this.$_resizeHandler = debounce(() => {
        this.resize()
      }, 100)
      window.addEventListener('resize', this.$_resizeHandler)

      this.$_sidebarElm = document.getElementsByClassName('sidebar-container')[0]
      this.$_sidebarElm && this.$_sidebarElm.addEventListener('transitionend', this.$_sidebarResizeHandler)
    },
    destroyListener() {
      window.removeEventListener('resize', this.$_resizeHandler)
      this.$_resizeHandler = null

      this.$_sidebarElm && this.$_sidebarElm.removeEventListener('transitionend', this.$_sidebarResizeHandler)
    },
    resize() {
      const { chart } = this
      chart && chart.resize()
    }
  }
}

防抖函数 

/**
 * @param {Function} fn 防抖函数
 * @param {Number} delay 延迟时间
 */
export function debounce(fn, delay) {
  var timer;
  return function () {
    var context = this;
    var args = arguments;
    clearTimeout(timer);
    timer = setTimeout(function () {
      fn.apply(context, args);
    }, delay);
  };
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1889356.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

RAG技术下的文档智能检索

在数字化浪潮的推动下&#xff0c;信息检索已成为我们日常生活中不可或缺的一部分。然而&#xff0c;随着数据量的爆炸式增长&#xff0c;如何快速精准地从海量文档中检索出有价值的信息&#xff0c;成为了一个巨大的挑战。本文将带您走进 Pinecone 向量数据库的世界&#xff0…

计算机图形学games101——MVP

首先记得一个知识点 在旋转矩阵中&#xff0c;旋转矩阵的逆矩阵就是旋转矩阵的转置&#xff0c;这个矩阵是正交矩阵 我们需要做到的就是观测变换&#xff0c;这个变换包括视图变换和投影变换&#xff08;投影变换包含正交变换和透视变换&#xff09; 三维变换复习 首先复习…

Ubuntu20.04配置TurtleBot3 Waffle Pi远程控制

这里写目录标题 0. 机器人配置1. Ubuntu20.04配置TurtleBot3 Waffle Pi远程控制1.1 TurtleBot3 Waffle Pi端配置1.2 PC端配置1.2.1 安装turtlebot3的环境配置1.2.2 创建项目并安装Turtlebot31.2.3 配置环境变量 1.3 PC端与TurtleBot3进行通信1.3.1 PC端与机器人端互PING和SSH连…

ATA-L2水声功率放大器驱动水声换能器的测试研究

随着水声通信技术的发展&#xff0c;水下通信设备也开始逐步走向实用化&#xff0c;为了满足其实际的使用要求&#xff0c;功率放大器的设计需要具有高效率的特性&#xff0c;并能在水下长时间连续可靠的工作。 压电陶瓷换能器主要负责电信号与声信号之间的转换&#xff0c;换能…

ruoyi-cloud登录接口实现滑块验证码

一、前言 ruoyi项目默认的验证码是这样的 今天来尝试增加滑块验证码&#xff0c;我们用到的是tianai-captcha。 文档地址&#xff1a;http://doc.captcha.tianai.cloud/ 源码地址&#xff1a;https://gitee.com/tianai/tianai-captcha 下面来看具体的步骤。 二、后端 在g…

JL-33 手持式气象站/便携式气象站 小型气象站厂家 微型气象站

产品概述 手持式气象站是一款携带方便&#xff0c;操作简单&#xff0c;集多项气象要素于一体的可移动式气象观测仪器。产品采用传感器及芯片&#xff0c;能同时对空气温度、空气湿度、风速、风向、光照、大气压力、颗粒物、噪声等要素进行准确测量、记录并存储。仪器带有机械…

游泳哪个牌子好?6大游泳耳机选购技巧总结分享

游泳耳机作为水上运动爱好者和游泳专业人士的必备装备&#xff0c;不仅要能够抵御水的侵入&#xff0c;还要提供清晰的音质和舒适的佩戴体验。在市面上&#xff0c;不同品牌的游泳耳机琳琅满目&#xff0c;选择起来可能会令人头疼。本文旨在为您提供一份详尽的游泳耳机选购指南…

详细解释下flutter初始示例的代码

详细解释下flutter初始示例的代码 main 首句导入需要的包 类似于其他语言的import main函数为入口函数 包裹MyApp类 MyApp 这个类继承自无状态类 可见myapp不管理任何状态 build方法是所有widget内必须实现的方法 此处返回一个 ChangeNotferiProvider 可以看到它用于管理应…

2024年低碳发展与地球科学国际会议 (LCDES 2024)

2024年低碳发展与地球科学国际会议 (LCDES 2024) 2024 International Conference on Low Carbon Development and Earth Science 【重要信息】 大会地点&#xff1a;长沙 大会官网&#xff1a;http://www.iclcdes.com 投稿邮箱&#xff1a;iclcdessub-conf.com 【注意&#xf…

一个opencv实现检测程序

引言 图像处理是计算机视觉中的一个重要领域&#xff0c;它在许多应用中扮演着关键角色&#xff0c;如自动驾驶、医疗图像分析和人脸识别等。边缘检测是图像处理中的基本任务之一&#xff0c;它用于识别图像中的显著边界。本文将通过一个基于 Python 和 OpenCV 的示例程序&…

《昇思25天学习打卡营第6天|网络构建》

文章目录 前言&#xff1a;今日所学&#xff1a;1. 定义模型类2. 模型层3. 模型参数 前言&#xff1a; 在第六节中我们学习了网络构建&#xff0c;了解了神经网络模型是由神经网络层和Tensor操作构成&#xff0c;我们使用的mindspore.nn中提供了常见的升级网络层的实现&#x…

c++边界处理机制

1.vector std::vector&#xff1a;std::vector 是动态数组&#xff0c;它会在运行时动态地调整存储空间大小&#xff0c;因此当访问超出边界时&#xff0c;会触发运行时异常 std::out_of_range。可以通过try-catch块来捕获这种异常来处理越界访问。 #include <iostream>…

十五、【源码】给代理对象设置属性

源码地址&#xff1a;https://github.com/spring-projects/spring-framework 仓库地址&#xff1a;https://gitcode.net/qq_42665745/spring/-/tree/15-proxy-set-property 给代理对象设置属性 之前的代码是创建Bean进行判断&#xff0c;要不要进行代理&#xff0c;如果代理…

console 报错 之 Uncaught (in promise) RangeError: Maximum call stack size exceeded

1. 背景 demo 环境报错。。。 2. 报错问题 3. 问题原因 vue 报错: “RangeError: Maximum call stack size exceeded” 报错通常是由于无限的递归 导致的。当使用 Vue 路由时&#xff0c;如果设置不当&#xff0c;会导致无限的递归&#xff0c;最终导致栈溢出&#xff0c;即…

【TypeScript】TS入门到实战(详解:高级类型)

目录 第三章、TypeScript的数据类型 3.1 TypeScript的高级类型 3.1.1 class 3.1.1.1 熟悉class类 3.1.1.2 class类继承的两种方式 3.1.1.3 class类的5种修饰符 3.1.2 类型兼容 3.1.3 交叉类型 3.1.4 泛型 3.1.4.1 创建泛型函数 3.1.4.2 泛型函数的调用 3.1.4.3 泛型…

【操作与配置】Linux的CPU深度学习环境

Conda安装 可浏览官网&#xff1a;Miniconda — Anaconda 文档 这四条命令会快速而且悄悄地安装最新的64位安装程序&#xff0c;然后清理安装过程中产生的文件。如果需要安装 Linux 版本的其他版本或架构的 Miniconda&#xff0c;只需要在命令中更改安装程序的名称。 mkdir …

【C++】const详解

&#x1f4e2;博客主页&#xff1a;https://blog.csdn.net/2301_779549673 &#x1f4e2;欢迎点赞 &#x1f44d; 收藏 ⭐留言 &#x1f4dd; 如有错误敬请指正&#xff01; &#x1f4e2;本文作为 JohnKi &#xff0c;引用了部分大佬的案例 &#x1f4e2;未来很长&#xff0c;…

【Kali-linux for WSL】图形化界面安装

文章目录 前言图形化界面安装 前言 之前在WSL中安装了Kali 启动之后发现什么都没有&#xff01;&#xff01;&#xff01; 那我还怎么学习渗透技术&#xff1f;&#xff1f;&#xff1f; 看来&#xff0c;得改进下我的kali-linux for wsl&#xff0c;安装个图形化界面 图形化…

JCR一区级 | Matlab实现BO-Transformer-LSTM多变量回归预测

JCR一区级 | Matlab实现BO-Transformer-LSTM多变量回归预测 目录 JCR一区级 | Matlab实现BO-Transformer-LSTM多变量回归预测效果一览基本介绍程序设计参考资料 效果一览 基本介绍 1.Matlab实现BO-Transformer-LSTM多变量回归预测&#xff0c;贝叶斯优化Transformer结合LSTM长…

【Python】Python中的常量与变量

常量与变量 导读一、新建项目二、常量2.1 字面常量2.2 特殊常量 三、变量3.1 变量的定义3.2 变量的命名3.2.1 关键字 结语 导读 大家好&#xff0c;很高兴又和大家见面啦&#xff01;&#xff01;&#xff01; 在上一篇内容中我们详细介绍了Python环境的搭建过程&#xff0c;…