Adding a Cursor to a Scale
You can set as many cursors as you want on a given scale. Since a cursor is associated with a scale, the type of the cursor used for a given scale depends on the type of the scale. The type of the scales that can be used for a given chart depends on the type of the projection used in the chart.
The following table lists the type of scale displayers and cursor displayers that can be used for a Cartesian chart, which uses a Cartesian projection.
Chart type | Cartesian |
Projection used | Cartesian |
Scale Displayers Abscissa Coordinates Ordinate Coordinate(s) | Rectangular Rectangular |
Cursor Displayer(s) Abscissa Coordinates Ordinate Coordinate(s) | Rectangular Rectangular |
The following table lists the type of scale displayers and cursor displayers that can be used for a polar chart, which uses a polar projection.
Chart type | Polar |
Projection used | Polar |
Scale Displayers Abscissa Coordinate Ordinate Coordinate(s) | Circular Rectangular |
Cursor Displayers Abscissa Coordinate Ordinate Coordinate(s) | Radial Circular |
Cursors in a Cartesian Chart and in a Polar Chart shows examples of cursors that are set on the scales of two charts. Cursors are set on scales in a Cartesian chart (using a Cartesian projection) and in a polar chart (using a polar projection).
Cursors in a Cartesian Chart and in a Polar Chart
To create and set a cursor associated with a given scale, perform the following steps:
1. Create the object that will display the cursor associated with the scale.
Do one of the following:
Look at the tables at the beginning of this section to determine which cursor can be used with the scale and create the corresponding cursor displayer by hand.
or
Use the
createCursor method of the scale displayer. This method will create the correct cursor displayer to be used with the scale for you.
IlvAbstractChartCursor* cursorDisplayer = scaleDisplayer->createCursor(referenceScaleDisplayer); |
The scale displayer passed as a parameter is the displayer of the scale that must be used as a reference to know where the delimiter of the cursor must stop. If the cursor is associated with the scale representing the abscissa coordinate, the scale displayer that is passed as a parameter is the displayer of a scale representing an ordinate coordinate. If the cursor is associated with a scale representing the ordinate coordinate, the scale displayer that is passed as a parameter is the displayer of the scale representing the abscissa coordinate.
2. Set the data value for which the cursor will be drawn.
cursorDisplayer->setValue(dataValue); |
3. Set the object created to display a cursor on the displayer of the scale with which you want to associate the cursor.
scaleDisplayer->addCursor(cursorDisplayer); |
The Charts Library also provides some methods at the level of a chart object that directly encapsulate the creation and setting of a cursor on a scale of the chart object. The following methods are available:
IlvChartGraphic::addOrdinateCursor to add a cursor on an ordinate scale.
Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.