开发者

Change pointer on mouseover to Hand in Asp.net Chart

开发者 https://www.devze.com 2023-01-12 21:16 出处:网络
i am using Asp.net Chart and showing bar chart. i used dataPoint.MapAreaAttributes to call a JS func(which retrieves the ID) to show next chart on click of a particular bar in the existing chart.

i am using Asp.net Chart and showing bar chart. i used dataPoint.MapAreaAttributes to call a JS func(which retrieves the ID) to show next chart on click of a particular bar in the existing chart. but i am unable show hand pointer on mouse over the particular bar on the chart. And when i use Datapoint.Url which is changing the mouse pointer to hand on mouseover the bar but i am unable to call the JS func. So how to sh开发者_C百科ow Hand pointer on mouseover of a particular bar?


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


This is the solution (in VB.Net):

While creating your chart, iterate programmatically through all series data points, something like this:

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

Regards M.R.


you can change the mousepointer with CSS. apply the CSS on the bars and you'll have what you want

cursor:hand

there are all the options: http://www.echoecho.com/csscursors.htm


The area tag is a bit funny -- cursor:hand and cursor:pointer in css don't work on it. But you can use an href attribute to get the same effect. Figure out the ID of the chart's containing element, then you can just use jquery, when the page is ready, to give the bar chart areas an empty href:

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

精彩评论

暂无评论...
验证码 换一张
取 消