console
const symbolSize = 20;
const data = [['a', 30],['b', 289],['c', 30],['d', 48],['e',59]];
option = {
title: {
text: 'Try Dragging these Points',
left: 'center'
},
grid: {
top: '8%',
bottom: '12%'
},
xAxis: {
type: 'category',
data: ['a', 'b', 'c', 'd', 'e'],
},
yAxis: {
type: 'value',
},
series: [
{
id: 'a',
type: 'line',
smooth: true,
symbolSize: symbolSize,
data: data
}
]
};
setTimeout(function () {
// Add shadow circles (which is not visible) to enable drag.
myChart.setOption({
graphic: data.map(function (item, dataIndex) {
return {
type: 'circle',
position: myChart.convertToPixel({seriesId: 'a'}, item),
shape: {
cx: 0,
cy: 0,
r: symbolSize / 2
},
invisible: true,
draggable: true,
ondrag: function (dx, dy) {
onPointDragging(dataIndex, [this.x, this.y]);
},
onmousemove: function () {
showTooltip(dataIndex);
},
onmouseout: function () {
hideTooltip(dataIndex);
},
z: 100
};
})
});
}, 0);
window.addEventListener('resize', updatePosition);
function updatePosition() {
myChart.setOption({
graphic: data.map(function (item, dataIndex) {
return {
position: myChart.convertToPixel({seriesId: 'a'}, item)
};
})
});
}
function showTooltip(dataIndex) {
myChart.dispatchAction({
type: 'showTip',
seriesIndex: 0,
dataIndex: dataIndex
});
}
function hideTooltip(dataIndex) {
myChart.dispatchAction({
type: 'hideTip'
});
}
function onPointDragging(dataIndex, pos) {
data[dataIndex] = myChart.convertFromPixel({seriesId: 'a'}, pos);
// Update data
myChart.setOption({
series: [
{
id: 'a',
data: data
}
]
});
updatePosition();
}
宁夏外送能力测算-富裕发电能力测算-区内发电曲线-新能源曲线缺少编辑保存和导出接口