在 ECharts 中,你可以通过 axisPointer 属性来配置 y 轴坐标轴指示器的拖拽手柄。以下是一个简单的示例:
option = {
    yAxis: {
        type: 'value',
        axisPointer: {
            show: true,
            type: 'shadow',
            label: {
                show: true,
                precision: 2,
                formatter: function (params) {
                    return 'Value: ' + params.value;
                },
                backgroundColor: 'rgba(50, 50, 50, 0.7)',
                borderColor: '#333',
                borderWidth: 1,
                padding: [10, 15],
                textStyle: {
                    color: 'white',
                    fontSize: 12,
                    fontWeight: 'bold'
                }
            },
            handle: {
                show: true,  // 显示手柄
                icon: 'rect',  // 手柄的形状,可选为 'rect'、'circle'、'arrow'
                color: 'rgba(50, 50, 50, 0.7)',  // 手柄颜色
                size: 10  // 手柄大小
            }
        },
        // 其他 yAxis 相关配置...
    },
    // 其他配置项...
    series: [
        {
            name: '示例系列',
            type: 'bar',
            data: [10, 20, 15, 25, 30]
        }
        // 其他系列...
    ]
};

在上面的代码中,通过在 handle 属性中设置 show、icon、color 和 size 等参数,你可以配置 y 轴坐标轴指示器的拖拽手柄。

你可以根据实际需求调整这些参数以满足你的设计要求。


转载请注明出处:http://www.zyzy.cn/article/detail/5223/ECharts