The trackball tool allows the user to change the rotation and elevation properties of the currently selected chart. This tool works only in case the currently active chart is operating in 3D mode. In order to use the trackball tool you must create an instance of the NTrackballTool object and add it to the control Tools collection:
C# |
Copy Code
|
---|---|
NThinChartControl1.Controller.Tools.Add(new NTrackballTool()); |
Visual Basic |
Copy Code
|
---|---|
NThinChartControl1.Controller.Tools.Add(new NTrackballTool()) |
Note that the tool requires the control to have an active chart. Check out the Panel Selector Tool for more information on how to set the active chart.
The following code snippet shows how to create a simple rotatable pie chart that displays the current rotation and elevation parameters in a label.
C# |
Copy Code
|
---|---|
public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) // create the first pie chart // apply style sheet // add trackball tool NTrackballTool trackballTool = new NTrackballTool(); } } [Serializable] class TrackballCallback : INTrackballCallback { #region INTrackballCallback Members public void OnTrackball(NThinChartControl control, NChart chart, float oldRotation, float oldElevation) { // update the label control.Labels[0].Text = "Rotation [" + chart.Projection.Rotation.ToString() + "], Elevation [" + chart.Projection.Elevation.ToString() + "]"; } #endregion } } |