Download QCChart2D User Manual - Quinn

Transcript
14. Moving Chart Objects, Data Points and Coordinate
Systems
MoveObj
MoveData
MoveCoordinates
Many of the subclasses of GraphObj are moveable using the mouse. This includes the
axis, legend, text, image, shape classes. If you add the necessary support to your program,
you can click and drag the object around in the chart. This may or not be desirable, since
a user can ruin a carefully constructed chart by dragging objects around. It is just an
option though, that you can add to the program.
It is also possible to select a single data point in a simple plot object (SimpleLinePlot,
SimpleBarPlot, SimpleLineMarkerPlot and SimpleScatterPlot) and move it with a
click and drag operation of the mouse. Again, it is an option that you can add to the
program if you want.
Starting in Revision 2.0 we have added the capability of moving the coordinates system
of a graph, using the MoveCoordinates class. The move operation is analogous to the
way you can change the latitude and longitude of an internet map by clicking and
dragging it.
Moving Chart Objects
Class MoveObj
MouseListener
|
+--MoveObj
The MoveObj mouse listener traps a mouse pressed event and then searches through all
of the GraphObj derived objects in the view. A rectangle highlights the first object that
meets the filter criteria and intersects the mouse cursor. Hold the mouse button down and
the rectangle tracks the mouse. Release the mouse button and the position of the graph
object updates to reflect the new physical coordinates of the bounding rectangle.
If no objectfilter parameter is specified, the default object filter is “GraphObj”.
MoveObject constructors