rwlogo

Rogue Wave Views
Charts Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions
IlvChartLayout Class Reference

Base class for chart layout computing. More...

#include <ilviews/charts/layout.h>

Inherits IlvValueInterface.

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 IlvChartLayoutcopy () const
 Virtual copy constructor. More...
 
IlvDim getBottomMargin () const
 Returns the bottom margin between the chart bounding box and the drawing area. More...
 
const IlvChartGraphicgetChartGraphic () 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...
 
IlvOutputFilesave (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 IlvChartLayoutLoad (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...
 

Detailed Description

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.

See Also
IlvChartGraphic.

Constructor & Destructor Documentation

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.

Parameters
leftMarginThe left margin between the chart bounding box and the drawing area.
rightMarginThe right margin between the chart bounding box and the drawing area.
topMarginThe top margin between the chart bounding box and the drawing area.
bottomMarginThe 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.

Parameters
layoutThe 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.

Parameters
fileThe file used to initialize the current object.
Note
The pointer to the associated chart is not set by this constructor. This pointer is set when the created object is added to the chart.
virtual IlvChartLayout::~IlvChartLayout ( )
virtual

Destructor.

The destructor sets the stored pointer to the associated chart to 0.

Member Function Documentation

virtual void IlvChartLayout::applyTransform ( const IlvTransformer t)
virtual

Applies a transformation to the layout.

Applies the transformation t (applied to the chart graphic) to its associated layout.

Parameters
tThe transformation that is applied to the layout.
virtual void IlvChartLayout::computeDataFromGraphArea ( )
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.

virtual void IlvChartLayout::computeGraphAndDataAreas ( )
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.

virtual void IlvChartLayout::computeGraphFromDataArea ( )
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 IlvChartLayout* IlvChartLayout::copy ( ) const
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.

Returns
A copy of the current object.
IlvDim IlvChartLayout::getBottomMargin ( ) const

Returns the bottom margin between the chart bounding box and the drawing area.

Returns
The bottom margin between the chart bounding box and the drawing area.
const IlvChartGraphic* IlvChartLayout::getChartGraphic ( ) const

Returns the associated chart graphic.

Returns
The chart graphic associated with the current object.
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.

Parameters
dataDisplayAreaThe data display area.
tThe 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.

Parameters
leftMarginThe defined left margin between the drawing area and the data display area.
rightMarginThe defined right margin between the drawing area and the data display area.
topMarginThe defined top margin between the drawing area and the data display area.
bottomMarginThe defined bottom margin between the drawing area and the data display area.
virtual IlBoolean IlvChartLayout::getDrawingArea ( IlvRect drawingArea,
const IlvTransformer t = 0 
) const
virtual

Returns the drawing area.

Parameters
drawingAreaThe drawing area.
tThe 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.

Parameters
graphAreaThe graph area.
tThe 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.

Parameters
leftMarginThe defined left margin between the drawing area and the graph area.
rightMarginThe defined right margin between the drawing area and the graph area.
topMarginThe defined top margin between the drawing area and the graph area.
bottomMarginThe 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.

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.

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.

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.

Returns
IlTrue if the data display area is automatically computed and IlFalse otherwise.
IlBoolean IlvChartLayout::isAutoGraphArea ( ) const

Indicates whether the graph area is automatically computed.

Returns
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.

Returns
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.

Returns
IlTrue if the layout is valid and IlFalse if it must be updated.
static IlvChartLayout* IlvChartLayout::Load ( IlvInputFile file)
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.

Parameters
fileThe file where the object description is stored.
Returns
A pointer to the created object.
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.

Parameters
fileThe file where the complete object description is written.
void IlvChartLayout::setAutoDataDisplayArea ( IlBoolean  flag)

Specifies whether the data display area is automatically computed.

Parameters
flagThe 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.

Parameters
flagThe 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.

void IlvChartLayout::setBottomMargin ( IlvDim  m,
IlBoolean  updateLayout = IlFalse 
)

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.

Parameters
mThe new bottom margin between the chart bounding box and the drawing area.
updateLayoutA Boolean indicating whether the layout must be updated immediately.
void IlvChartLayout::setChartGraphic ( IlvChartGraphic chart)

Sets the associated chart graphic.

Parameters
chartThe new chart graphic that is associated with the current object.
Note
This method should not be used directly by the user.
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.

Note
Be careful. If the specified data display area is not small enough, the computed graph area can be larger than 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.

Parameters
dataDisplayAreaThe new fixed area where the data for the associated chart are displayed.
updateLayoutIndicates whether the layout must be updated immediately.
Note
The specified data display area must be expressed in the same coordinate system as the bounding box of the associated chart.
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.

Note
If the drawing area is modified (for example, by changing the layout margins), the data display area will be updated since it is defined by using margins relative to the drawing area.

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.

Note
Be careful. If the specified data display area is not small enough, the computed graph area can be larger than 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.

Parameters
leftMarginThe left margin between the drawing area and the data display area.
rightMarginThe right margin between the drawing area and the data display area.
topMarginThe top margin between the drawing area and the data display area.
bottomMarginThe bottom margin between the drawing area and the data display area.
updateLayoutA Boolean indicating whether the layout must be updated immediately.
void IlvChartLayout::setGraphArea ( const IlvRect graphArea,
IlBoolean  updateLayout = IlFalse 
)

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.

Parameters
graphAreaThe new fixed area containing all the curves and scales for the associated chart.
updateLayoutIndicates whether the layout must be updated immediately.
Note
The specified graph area must be expressed in the same coordinate system as the bounding box of the associated chart.
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.

Note
If the drawing area is modified (for example, by changing the layout margins), the graph area will be updated since it is defined by using the margins relative to the drawing area.

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.

Parameters
leftMarginThe left margin between the drawing area and the graph area.
rightMarginThe right margin between the drawing area and the graph area.
topMarginThe top margin between the drawing area and the graph area.
bottomMarginThe bottom margin between the drawing area and the graph area.
updateLayoutA Boolean indicating whether the layout must be updated immediately.
void IlvChartLayout::setLeftMargin ( IlvDim  m,
IlBoolean  updateLayout = IlFalse 
)

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.

Parameters
mThe new left margin between the chart bounding box and the drawing area.
updateLayoutA Boolean indicating whether the layout must be updated immediately.
void IlvChartLayout::setRightMargin ( IlvDim  m,
IlBoolean  updateLayout = IlFalse 
)

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.

Parameters
mThe new right margin between the chart bounding box and the drawing area.
updateLayoutA Boolean indicating whether the layout must be updated immediately.
void IlvChartLayout::setTopMargin ( IlvDim  m,
IlBoolean  updateLayout = IlFalse 
)

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.

Parameters
mThe new top margin between the chart bounding box and the drawing area.
updateLayoutA Boolean indicating whether the layout must be updated immediately.
virtual void IlvChartLayout::update ( )
virtual

Updates the layout.

Updates the layout. This method recomputes the different areas that need to be updated.

virtual void IlvChartLayout::write ( IlvOutputFile file) const
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.

Parameters
fileThe file where the attributes of the current object are written.

© Copyright 2015, 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.