在具有拖放功能的Highcharts中,轴会自动调整,以便您可以拖动到当前范围之外。例如,在下表中,Y轴从2-9开始:
import React from "react";
import { render } from "react-dom";
import Highcharts from "highcharts";
import more from "highcharts/highcharts-more";
import draggable from "highcharts/modules/draggable-points";
import HighchartsReact from "highcharts-react-official";
if (typeof Highcharts === "object") {
more(Highcharts);
draggable(Highcharts);
}
class App extends React.Component {
render() {
return (
<HighchartsReact
highcharts={Highcharts}
constructorType={"chart"}
options={{
tooltip: {
valueDecimals: 2
},
series: [
{
name: "Range",
data: [[0, 3, 8], [1, 3, 8], [2, 3, 8]],
type: "arearange",
dragDrop: {
draggableHigh: true,
draggableLow: true
},
linkedTo: ":previous"
}
]
}}
/>
);
}
}
render(<App />, document.getElementById("root"));
有关实时示例,请参见this demo。
问题是调整速度太快。例如,尝试将点从y = 8
拖动到y = 14
。 Y轴调整非常敏感,以至于我有时间停止拖动之前,该点位于30。当我将点向下拖动时,在相反的方向上也会出现相同的问题。经过几次尝试,我完全无法将点设置为值14。
所以问题是:如何降低自动调整的速度?
((请注意,有dragSensitivity
选项,但在这种情况下不相关。)
您是否尝试将liveRedraw功能设置为false?我认为这将满足您的要求,因为当此选项设置为false时,拖动精度会更好。
演示:dragSensitivity
API:https://codesandbox.io/s/too-sensitive-y-axis-adjustment-with-highcharts-drag-and-drop-7f41g