Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

ScatterGraph WebControl cursor problem

I have a webpage containing a ScatterGraph, and I've used one of your previous examples from the discussion board enabling the user to click on any point in the graph and using a cursor, return the X and Y coordinates of the nearest point.  An image of my graphing section of the webpage can be found here:
 
 
 
And here is the code behind the PlotAreaClick event:
 
private void InverseMap(System.Drawing.Rectangle plotAreaBounds, int x, int y, XAxis xAxis, YAxis yAxis, out double xValue, out double yValue)
{
     xValue = ((xAxis.Range.Maximum - xAxis.Range.Minimum) *
     ((x - plotAreaBounds.Left) / (double)(plotAreaBounds.Right - plotAreaBounds.Left))) + xAxis.Range.Minimum;
    
     yValue = ((yAxis.Range.Maximum - yAxis.Range.Minimum) *
     ((plotAreaBounds.Bottom - y) / (double)(plotAreaBounds.Bottom - plotAreaBounds.Top))) + yAxis.Range.Minimum;
}
 
protected void ScatterGraph1_PlotAreaClick(object sender, ClickEventArgs e)
{
     double xValue, yValue;
     XAxis xAxis1;
     YAxis yAxis1;
     DateTime ClickDate;
 
     ScatterGraph1.Cursors[0].LabelXFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.DateTime, "M/d/yy h:mm:ss tt");
     ScatterGraph1.Cursors[0].LabelYFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.Numeric, "F1");
     ScatterGraph1.Cursors[0].LabelVisible = false;
     ScatterGraph1.Cursors[0].Visible = true;
 
     xAxis1 = ScatterGraph1.XAxes[0];
     yAxis1 = ScatterGraph1.YAxes[0];
     InverseMap(ScatterGraph1.PlotAreaBounds, e.X, e.Y, xAxis1, yAxis1, out xValue, out yValue);
     ScatterGraph1.Cursors[0].MoveCursor(xValue, yValue);
 
     ClickDate = (DateTime)DataConverter.Convert(ScatterGraph1.Cursors[0].XPosition, typeof(DateTime));
     lblClickDate.Text = ClickDate.ToString("M/d/yyyy");
     lblClickTime.Text = ClickDate.ToString("h:mm:ss tt");
     lblReading.Text = ScatterGraph1.Cursors[0].YPosition.ToString("0.0");
}
 
I notice that in Mozilla Firefox, the cursor works correctly and will move to the correct point.  However, in Internet Explorer, the cursor doesn't move when the page is refreshed.  I know that the MoveCursor method works correctly, because even in IE, the labels lblClickData, lblClickTime, and lblReading all update correctly when the graph is clicked; however, the cursor stays in the same place.
 
Any suggestions?
 
Justin
0 Kudos
Message 1 of 4
(3,417 Views)
Hi Justin,

Would you mind posting your project for me? I want to see if I can see the same behavior and help figure out what is going on. Also, what version of Visual Studio, Measurement Studio and Internet Explorer are you using?

Brandon Vasquez | Software Engineer | Integration Services | National Instruments
0 Kudos
Message 2 of 4
(3,391 Views)
Hi Justin,

I tested out your code in both FireFox (2.0.0.4) and Internet Explorer (7) and my cursor always moved to the location that I clicked at. Browsers shouldn't have any effect on your web application since the server just spits back HTML. Things to do:

- See if you can run the attached example that I used
- Did you change your application any before testing in Internet Explorer?
- Are you running your application on your target machine (probably using IIS) or from Visual Studio (which creates a temporary server)?

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 3 of 4
(3,383 Views)
I was running my application out of Visual Studio (temporary server).  I got much better behavior once I copied the application over to my target machine. 
 
I've since added the AutoRefresh control to my page in order to keep my graph updating continuously, and the cursor still seems to be working well.
 
Thanks for all of your help.
 
Justin
0 Kudos
Message 4 of 4
(3,378 Views)