Before we describe the drag operations (trackball, zoom, and offset) supported by Xceed Chart for WinForms, we will first take a brief look at the active chart concept, with which you must be familiar when working with multiple charts and drag operations.
As we discussed in the Multiple Charts and Legends topic, Xceed Chart for WinForms can display an unlimited number of charts and legends in the control canvas. Drag operations on the other hand can modify only one chart at a time. This chart is the active chart. By default there is only one chart in the Charts collection, and it is also the active one. You can add a new chart with the following code:
VB.NET | |
---|---|
|
C# | |
---|---|
|
You can instruct the control to apply drag operations to this chart by using the ActiveChart property of the Charts collection. For example, the following code makes the last chart the active one:
VB.NET | |
---|---|
|
C# | |
---|---|
|
After this code is executed, this chart will be the new target for dragging.
It is important to mention that all drag operations are exclusive, which means that they block other interactivity operations if present in the InteractivityOperations collection of the ChartControl. Specifically, they'll block the left mouse-click event and subsequent mouse-move events. This has an impact on the firing of the MouseClick event and the cursor and tooltip operations. This is why it is not recommended to mix drag and other interactivity operations, although this is generally possible. If there is more than one drag operation in the collection, for example a TrackballDragOperation and ZoomDragOperation, the one added first takes priority.
Related Examples
Windows Forms: Interactivity\Drag operations