StackedColumn 图表中的条形图而不是数据点的鼠标悬停预览

发布于 2024-10-15 22:32:58 字数 123 浏览 7 评论 0原文

我有一个 StackedColumn 图表,我想添加鼠标悬停预览。目前,我正在遍历一系列要点以添加执行此操作的功能。

这使得该列中的每个系列都会进行鼠标悬停/鼠标移出。我希望它为该列执行一次鼠标悬停/鼠标移出。建议?

I have a StackedColumn chart which I'd like to add a mouseover preview. Currently I'm looping through the points of a series to add the the functionality to do this.

This makes each series in the column will do a mouseover/mouseout. I'd like it to do a single mouseover/mouseout for the column. Suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谢绝鈎搭 2024-10-22 22:32:58

好吧,这不是一个热门问题。

我偶然发现了CustomizeMapAreas 事件。在那里,我循环遍历 e.MapAreaItems 并调整区域的大小,以便整个列只有一个区域。然后我删除了不再需要的区域。这可能不是最有效的方法,但它就是......

protected void FixStackedColumnAreas(object sender, CustomizeMapAreasEventArgs e)
{
    Dictionary<float, MapArea> newAreas = new Dictionary<float, MapArea>();

    //loop through all areas and collect the Min and Max Y values for each X 
    foreach (MapArea area in e.MapAreaItems)
    {
        if (!newAreas.ContainsKey(area.Coordinates[0]))
        {
            newAreas.Add(area.Coordinates[0], area);
        }
        else
        {
            //get the lowest and highest Y for this X column area
            newAreas[area.Coordinates[0]].Coordinates[1] = Math.Min(newAreas[area.Coordinates[0]].Coordinates[1], area.Coordinates[1]);
            newAreas[area.Coordinates[0]].Coordinates[3] = Math.Max(newAreas[area.Coordinates[0]].Coordinates[3], area.Coordinates[3]);
        }
    }

    //clear out existing areas
    e.MapAreaItems.Clear();

    //put in our new areas that define the whole column area instead of the individual pieces of the column
    foreach (MapArea area in newAreas.Values)
    {
        e.MapAreaItems.Add(area);
    }
}

Ok, not a popular question.

I stumbled across the CustomizeMapAreas event. In there I looped through the e.MapAreaItems and adjusted the size of the areas so that there was just one area for the entire column. Then I removed the areas I didn't need anymore. It's probably not the most efficient way to do it, but here it is...

protected void FixStackedColumnAreas(object sender, CustomizeMapAreasEventArgs e)
{
    Dictionary<float, MapArea> newAreas = new Dictionary<float, MapArea>();

    //loop through all areas and collect the Min and Max Y values for each X 
    foreach (MapArea area in e.MapAreaItems)
    {
        if (!newAreas.ContainsKey(area.Coordinates[0]))
        {
            newAreas.Add(area.Coordinates[0], area);
        }
        else
        {
            //get the lowest and highest Y for this X column area
            newAreas[area.Coordinates[0]].Coordinates[1] = Math.Min(newAreas[area.Coordinates[0]].Coordinates[1], area.Coordinates[1]);
            newAreas[area.Coordinates[0]].Coordinates[3] = Math.Max(newAreas[area.Coordinates[0]].Coordinates[3], area.Coordinates[3]);
        }
    }

    //clear out existing areas
    e.MapAreaItems.Clear();

    //put in our new areas that define the whole column area instead of the individual pieces of the column
    foreach (MapArea area in newAreas.Values)
    {
        e.MapAreaItems.Add(area);
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文