0

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 show Hand pointer on mouseover of a particular bar?

Yajuvendra Vant
  • 1,127
  • 4
  • 15
  • 33

4 Answers4

3

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

Josh Lee
  • 171,072
  • 38
  • 269
  • 275
Rajesh
  • 115
  • 2
  • 10
  • The value 'hand' did not work for me (don't really know why). I use the value 'pointer' which also displays a hand-cursor. – Brabbeldas May 13 '15 at 14:36
1

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.

0

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

Stefanvds
  • 5,868
  • 5
  • 48
  • 72
  • Thanks for quick reply. but where to place the class, in the series there is no cssclass property. when i placed css for the chart, the whole chart hand is implemented. – Yajuvendra Vant Aug 23 '10 at 06:18
  • do you have an example how the HTML code looks for such a chart because i have no idea how it looks. what you could do is style the CSS hand with jquery selector. but that's not the best option – Stefanvds Aug 23 '10 at 06:19
  • I have 2 Series, on mouseover of one series in the bar i need to show hand. when i assign css-xlink in – Yajuvendra Vant Aug 23 '10 at 06:27
  • what is the html for the whole page? can you update your question with that? – Stefanvds Aug 23 '10 at 06:37
  • i ment the HTML you get in the browser :) and edit your question so the html will be styled. – Stefanvds Aug 23 '10 at 08:08
  • i got it. i just added href to my code and it worked. dataPoint.MapAreaAttributes = String.Format("onclick=""showClass({0})"" href=""#""""alt=""Show Report""", classid) Thanks for the support. – Yajuvendra Vant Aug 23 '10 at 08:27
0

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)');
)};
user941238
  • 640
  • 1
  • 8
  • 19