gpt4 book ai didi

Highcharts:取消选择系列中的所有点

转载 作者:行者123 更新时间:2023-12-01 12:27:00 25 4
gpt4 key购买 nike

好的,所以我有一个选择所需点的选择事件。我遇到的问题是它只是添加到先前选择的点上。我很好奇是否有一种简单的方法可以通过函数/库调用取消选择所有点,而无需创建迭代所有点的自定义函数?

更新:这就是我选择点的方式。它在选择事件中执行。

for (var i = 0; i < this.series.length; i++)    //Iterate through all the series on the chart
{
if(this.series[i].selected) //If the series is selected in the legend
{
var points = this.series[i].points; //Retrieve all points within this certain series that are visible
var xs = event.xAxis[0]; //Get the xAxis size
$.each(points, function (i,p) { //For all the points visible in the series
if (p.x >= xs.min && p.x <= xs.max) { //Boundary check the selected points
p.select(true, true); //Set the selected points to selected
}
});
}
}

最佳答案

这是我的问题的解决方案。我在 if 中添加了一个 else 语句,取消选择了不在所选范围内的任何点。我计划将 else 变成 else if(未按下 ctrl 键)以获得更好的功能。

for (var i = 0; i < this.series.length; i++)    //Iterate through all the series on the chart
{
if(this.series[i].selected) //If the series is selected in the legend
{
var points = this.series[i].points; //Retrieve all points within this certain series that are visible
var xs = event.xAxis[0]; //Get the xAxis size
$.each(points, function (i,p) { //For all the points visible in the series
if (p.x >= xs.min && p.x <= xs.max) { //Boundary check the selected points
p.select(true, true); //Set the selected points to selected
}
else
p.select(false, true); //Set points outside of boundary to deselected
});
}
}

关于Highcharts:取消选择系列中的所有点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23550360/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com