将鼠标悬停时的指针更改为Hand在Asp.net图表中

时间:2010-08-23 06:01:58

标签: asp.net asp.net-charts

我正在使用Asp.net图表并显示条形图。 我使用dataPoint.MapAreaAttributes来调用JS func(它检索ID),以便在点击现有图表中的特定条形图时显示下一个图表。 但我无法在图表上的特定条上显示鼠标指针。 当我使用Datapoint.Url,它将鼠标指针改为手动鼠标悬停在栏上但我无法调用JS函数。 那么如何在特定栏的鼠标悬停上显示Hand指针?

4 个答案:

答案 0 :(得分:3)

<asp:Image ID="Image1" runat="server" onmouseover="this.style.cursor='hand'" onmouseout="this.style.cursor='default'" />

答案 1 :(得分:1)

这是解决方案(在VB.Net中):

在创建图表时,以编程方式迭代所有系列数据点,如下所示:

While ...
   Dim oPoint as DataPoint = objSeries.Points(n)

   'add code for OnMouseMove and OnMouseOut events

   oPoint.MapAreaAttributes = "OnMouseOver=""document.body.style.cursor = 'pointer';"""

   oPoint.MapAreaAttributes = oPoint.MapAreaAttributes &  "OnMouseOut=""document.body.style.cursor = 'default';"""

End While

此致 M.R。

答案 2 :(得分:0)

您可以使用CSS更改鼠标指针。在条形图上应用CSS,你就会得到你想要的东西

cursor:hand

有以下所有选项:http://www.echoecho.com/csscursors.htm

答案 3 :(得分:0)

区域标签有点滑稽 - 光标:手和光标:css中的指针不起作用。但是您可以使用href属性来获得相同的效果。弄清楚图表包含元素的ID,然后你可以在页面准备就绪时使用jquery给条形图区域一个空的href:

$(document).ready(function () {
  $('#YourChartElementID area[shape="rect"]').attr('href', 'javascript:void(0)');
)};
相关问题