Rogue Wave Views Charts Package API Reference Guide |
Rogue Wave Views Documentation Home |
Base class for chart layout computing. More...
#include <ilviews/charts/layout.h>
Public Member Functions | |
IlvChartLayout (IlvDim leftMargin=0, IlvDim rightMargin=0, IlvDim topMargin=0, IlvDim bottomMargin=0) | |
Constructor. More... | |
IlvChartLayout (const IlvChartLayout &layout) | |
Constructor. More... | |
IlvChartLayout (IlvInputFile &file) | |
Constructor. More... | |
virtual | ~IlvChartLayout () |
Destructor. More... | |
virtual void | applyTransform (const IlvTransformer *t) |
Applies a transformation to the layout. More... | |
virtual IlvChartLayout * | copy () const |
Virtual copy constructor. More... | |
IlvDim | getBottomMargin () const |
Returns the bottom margin between the chart bounding box and the drawing area. More... | |
const IlvChartGraphic * | getChartGraphic () const |
Returns the associated chart graphic. More... | |
void | getDataDisplayArea (IlvRect &dataDisplayArea, const IlvTransformer *t=0) const |
Returns the data display area. More... | |
void | getDataDisplayAreaRelatively (IlvPos &leftMargin, IlvPos &rightMargin, IlvPos &topMargin, IlvPos &bottomMargin) const |
Returns the defined margins between the drawing area and the data display area. More... | |
virtual IlBoolean | getDrawingArea (IlvRect &drawingArea, const IlvTransformer *t=0) const |
Returns the drawing area. More... | |
void | getGraphArea (IlvRect &graphArea, const IlvTransformer *t=0) const |
Returns the graph area. More... | |
void | getGraphAreaRelatively (IlvPos &leftMargin, IlvPos &rightMargin, IlvPos &topMargin, IlvPos &bottomMargin) const |
Returns the defined margins between the drawing area and the graph area. More... | |
IlvDim | getLeftMargin () const |
Returns the left margin between the chart bounding box and the drawing area. More... | |
IlvDim | getRightMargin () const |
Returns the right margin between the chart bounding box and the drawing area. More... | |
IlvDim | getTopMargin () const |
Returns the top margin between the chart bounding box and the drawing area. More... | |
void | invalidate () |
Specifies that the layout is not valid. More... | |
IlBoolean | isAutoDataDisplayArea () const |
Indicates whether the data display area is automatically computed. More... | |
IlBoolean | isAutoGraphArea () const |
Indicates whether the graph area is automatically computed. More... | |
IlBoolean | isAutoLayout () const |
Indicates whether the graph and data display areas are automatically computed. More... | |
IlBoolean | isLayoutValid () const |
Indicates whether the layout is valid. More... | |
IlvOutputFile & | save (IlvOutputFile &file) const |
Writes a complete description of the current object in a file. More... | |
void | setAutoDataDisplayArea (IlBoolean flag) |
Specifies whether the data display area is automatically computed. More... | |
void | setAutoGraphArea (IlBoolean flag) |
Specifies whether the graph area is automatically computed. More... | |
void | setAutoLayout () |
Specifies that the graph and data display areas are automatically computed. More... | |
void | setBottomMargin (IlvDim m, IlBoolean updateLayout=IlFalse) |
Sets the bottom margin between the chart bounding box and the drawing area. More... | |
void | setChartGraphic (IlvChartGraphic *chart) |
Sets the associated chart graphic. More... | |
void | setDataDisplayArea (const IlvRect &dataDisplayArea, IlBoolean updateLayout=IlFalse) |
Sets the data display area. More... | |
void | setDataDisplayAreaRelatively (IlvPos leftMargin, IlvPos rightMargin, IlvPos topMargin, IlvPos bottomMargin, IlBoolean updateLayout=IlFalse) |
Sets the data display area relative to the drawing area. More... | |
void | setGraphArea (const IlvRect &graphArea, IlBoolean updateLayout=IlFalse) |
Sets the graph area. More... | |
void | setGraphAreaRelatively (IlvPos leftMargin, IlvPos rightMargin, IlvPos topMargin, IlvPos bottomMargin, IlBoolean updateLayout=IlFalse) |
Sets the graph area relative to the drawing area. More... | |
void | setLeftMargin (IlvDim m, IlBoolean updateLayout=IlFalse) |
Sets the left margin between the chart bounding box and the drawing area. More... | |
void | setRightMargin (IlvDim m, IlBoolean updateLayout=IlFalse) |
Sets the right margin between the chart bounding box and the drawing area. More... | |
void | setTopMargin (IlvDim m, IlBoolean updateLayout=IlFalse) |
Sets the top margin between the chart bounding box and the drawing area. More... | |
virtual void | update () |
Updates the layout. More... | |
virtual void | write (IlvOutputFile &file) const |
Writes the attributes of the current object in a file. More... | |
Static Public Member Functions | |
static IlvChartLayout * | Load (IlvInputFile &file) |
Reads a layout object from a file. More... | |
Protected Member Functions | |
virtual void | computeDataFromGraphArea () |
Computes the data display area from the graph area. More... | |
virtual void | computeGraphAndDataAreas () |
Computes the graph and data display areas from the drawing area. More... | |
virtual void | computeGraphFromDataArea () |
Computes the graph area from the data display area. More... | |
Base class for chart layout computing.
Library: ilvcharts
This class is responsible for computing the layout of the chart. It computes the position of the following areas within the bounding box of the chart: the drawing area, the graph area, and the data display area. The drawing area is the maximum area where the drawing can be performed for a given chart. The graph area contains all the curves, scales, and labels of the chart. The data display area is the area where the data is displayed: no data points can be displayed outside of this area.
The following figure shows an example of these areas:
In this figure, the bounding box of the chart is the largest rectangle. The drawing area, graph area, and data display area are positioned within the bounding box. For this particular chart, the drawing area and the graph area are equivalent so they appear as the same rectangle (the second largest rectangle in the figure). You can see that the curves and scales are contained within this area. The smallest rectangle is the data display area containing all the data points of the chart.
By default, these three areas are automatically computed from the bounding box of the chart. The drawing area is computed by specifying a margin from the left, right, top, and bottom sides of the bounding box. The graph area and the data display area are then computed from the drawing area so that the graph area takes up the maximum amount of available space. However, the graph area or the data display area can be set by hand, thus allowing them to have a fixed position.
IlvChartGraphic
. IlvChartLayout::IlvChartLayout | ( | IlvDim | leftMargin = 0 , |
IlvDim | rightMargin = 0 , |
||
IlvDim | topMargin = 0 , |
||
IlvDim | bottomMargin = 0 |
||
) |
Constructor.
Initializes a new IlvChartLayout
object. By default, the flags indicating that both the graph area and the data display area are automatically computed are set to IlTrue
.
leftMargin | The left margin between the chart bounding box and the drawing area. |
rightMargin | The right margin between the chart bounding box and the drawing area. |
topMargin | The top margin between the chart bounding box and the drawing area. |
bottomMargin | The bottom margin between the chart bounding box and the drawing area. |
IlvChartLayout::IlvChartLayout | ( | const IlvChartLayout & | layout | ) |
Constructor.
Initializes a new IlvChartLayout
object which is a copy of layout.
layout | The object used to initialize the current object. |
IlvChartLayout::IlvChartLayout | ( | IlvInputFile & | file | ) |
Constructor.
Initializes a new IlvChartLayout
object from the description read in the input file named file.
file | The file used to initialize the current object. |
|
virtual |
Destructor.
The destructor sets the stored pointer to the associated chart to 0
.
|
virtual |
Applies a transformation to the layout.
Applies the transformation t (applied to the chart graphic) to its associated layout.
t | The transformation that is applied to the layout. |
|
protectedvirtual |
Computes the data display area from the graph area.
This method is called inside the IlvChartLayout::update
method when the Boolean indicating that the graph area is automatically computed is set to IlFalse
. This corresponds to the case when the graph area is set by hand.
|
protectedvirtual |
Computes the graph and data display areas from the drawing area.
This method is called inside the IlvChartLayout::update
method when the Boolean indicating that the graph area and data display area are automatically computed are set to IlTrue
.
|
protectedvirtual |
Computes the graph area from the data display area.
This method is called inside the IlvChartLayout::update
method when the Boolean indicating that the data display area is automatically computed is set to IlFalse
. This corresponds to the case when the data display area is set by hand.
|
virtual |
Virtual copy constructor.
Creates and returns a copy of the current object. This method must be overloaded in subclasses. It is automatically declared by the DeclareChartLayoutTypeInfoRO
macro. The IlvPredefinedChartLayoutIOMembers
macro lets you define a default implementation, which returns an instance initialized with the copy constructor.
IlvDim IlvChartLayout::getBottomMargin | ( | ) | const |
Returns the bottom margin between the chart bounding box and the drawing area.
const IlvChartGraphic* IlvChartLayout::getChartGraphic | ( | ) | const |
Returns the associated chart graphic.
void IlvChartLayout::getDataDisplayArea | ( | IlvRect & | dataDisplayArea, |
const IlvTransformer * | t = 0 |
||
) | const |
Returns the data display area.
Returns in dataDisplayArea the current computed area corresponding to the area where the data for the associated chart is displayed.
dataDisplayArea | The data display area. |
t | The transformer that is applied to the returned data display area. |
void IlvChartLayout::getDataDisplayAreaRelatively | ( | IlvPos & | leftMargin, |
IlvPos & | rightMargin, | ||
IlvPos & | topMargin, | ||
IlvPos & | bottomMargin | ||
) | const |
Returns the defined margins between the drawing area and the data display area.
leftMargin | The defined left margin between the drawing area and the data display area. |
rightMargin | The defined right margin between the drawing area and the data display area. |
topMargin | The defined top margin between the drawing area and the data display area. |
bottomMargin | The defined bottom margin between the drawing area and the data display area. |
|
virtual |
Returns the drawing area.
drawingArea | The drawing area. |
t | The transformer that is applied to the returned drawing area. |
void IlvChartLayout::getGraphArea | ( | IlvRect & | graphArea, |
const IlvTransformer * | t = 0 |
||
) | const |
Returns the graph area.
Returns in graphArea the current computed area corresponding to the area that contains all the curves and scales for the associated chart.
graphArea | The graph area. |
t | The transformer that is applied to the returned graph area. |
void IlvChartLayout::getGraphAreaRelatively | ( | IlvPos & | leftMargin, |
IlvPos & | rightMargin, | ||
IlvPos & | topMargin, | ||
IlvPos & | bottomMargin | ||
) | const |
Returns the defined margins between the drawing area and the graph area.
leftMargin | The defined left margin between the drawing area and the graph area. |
rightMargin | The defined right margin between the drawing area and the graph area. |
topMargin | The defined top margin between the drawing area and the graph area. |
bottomMargin | The defined bottom margin between the drawing area and the graph area. |
IlvDim IlvChartLayout::getLeftMargin | ( | ) | const |
Returns the left margin between the chart bounding box and the drawing area.
IlvDim IlvChartLayout::getRightMargin | ( | ) | const |
Returns the right margin between the chart bounding box and the drawing area.
IlvDim IlvChartLayout::getTopMargin | ( | ) | const |
Returns the top margin between the chart bounding box and the drawing area.
void IlvChartLayout::invalidate | ( | ) |
Specifies that the layout is not valid.
Sets the Boolean indicating whether the layout is valid to IlFalse
.
IlBoolean IlvChartLayout::isAutoDataDisplayArea | ( | ) | const |
Indicates whether the data display area is automatically computed.
IlTrue
if the data display area is automatically computed and IlFalse
otherwise. IlBoolean IlvChartLayout::isAutoGraphArea | ( | ) | const |
Indicates whether the graph area is automatically computed.
IlTrue
if the graph area is automatically computed and IlFalse
otherwise. IlBoolean IlvChartLayout::isAutoLayout | ( | ) | const |
Indicates whether the graph and data display areas are automatically computed.
IlTrue
if the graph area and the data display area are automatically computed, and IlFalse
otherwise. IlBoolean IlvChartLayout::isLayoutValid | ( | ) | const |
Indicates whether the layout is valid.
IlTrue
if the layout is valid and IlFalse
if it must be updated.
|
static |
Reads a layout object from a file.
Creates a layout instance from the description stored in the file file. The object description must have been written with the IlvChartLayout::save
method.
file | The file where the object description is stored. |
IlvOutputFile& IlvChartLayout::save | ( | IlvOutputFile & | file | ) | const |
Writes a complete description of the current object in a file.
Writes the complete object description in a file. This description contains all the information necessary to read back this object with the IlvChartLayout::Load
member function. This method first writes information regarding the type of the object and calls the IlvChartLayout::write
method.
file | The file where the complete object description is written. |
void IlvChartLayout::setAutoDataDisplayArea | ( | IlBoolean | flag | ) |
Specifies whether the data display area is automatically computed.
flag | The new value for the Boolean indicating whether the data display area is automatically computed. |
void IlvChartLayout::setAutoGraphArea | ( | IlBoolean | flag | ) |
Specifies whether the graph area is automatically computed.
flag | The new value for the Boolean indicating whether the graph area is automatically computed. |
void IlvChartLayout::setAutoLayout | ( | ) |
Specifies that the graph and data display areas are automatically computed.
Sets the Boolean indicating that the graph area and data display area are automatically computed to IlTrue
.
Sets the bottom margin between the chart bounding box and the drawing area.
If the pointer to the associated chart is defined and updateLayout is equal to IlTrue
, the layout is updated. This means that the different areas that must be updated are recomputed. Otherwise, if updateLayout is equal to IlFalse
, the IlvChartLayout::invalidate
method is simply called to specify that the layout must be updated. The layout will then be recomputed at the time of the drawing.
m | The new bottom margin between the chart bounding box and the drawing area. |
updateLayout | A Boolean indicating whether the layout must be updated immediately. |
void IlvChartLayout::setChartGraphic | ( | IlvChartGraphic * | chart | ) |
Sets the associated chart graphic.
chart | The new chart graphic that is associated with the current object. |
void IlvChartLayout::setDataDisplayArea | ( | const IlvRect & | dataDisplayArea, |
IlBoolean | updateLayout = IlFalse |
||
) |
Sets the data display area.
By default, the drawing area, the graph area, and the data display area are automatically computed from the bounding box of the chart. The drawing area is computed by specifying a margin from the left, right, top, and bottom sides of the bounding box. The graph area and the data display area are then computed from the drawing area so that the graph area takes up the maximum amount of available space. However, if you use this method to set the data display area by hand, the data display area is considered as fixed and will no longer be computed automatically.
If the pointer to the associated chart is defined and updateLayout is equal to IlTrue
, the layout is updated. Only the graph area is recomputed since the data display area is fixed. The computation is performed from the data display area and does not take into account the drawing area.
Otherwise, if updateLayout is equal to IlFalse
, the IlvChartLayout::invalidate()
method is simply called to specify that the layout must be updated. The layout will then be recomputed at the time of the drawing.
dataDisplayArea | The new fixed area where the data for the associated chart are displayed. |
updateLayout | Indicates whether the layout must be updated immediately. |
void IlvChartLayout::setDataDisplayAreaRelatively | ( | IlvPos | leftMargin, |
IlvPos | rightMargin, | ||
IlvPos | topMargin, | ||
IlvPos | bottomMargin, | ||
IlBoolean | updateLayout = IlFalse |
||
) |
Sets the data display area relative to the drawing area.
Sets the area where the data for the associated chart are displayed, by using margins relative to the drawing area. The left, right, top, and bottom margins between the drawing area and the data display area are set to leftMargin, rightMargin, topMargin and bottomMargin, respectively. By default, the drawing area, the graph area, and the data display area are automatically computed from the bounding box of the chart. The drawing area is computed by specifying a margin from the left, right, top, and bottom sides of the bounding box. The graph area and the data display area are then computed from the drawing area so that the graph area takes up the maximum amount of available space. However, if you use this method to set the data display area by hand, the data display area is considered as fixed and will no longer be computed automatically.
If the pointer to the associated chart is defined and updateLayout is equal to IlTrue
, the layout is updated. Only the graph area is recomputed since the data display area is fixed. The computation is performed from the data display area.
Otherwise, if updateLayout is equal to IlFalse
, the IlvChartLayout::invalidate()
method is simply called to specify that the layout must be updated. The layout will then be recomputed at the time of the drawing.
leftMargin | The left margin between the drawing area and the data display area. |
rightMargin | The right margin between the drawing area and the data display area. |
topMargin | The top margin between the drawing area and the data display area. |
bottomMargin | The bottom margin between the drawing area and the data display area. |
updateLayout | A Boolean indicating whether the layout must be updated immediately. |
Sets the graph area.
By default, the drawing area, the graph area, and the data display area are automatically computed from the bounding box of the chart. The drawing area is computed by specifying a margin from the left, right, top, and bottom sides of the bounding box. The graph area and the data display area are then computed from the drawing area so that the graph area takes up the maximum amount of available space. However, if you use this method to set the graph area by hand, the graph area is considered as fixed and will no longer be computed automatically.
If the pointer to the associated chart is defined and updateLayout is equal to IlTrue
, the layout is updated. Only the data display area is recomputed since the graph area is fixed. The computation is performed from the graph area and does not take into account the drawing area.
Otherwise, if updateLayout is equal to IlFalse
, the IlvChartLayout::invalidate()
method is simply called to specify that the layout must be updated. The layout will then be recomputed at the time of the drawing.
graphArea | The new fixed area containing all the curves and scales for the associated chart. |
updateLayout | Indicates whether the layout must be updated immediately. |
void IlvChartLayout::setGraphAreaRelatively | ( | IlvPos | leftMargin, |
IlvPos | rightMargin, | ||
IlvPos | topMargin, | ||
IlvPos | bottomMargin, | ||
IlBoolean | updateLayout = IlFalse |
||
) |
Sets the graph area relative to the drawing area.
Sets the area containing all the curves and scales for the associated chart, by using the margins relative to the drawing area. The left, right, top, and bottom margins between the drawing area and the graph area are set to leftMargin, rightMargin, topMargin, and bottomMargin, respectively.
By default, the drawing area, the graph area, and the data display area are automatically computed from the bounding box of the chart. The drawing area is computed by specifying a margin from the left, right, top, and bottom sides of the bounding box. The graph area and the data display area are then computed from the drawing area so that the graph area takes up the maximum amount of available space. However, if you use this method to set the graph area by hand, the graph area is considered as fixed and will no longer be computed automatically.
If the pointer to the associated chart is defined and updateLayout is equal to IlTrue
, the layout is updated. Only the data display area is recomputed since the graph area is fixed. The computation is performed from the graph area.
Otherwise, if updateLayout is equal to IlFalse
, the IlvChartLayout::invalidate()
method is simply called to specify that the layout must be updated. The layout will then be recomputed at the time of the drawing.
leftMargin | The left margin between the drawing area and the graph area. |
rightMargin | The right margin between the drawing area and the graph area. |
topMargin | The top margin between the drawing area and the graph area. |
bottomMargin | The bottom margin between the drawing area and the graph area. |
updateLayout | A Boolean indicating whether the layout must be updated immediately. |
Sets the left margin between the chart bounding box and the drawing area.
If the pointer to the associated chart is defined and updateLayout is equal to IlTrue
, the layout is updated. This means that the different areas that must be updated are recomputed. Otherwise, if updateLayout is equal to IlFalse
, the IlvChartLayout::invalidate
method is simply called to specify that the layout must be updated. The layout will then be recomputed at the time of the drawing.
m | The new left margin between the chart bounding box and the drawing area. |
updateLayout | A Boolean indicating whether the layout must be updated immediately. |
Sets the right margin between the chart bounding box and the drawing area.
If the pointer to the associated chart is defined and updateLayout is equal to IlTrue
, the layout is updated. This means that the different areas that must be updated are recomputed. Otherwise, if updateLayout is equal to IlFalse
, the IlvChartLayout::invalidate
method is simply called to specify that the layout must be updated. The layout will then be recomputed at the time of the drawing.
m | The new right margin between the chart bounding box and the drawing area. |
updateLayout | A Boolean indicating whether the layout must be updated immediately. |
Sets the top margin between the chart bounding box and the drawing area.
If the pointer to the associated chart is defined and updateLayout is equal to IlTrue
, the layout is updated. This means that the different areas that must be updated are recomputed. Otherwise, if updateLayout is equal to IlFalse
, the IlvChartLayout::invalidate
method is simply called to specify that the layout must be updated. The layout will then be recomputed at the time of the drawing.
m | The new top margin between the chart bounding box and the drawing area. |
updateLayout | A Boolean indicating whether the layout must be updated immediately. |
|
virtual |
Updates the layout.
Updates the layout. This method recomputes the different areas that need to be updated.
|
virtual |
Writes the attributes of the current object in a file.
Called by the IlvChartLayout::save
method. This method can be overloaded in subclasses that define new attributes. The information written by the write
method is read by the IO constructor, which takes an IlvInputFile
as its only argument. Both this method and the IO constructor can be automatically declared by using the DeclareChartLayoutTypeInfo
macro within the class declaration.
file | The file where the attributes of the current object are written. |
© Copyright 2016, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.