0

I have been working with charts in the Asp.Net framework and I found a nifty Interactivity I could add to the chart for each 'bar' of data in a bar chart. However no matter how I try to implement this from the msdn website found here at Interactivity in Windowms Forms, I keep getting multiple errors with:

this.Chart1.MouseMove += new   System.Windows.Forms.MouseEventHandler(this.Chart1_MouseMove);

as well as with

System.Windows.Forms.MouseEventArgs e

What this is supposed to do is whenever you highlight over a bar in the bar chart the event should fire and change a few effects such as changing the color.

The link above will redirect you to the code however It it also here:

this.Chart1.MouseMove += new      System.Windows.Forms.MouseEventHandler(this.Chart1_MouseMove);

private void Chart1_MouseMove(object sender,   System.Windows.Forms.MouseEventArgs e)
{

   HitTestResult result = Chart1.HitTest( e.X, e.Y );

   // Reset Data Point Attributes
   foreach( DataPoint point in Chart1.Series[0].Points )
   {
       point.BackSecondaryColor = Color.Black;
       point.BackHatchStyle = ChartHatchStyle.None;
       point.BorderWidth = 1;
   }

   // If the mouse if over a data point
   if(result.ChartElementType == ChartElementType.DataPoint)
   {
       // Find selected data point
      DataPoint point = Chart1.Series[0].Points[result.PointIndex];

      // Change the appearance of the data point
      point.BackSecondaryColor = Color.White;
      point.BackHatchStyle = ChartHatchStyle.Percent25;
      point.BorderWidth = 2;
   }
   else
   {
       // Set default cursor
      this.Cursor = Cursors.Default;
   }
}

The errors that show up are:

  • Default (page) does not containe a definition for cursor and no extension... (Nothing to import shown by intellisense)
  • Chart does not have a definition for MouseMove
  • MouseEventHandler could not be found

I cannot find any information anywhere else on how to accomplish and or get this Microsoft event to work.

halfer
  • 19,824
  • 17
  • 99
  • 186
L1ghtk3ira
  • 3,021
  • 6
  • 31
  • 70

1 Answers1

0

The answer unfortionalty lies in your question:

I have been working with charts in the Asp.Net framework...

msdn website found here at Interactivity in Windowms Forms...

Windows Forms is not the same as ASP.net framework. The linked page is divided into 2 sections asp.net- and winForms chart interactivity.

Look at eh asp.net section and perhaps you can find some answer there

Community
  • 1
  • 1
user3532232
  • 257
  • 8
  • 19