美文网首页
EChart X,Y轴滑动滚动条添加设置

EChart X,Y轴滑动滚动条添加设置

作者: 书十一 | 来源:发表于2020-11-12 11:43 被阅读0次

实例代码粘贴即用

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>

</head>

<body>

    <div id="MeCharts" style="width: 500px;height: 500px; background-color: #000">

    </div>

</body>

<script src="https://cdn.bootcdn.net/ajax/libs/echarts/5.0.0-beta.2/echarts.min.js"></script>

<script>

    var MeOption = {

        grid: {

            left: '3%',

            top: '0',

            bottom: '0',

            right: '5%',

            containLabel: true

        },

        xAxis: {

            show: false

        },

        yAxis: {

            axisLine: {

                show: false

            },

            axisLabel: {

                color: '#CED1DE',

            },

            axisTick: {

                show: false

            },

            type: 'category',

            data: ['潍城区', '奎文区', '坊子区', '寒亭区', '青州市', '诸城市', '寿光市', '安丘市', '高密市', '昌邑市', '临朐县', '昌乐县'],

        },

        //y轴滚动条

        dataZoom: [{

            type: 'slider',

            //隐藏或显示(true)组件

            show: true,

            start: 60,

            end: 10,

            yAxisIndex: 0,

            filterMode: 'empty',

            width: 10,

            //滚动条高度

            height: '80%',

            //滚动条显示位置

            left: '95%',

            handleSize: 8,

            zoomLoxk: true,

            top: 'middle',

            textStyle: {

                color: "#fff",

                fontSize: 10,

            },

        }, ],

        series: [{

            type: 'bar',

            itemStyle: {

                barBorderRadius: 10,

                color: new echarts.graphic.LinearGradient(

                    0, 0, 1, 0, [{

                        offset: 0,

                        color: '#88D4FC'

                    }, {

                        offset: 1,

                        color: '#1DCCC9'

                    }]

                )

            },

            label: {

                show: true,

                position: 'right',

                color: '#1DCCC9'

            },

            barWidth: 10,

            data: [578, 245, 321, 160, 282, 177, 198, 578, 245, 321, 160, 282]

        }]

    };

    var MeCharts = echarts.init(document.getElementById("MeCharts"));

    MeCharts.setOption(MeOption);

</script>

</html>

相关文章

网友评论

      本文标题:EChart X,Y轴滑动滚动条添加设置

      本文链接:https://www.haomeiwen.com/subject/slwubktx.html