About PixelPositionToValue
|
Logged in as: Guest
|
|
Users viewing this topic:
none
|
|
Login | |
|
About PixelPositionToValue - 7/2/2007 4:32:17 AM
|
|
|
ashley
Posts: 3
Joined: 6/11/2007
Status: offline
|
I am new to dundas asp.net, It confused me that the return type of function . it always be NAN .See the code below actually it is a sample of dundas about ClickEvent in AJAX the only code added by me is double X = Chart1.ChartAreas[0].AxisX.PixelPositionToValue(e.X); i thought X would return a DOUBLE TYPE number but it was NaN .Can you tell me the reason and if i use dateTime Type for AXIE can PixelPositionToValue work well? public partial class ClickEvent : System.Web.UI.Page { /// <summary> /// Page Load event handler. /// </summary> protected void Page_Load(object sender, System.EventArgs e) { // Hookup to the chart click event. this.Chart1.Click += new ImageClickEventHandler(Chart1_Click); } /// <summary> /// Chart Click event handler. /// </summary> protected void Chart1_Click(object sender, ImageClickEventArgs e) { // Using the coordinates of the Click event determine which // chart element was clicked on. HitTestResult hitTestResult = this.Chart1.HitTest(e.X, e.Y); if (hitTestResult != null) { // Update chart title with the name of the last clicked chart element if (hitTestResult.ChartElementType == ChartElementType.DataPoint) { this.Chart1.Titles["ClickedElement"].Text = "Last Clicked Element: " + hitTestResult.Series.Name + " - Data Point #" + hitTestResult.PointIndex.ToString(); } else { // the code added by me double X = Chart1.ChartAreas[0].AxisX.PixelPositionToValue(e.X); this.Chart1.Titles["ClickedElement"].Text = "Last Clicked Element: " + hitTestResult.ChartElementType.ToString()+ X.ToString(); } } }
|
|
|
|
RE: About PixelPositionToValue - 7/2/2007 10:18:53 PM
|
|
|
ashley
Posts: 3
Joined: 6/11/2007
Status: offline
|
i know must use Chart1.ChartAreas[0].ReCalc() before PixelPositionToValue() thanks
|
|
|
|
RE: About PixelPositionToValue - 7/3/2007 4:13:31 PM
|
|
|
peterd
Posts: 628
Joined: 5/30/2007
Status: offline
|
Hi Ashley, The PixelPositionToValue method converts an absolute pixel position along an axis to an axis value. So it does not matter what data type either axis is. Typically this method will only work in paint events, unless, you call the HitTest() method and ReCalc() method in your event. I believe you answered your own question, but I just wanted to give you a reason why. Sincerely,
_____________________________
Pete --------------------------------------------------------------------- Advanced Data Visualization for Microsoft® Technologies Dundas Software Ltd. Microsoft Gold Partner - Data Management Solutions 500-250 Ferrand Drive • Toronto, ON • M3C
|
|
|
|
RE: About PixelPositionToValue - 7/4/2007 10:50:40 PM
|
|
|
ashley
Posts: 3
Joined: 6/11/2007
Status: offline
|
thanks ,peterd
|
|
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts |
|
|