I'm trying to implement some javascript that will popup an alert showing the x-axis datetime value when the x-axis is clicked.
I have added a new element to the hotspot map that corresponds (approximatly) to the coords of the x-axis and I have an alert that popups telling me whenever I have clicked on the axis, however I don't know how to (a) retrieve the mouse coordinates on the image (not the screen) and (b) how to convert these to a datetime value (e.g. message might say "you clicked at [100, 150] or 01/01/2008 00:00:00").
When drawing the polygon that defines the x-axis I used the following logic:
Code: Select all
Dim ch As Steema.TeeChart.Chart = WebChart1.Chart
Dim rectTop As Integer = ch.Axes.Bottom.Position
Dim rectLeft As Integer = ch.Axes.Bottom.CalcXPosValue(ch.Axes.Bottom.Minimum)
Dim rectHeight As Integer = 10 ' give some room for the user to click below the axis
Dim rectWidth As Integer = ch.Axes.Bottom.CalcXPosValue(ch.Axes.Bottom.Maximum) - ch.Axes.Bottom.CalcXPosValue(ch.Axes.Bottom.Minimum)
mapElements &= "><AREA shape=""Poly"" " & _
"onclick=""axisClick();"" " & _
"coords=""" & _
rectLeft & _
"," & _
rectTop & _
"," & _
rectLeft + rectWidth & _
"," & _
rectTop & _
"," & _
rectLeft + rectWidth & _
"," & _
rectTop + rectHeight & _
"," & _
rectLeft & _
"," & _
rectTop + rectHeight & _
""""
' e.g. <AREA shape="Poly" onclick="axisClick();" coords="53,267,316,267,316,277,53,277">
(I know that you can accomplish this server side using the ClickAxis event but I need to do it client side to avoid a postback).
Thanks,
Norman