【问题标题】:How to scroll with mouse wheel and keyboard on vertical slider in echarts?如何在echarts的垂直滑块上使用鼠标滚轮和键盘滚动?
【发布时间】:2020-04-15 12:28:21
【问题描述】:

我需要用鼠标滚轮和键盘垂直滚动一个 echart 组件。我已经尝试过数据缩放配置moveOnMouseWheelmoveOnMouseWheel,但只能缩放图表。我不希望它放大。垂直滚动条应该用鼠标和键盘上下移动。

演示 - https://codesandbox.io/s/echarts-twb1u?file=/src/datepicker.js:970-995

【问题讨论】:

    标签: reactjs charts frontend data-visualization echarts


    【解决方案1】:

    您必须为内部缩放设置滑块 zoomLock: true 和以下选项:

    zoomOnMouseWheel: false,
    moveOnMouseMove: true,
    moveOnMouseWheel: true
    

    如果您查看Gantt example,您会看到这些设置:

    {
        type: 'slider',
        yAxisIndex: 0,
        zoomLock: true,
        width: 10,
        right: 10,
        top: 70,
        bottom: 20,
        start: 95,
        end: 100,
        handleSize: 0,
        showDetail: false,
    }, {
        type: 'inside',
        id: 'insideY',
        yAxisIndex: 0,
        start: 95,
        end: 100,
        zoomOnMouseWheel: false,
        moveOnMouseMove: true,
        moveOnMouseWheel: true
    }
    

    【讨论】:

      猜你喜欢
      • 2013-02-01
      • 2012-05-18
      • 2018-04-11
      • 1970-01-01
      • 2016-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多