rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Charts Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvChartLayout Class Reference

Base class for chart layout computing. More...

#include <ilviews/charts/layout.h>

List of all members.

Public Member Functions

 IlvChartLayout (IlvInputFile &file)
 Constructor.
 IlvChartLayout (const IlvChartLayout &layout)
 Constructor.
 IlvChartLayout (IlvDim leftMargin=0, IlvDim rightMargin=0, IlvDim topMargin=0, IlvDim bottomMargin=0)
 Constructor.
virtual ~IlvChartLayout ()
 Destructor.
virtual void applyTransform (const IlvTransformer *t)
 Applies a transformation to the layout.
virtual IlvChartLayoutcopy () const
 Virtual copy constructor.
IlvDim getBottomMargin () const
 Returns the bottom margin between the chart bounding box and the drawing area.
const IlvChartGraphicgetChartGraphic () const
 Returns the associated chart graphic.
void getDataDisplayArea (IlvRect &dataDisplayArea, const IlvTransformer *t=0) const
 Returns the data display area.
void getDataDisplayAreaRelatively (IlvPos &leftMargin, IlvPos &rightMargin, IlvPos &topMargin, IlvPos &bottomMargin) const
 Returns the defined margins between the drawing area and the data display area.
virtual IlBoolean getDrawingArea (IlvRect &drawingArea, const IlvTransformer *t=0) const
 Returns the drawing area.
void getGraphArea (IlvRect &graphArea, const IlvTransformer *t=0) const
 Returns the graph area.
void getGraphAreaRelatively (IlvPos &leftMargin, IlvPos &rightMargin, IlvPos &topMargin, IlvPos &bottomMargin) const
 Returns the defined margins between the drawing area and the graph area.
IlvDim getLeftMargin () const
 Returns the left margin between the chart bounding box and the drawing area.
IlvDim getRightMargin () const
 Returns the right margin between the chart bounding box and the drawing area.
IlvDim getTopMargin () const
 Returns the top margin between the chart bounding box and the drawing area.
void invalidate ()
 Specifies that the layout is not valid.
IlBoolean isAutoDataDisplayArea () const
 Indicates whether the data display area is automatically computed.
IlBoolean isAutoGraphArea () const
 Indicates whether the graph area is automatically computed.
IlBoolean isAutoLayout () const
 Indicates whether the graph and data display areas are automatically computed.
IlBoolean isLayoutValid () const
 Indicates whether the layout is valid.
IlvOutputFilesave (IlvOutputFile &file) const
 Writes a complete description of the current object in a file.
void setAutoDataDisplayArea (IlBoolean flag)
 Specifies whether the data display area is automatically computed.
void setAutoGraphArea (IlBoolean flag)
 Specifies whether the graph area is automatically computed.
void setAutoLayout ()
 Specifies that the graph and data display areas are automatically computed.
void setBottomMargin (IlvDim m, IlBoolean updateLayout=IlFalse)
 Sets the bottom margin between the chart bounding box and the drawing area.
void setChartGraphic (IlvChartGraphic *chart)
 Sets the associated chart graphic.
void setDataDisplayArea (const IlvRect &dataDisplayArea, IlBoolean updateLayout=IlFalse)
 Sets the data display area.
void setDataDisplayAreaRelatively (IlvPos leftMargin, IlvPos rightMargin, IlvPos topMargin, IlvPos bottomMargin, IlBoolean updateLayout=IlFalse)
 Sets the data display area relative to the drawing area.
void setGraphArea (const IlvRect &graphArea, IlBoolean updateLayout=IlFalse)
 Sets the graph area.
void setGraphAreaRelatively (IlvPos leftMargin, IlvPos rightMargin, IlvPos topMargin, IlvPos bottomMargin, IlBoolean updateLayout=IlFalse)
 Sets the graph area relative to the drawing area.
void setLeftMargin (IlvDim m, IlBoolean updateLayout=IlFalse)
 Sets the left margin between the chart bounding box and the drawing area.
void setRightMargin (IlvDim m, IlBoolean updateLayout=IlFalse)
 Sets the right margin between the chart bounding box and the drawing area.
void setTopMargin (IlvDim m, IlBoolean updateLayout=IlFalse)
 Sets the top margin between the chart bounding box and the drawing area.
virtual void update ()
 Updates the layout.
virtual void write (IlvOutputFile &file) const
 Writes the attributes of the current object in a file.

Static Public Member Functions

static IlvChartLayoutLoad (IlvInputFile &file)
 Reads a layout object from a file.

Protected Member Functions

virtual void computeDataFromGraphArea ()
 Computes the data display area from the graph area.
virtual void computeGraphAndDataAreas ()
 Computes the graph and data display areas from the drawing area.
virtual void computeGraphFromDataArea ()
 Computes the graph area from the data display area.

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:

img_chart_areas.gif

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

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

Parameters:
file The file used to initialize the current object.
Warning:
[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:
t The transformation that is applied to the layout.
virtual void IlvChartLayout::computeDataFromGraphArea (  )  [protected, virtual]

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 (  )  [protected, virtual]

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 (  )  [protected, virtual]

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

Parameters:
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 IlBoolean IlvChartLayout::getDrawingArea ( IlvRect drawingArea,
const IlvTransformer t = 0 
) const [virtual]

Returns the drawing area.

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

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

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

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:
file The 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:
file The file where the complete object description is written.
void IlvChartLayout::setAutoDataDisplayArea ( IlBoolean  flag  ) 

Specifies whether the data display area is automatically computed.

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

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

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

Parameters:
chart The new chart graphic that is associated with the current object.
Warning:
[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.

Warning:
[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:
dataDisplayArea The new fixed area where the data for the associated chart are displayed.
updateLayout A Boolean indicating whether the layout must be updated immediately.
Warning:
[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.

Warning:
[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.

Warning:
[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:
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.
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:
graphArea The new fixed area containing all the curves and scales for the associated chart.
updateLayout A Boolean indicating whether the layout must be updated immediately.
Warning:
[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.

Warning:
[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:
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.
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:
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.
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:
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.
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:
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 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:
file The file where the attributes of the current object are written.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

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