图表仅在折线图中拖动y轴的点

时间:2018-11-20 12:34:02

标签: charts draggable drag linechart echarts

如何更改Echart线的y轴上的点

  

Echart可拖动折线图

if (!app.inNode) {
setTimeout(function () {
    // Add shadow circles (which is not visible) to enable drag.
    myChart.setOption({
        graphic: echarts.util.map(data, function (item, dataIndex) {
            return {
                type: 'circle',
                position: myChart.convertToPixel('grid', item),
                shape: {
                    cx: 0,
                    cy: 0,
                    r: symbolSize / 2
                },
                invisible: true,
                draggable: true,
                ondrag: echarts.util.curry(onPointDragging, dataIndex),
                onmousemove: echarts.util.curry(showTooltip, dataIndex),
                onmouseout: echarts.util.curry(hideTooltip, dataIndex),
                z: 100
            };
        })
    });
}, 0);
window.addEventListener('resize', updatePosition);
}

//点拖动功能 这是为点拖动编写的函数

function onPointDragging(dataIndex, dx, dy) {
data[dataIndex] = myChart.convertFromPixel('grid', this.position);
myChart.setOption({
    series: [{
        id: 'a',
        data: data
    }]
});

};

0 个答案:

没有答案