Nevron .NET Vision Documentation
Porting from Q4 2007 to Q1 2008

Mouse Events

The following properties of the NChartControl object were removed:

 

NChartControl.AsyncClickEventEnabled

NChartControl.AsyncDoubleClickEventEnabled

NChartControl.AsyncMouseMoveEventEnabled

NChartControl.AsyncMouseUpEventEnabled

NChartControl.AsyncMouseDownEventEnabled

 

The following properties and events of the NChartControl object were added instead:

 

NChartControl.AjaxTools

NChartControl.QueryAjaxTools

 

The former mouse event handling and routing mechanism was replaced by a client side controller architecture. Pairs of client side tool class and server side tool definition class were added for all types of mouse events. To enable a callback mouse event, the corresponding tool definition must be added to the chart control’s AjaxToolscollection property. Tools must be added to the AjaxToolscollection from a handler of the new QueryAjaxTools event. Adding tools from another code point will produce unpredictable results. Here is an example on how to enable the mouse click callback event:

C#
Copy Code
protected void nChartControl1_QueryAjaxTools(object sender, EventArgs e)
{
      nChartControl1.AjaxTools.Add(new NAjaxMouseClickCallbackTool(true));
}
Visual Basic
Copy Code
Type your example code here. It will be automatically colorized when you switch to Preview or build the help system.

If no interactive areas are defined, the click callback tool, as initialized above, will cause mouse clicks to be processed for the whole chart image. To define interactive areas of the control, add interactivity styles to the chart elements in your Form_Load page method, like this:

C#
Copy Code
mySeries.InteractivityStyles.Add(i, new NInteractivityStyle(true));
Visual Basic
Copy Code
mySeries.InteractivityStyles.Add(i, New NInteractivityStyle(True))

To optimize the mouse move event handling the new AsyncMouseOverand AsyncMouseOut events can be used instead of the AsyncMouseMove event. For more details, see the documentation on NInteractivityStyle and the web examples that are installed on your machine. 

Custom Painting

The AfterPaint and BeforePaint events of the NPanel class were replaced by the PaintCallback property. To provide custom code to be excluded before or after the panel is painted, implement the INPaintCallbackinterface and initialize the PaintCallbackproperty of the panel with an instance of the INPaintCallbackimplementation. Here is the sample of the old way to achieve custom painting:

C#
Copy Code
...
NChart chart = chartControl.Charts[0];
chart.AfterPaint += new EventHandler(this.OnChartAfterPaint);

...

protected void OnChartAfterPaint(object sender, System.EventArgs e)
{
    // do something in after paint
}
Visual Basic
Copy Code
...
Dim chart As NChart = chartControl.Charts(0)
AddHandler chart.AfterPaint, AddressOf Me.OnChartAfterPaint

...

Protected Sub OnChartAfterPaint(ByVal sender As System.Object, ByVal e As System.EventArgs)
    ' do something in after paint
End Sub

And here is a sample code how your code must look now:

C#
Copy Code
... 
NChart chart = chartControl.Charts[0]; 
chart.PaintCallback = new CustomPaintCallback(); 
... 

public class CustomPaintCallback : INPaintCallback 
{
    ...

    public void OnAfterPaint(NPanel panel, NPanelPaintEventArgs eventArgs)
    {
        // do something in after paint 
    }
}
Visual Basic
Copy Code
... 
Dim chart As NChart = chartControl.Charts(0)
chart.PaintCallback = New CustomPaintCallback()
... 

Public Class CustomPaintCallback 
    Implements INPaintCallback 
    ...

    Public Sub OnAfterPaint(ByVal panel As NPanel, ByVal eventArgs As NPanelPaintEventArgs ) Handles INPaintCallBack.OnAfterPaint
        ' do something in after paint 
    End Sub
End Class

 

 


©2017. Nevron Software LLC.

Send Feedback