Chart\Web Forms\ThinWeb\Server Side Events Tool
Chart\Mvc\ThinWeb\Server Side Events Tool
Diagram\Web Forms\ThinWeb\Server Side Events Tool
Diagram\Mvc\ThinWeb\Server Side Events Tool
The server side events allows you to capture client side mouse events on the server and optionally update the control contents through Ajax. For this purpose you first need to create an instance of the NServerMouseEvent tool and register a callback for the mouse event you want to track. The following code snippets show how to achieve this for the mouse down event and highlight a chart or diagram element dynamically based on the mouse position on the client.
Nevron Chart ThinWeb
C# |
Copy Code
|
---|---|
protected void Page_Load(object sender, EventArgs e) { if (!NThinChartControl1.Initialized) // add bar serires to the chart // add one bar bar.FillStyle = new NColorFillStyle(Color.Blue); NServerMouseEventTool serverMouseEventTool = new NServerMouseEventTool(); serverMouseEventTool.MouseDown = new ChartMouseDownCallback(); NThinChartControl1.Controller.Tools.Add(serverMouseEventTool); } } /// <summary> if (hitTestResult.ChartElement == ChartElement.DataPoint) chartControl.UpdateView(); } #endregion } |
The above snippet will change the bar color to red if the user clicks on the bar and revert to blue if the click is somewhere else in the control.
Nevron Diagram ThinWeb
C# |
Copy Code
|
---|---|
protected void Page_Load(object sender, EventArgs e) { if (!NThinDiagramControl1.Initialized) // add the client mouse event tool NBasicShapesFactory factory = new NBasicShapesFactory(document); NServerMouseEventTool serverMouseEventTool = new NServerMouseEventTool(); NThinDiagramControl1.Controller.Tools.Add(serverMouseEventTool); } } /// <summary> #region INMouseEventCallback Members public void OnMouseEvent(NAspNetThinWebControl control, NBrowserMouseEventArgs e) { if (e.MouseButton == MouseButton.Left) NThinDiagramControl diagramControl = (NThinDiagramControl)control; int length; length = affectedShapes.Count; for (int i = 0; i < length; i++) NShape shape = affectedShapes[i] as NShape; } diagramControl.Update(); } } #endregion } |
Chart\Web Forms\ThinWeb\Server Side Events Tool
Chart\Mvc\ThinWeb\Server Side Events Tool
Diagram\Web Forms\ThinWeb\Server Side Events Tool
Diagram\Mvc\ThinWeb\Server Side Events Tool