The panel selector tool is used to dynamically select the active panel, which then becomes the target of tools that require such panel (like trackball, data zoom, panning etc). In order to create a panel selector tool you need to create an instance of the NPanelSelectorTool class and add it to the control tools collection:
C# |
Copy Code
|
---|---|
NThinChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); |
Visual Basic |
Copy Code
|
---|---|
NThinChartControl1.Controller.Tools.Add(new NPanelSelectorTool()) |
This tool is useful when you have multiple charts in a single control and want to give the user the ability to dynamically switch between them. The following code snippet creates two pie charts that can be rotated with the mouse - note that the code also intercepts the panel selector tool callback and provides some visual feedback of the currently selected chart.
C# |
Copy Code
|
---|---|
protected void Page_Load(object sender, EventArgs e) { if (!NThinChartControl1.Initialized) // get the default chart // create the first pie chart // create the second pie chart // apply style sheet // add panel selector and trackball tools } } private NPieChart CreatePieChart() { NPieChart pieChart = new NPieChart(); } [Serializable] class ActivatePanelCallback : INActivatePanelCallback { #region INActivatePanelCallback Members void INActivatePanelCallback.OnActivatePanel(NThinChartControl control, NContentPanel newActivePanel, NContentPanel oldActivePanel) newActivePanel.BorderStyle = new NStrokeBorderStyle(); control.UpdateView(); #endregion |
In some cases you may want to have only one active panel in the control regardless of whether you have multiple charts or not. In this case you can manually set the currently active panel trough code - for example:
C# |
Copy Code
|
---|---|
NThinChartControl1.Controller.SetActivePanel(NThinChartControl1.Charts[0]); |
Visual Basic |
Copy Code
|
---|---|
NThinChartControl1.Controller.SetActivePanel(NThinChartControl1.Charts(0)) |
The code above sets the active panel to be the first chart in the control charts collection.