echarts 缓动动画

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>动画配置项t</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/echarts/5.3.3/echarts.common.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
</head>

<body>
    <div id="main" style="height: 800px;width: 1200px;"></div>

    <script>
        barData = [3324, 2352, 4522, 1469, 6379, 5315, 2793, 4324]
        barData1 = [2312, 3145, 6754, 8712, 3157, 1023, 5623, 8324]
        x_Data = ['a部门', 'b部门', 'c部门', 'd部门', 'e部门', 'f部门', 'g部门', 'h部门']


        var myChart1 = echarts.init(document.getElementById('main'))
        var option = {
            animation: true, // 1.默认开启动画
            animationDuration: function(ec) { // 2.动画时长
                // 越往后的数据时长越大
                return ec * 1000 // 毫秒,1秒,支持回调函数
            },
            animationEasing: "bounceOut", // 3.缓动动画
            animationThreshold: 15, // 4.动画周期(是否开启动画的阈值,当单个系列显示的图形数量大于这个阈值时会关闭动画。)

            title: [{
                text: '缓动动画',
                left: '40%',
                textStyle: {
                    color: 'red',
                    fontSize: 30,
                    fontFamily: "serif"
                }
            }],
            xAxis: {
                name: '部门',
                type: 'category',
                data: x_Data
            },
            yAxis: {
                name: '销量(件)',
                type: 'value',
                min: 0,
                max: 10000,
                interval: 2000
            },
            series: [{
                name: '销量柱状图',
                type: 'bar',
                data: barData,
                stack: '总量',
                barWidth: 25,
                markPoint: {
                    data: [{
                        type: 'max',
                        name: '最大值'
                    }, {
                        type: 'min',
                        name: '最小值'
                    }]
                },
                markLine: {
                    data: [{
                        type: 'average',
                        name: '平均值'
                    }],
                },

            }]
        };
        myChart1.setOption(option)
    </script>
</body>

</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值