Views
Charts Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions | Protected Member Functions
IlvStackedChartDisplayer Class Reference

Base class for stacked data displayers. More...

#include <ilviews/charts/stacked.h>

Inheritance diagram for IlvStackedChartDisplayer:
IlvCompositeChartDisplayer IlvAbstractChartDisplayer IlvValueInterface IlvStacked3dBarChartDisplayer IlvStackedBarChartDisplayer IlvStackedPolygonChartDisplayer

Public Member Functions

 IlvStackedChartDisplayer (IlBoolean stacked100PerCent=IlFalse)
 Constructor. More...
 
 IlvStackedChartDisplayer (IlvAbstractChartDisplayer *model, IlUInt count, IlvPalette *const *palettes=0, IlBoolean stacked100PerCent=IlFalse)
 Constructor. More...
 
 IlvStackedChartDisplayer (IlvChartDisplayerFactory *factory, IlUInt count, IlvPalette *const *palettes=0, IlBoolean stacked100PerCent=IlFalse)
 Constructor. More...
 
virtual void draw (IlvPort *dst, const IlvTransformer *t, const IlvRegion *clip) const
 Draws the child displayers. More...
 
virtual IlvAbstractChartDisplayergetDisplayerForDataSet (const IlvChartDataSet *dataSet) const
 Returns the child displayer used to display a given data set. More...
 
virtual IlvCombinedChartDataSetgetVirtualDataSet (const IlvChartDataSet *dataSet, IlUInt &index) const
 Returns a virtual data set used by the current displayer. More...
 
IlBoolean isStacked100PerCent () const
 Indicates whether the data are stacked with the total amount equal to 100%. More...
 
void setStacked100PerCent (IlBoolean b)
 Specifies whether the data are stacked with the total amount equal to 100%. More...
 
virtual IlBoolean useVirtualDataSets () const
 Indicates whether the current displayer uses virtual data sets. More...
 
- Public Member Functions inherited from IlvCompositeChartDisplayer
virtual ~IlvCompositeChartDisplayer ()
 Destructor. More...
 
void addDisplayer (IlvAbstractChartDisplayer *displayer, IlUInt position=IlvLastPositionIndex)
 Adds a displayer to the current displayer. More...
 
virtual IlBoolean boundingBox (IlvRect &bbox, const IlvTransformer *t=0) const
 Returns the bounding box of the graphical representation of data. More...
 
virtual IlBoolean dataPointBBox (IlUInt dataPtIdx, IlvRect &bbox, IlBoolean takeInfoIntoAccount, const IlvTransformer *t=0) const
 Returns the bounding box of the graphical representation of the data points at a given index. More...
 
virtual void drawDataPoint (IlUInt dataPtIdx, IlvPort *dst, const IlvTransformer *t=0, const IlvRegion *clip=0) const
 Draws the graphical representation of the data point(s) at a given index. More...
 
virtual void drawDataPoints (IlUInt iMin, IlUInt iMax, IlvPort *dst, const IlvTransformer *t=0, const IlvRegion *clip=0) const
 Draws the graphical representation of the data points between a given interval. More...
 
virtual void drawFill (IlBoolean b)
 Sets the filling mode of the displayer. More...
 
virtual void drawLegendItem (IlvPort *dst, const IlvRect &legendArea, IlvPalette *itemPal, const IlvRegion *clip, IlAny clientData=0) const
 Draws the graphic part of a legend item associated with the current displayer. More...
 
virtual IlvColorgetBackground (IlUInt index=0) const
 Returns the background color of a palette used by the current displayer to display data. More...
 
virtual void getClipArea (IlvRect &area, const IlvTransformer *t) const
 Returns the clipping region that is used for the drawing. More...
 
IlvAbstractChartDisplayergetDisplayer (IlUInt index) const
 Returns one of the displayers that compose the current displayer. More...
 
IlvChartDisplayerFactorygetDisplayerFactory () const
 Returns the displayer factory that has been set on the current displayer. More...
 
IlvAbstractChartDisplayergetDisplayerModel () const
 Returns the model that is used for child displayers. More...
 
virtual IlUInt getDisplayersCount () const
 Returns the number of displayers. More...
 
virtual IlUInt getDisplayItem (IlvChartDataSet *&dataSet, const IlvPoint &viewPoint, const IlvTransformer *t) const
 Returns the item to which a view point corresponds. More...
 
virtual IlBoolean getDisplayPoint (const IlvChartDataSet *dataSet, IlUInt dataPtIdx, IlvPoint &point, const IlvTransformer *t=0) const
 Returns the corresponding screen point for a data point. More...
 
virtual IlvColorgetForeground (IlUInt index=0) const
 Returns the foreground color of a palette used by the current displayer to display data. More...
 
virtual const char * getInternalLegendText (IlUInt index=0) const
 Returns the legend text stored in the current displayer. More...
 
virtual const char * getLegendText (IlUInt index=0) const
 Returns the text that will be used in a legend for the current displayer. More...
 
virtual IlUInt getNearestPoint (IlvChartDataSet *&dataSet, const IlvPoint &viewPoint, IlvDim distance, IlvPoint &point, const IlvTransformer *t=0) const
 Returns the nearest data point. More...
 
virtual IlvPalettegetPalette (IlUInt index=0) const
 Returns a palette used by the current displayer to display data. More...
 
virtual IlvPointInfoCollectiongetPointInfoCollection (const IlvChartDataSet *dataSet) const
 Returns the point information collection defined to be used to display a given data set. More...
 
virtual IlBoolean graphicalRepresentationByDataPoint () const
 Indicates whether there is a graphical representation by data point. More...
 
virtual IlBoolean isContinuous () const
 Indicates whether the graphical representation is continuous. More...
 
virtual IlBoolean isFilled () const
 Indicates whether the graphical representation is filled. More...
 
virtual IlBoolean isViewable () const
 Indicates whether the graphical representation can be viewed. More...
 
IlvAbstractChartDisplayerremoveDisplayer (IlUInt index)
 Removes one of the displayers that compose the current displayer. More...
 
virtual void setBackground (IlvColor *color, IlUInt index=0)
 Sets the background color of a palette used by the current displayer to display data. More...
 
virtual void setChartGraphic (IlvChartGraphic *chart)
 Sets the chart graphic which uses the current displayer. More...
 
virtual IlBoolean setDataPoint (IlvChartDataSet *dataSet, IlUInt dataPtIdx, const IlvPoint &point, const IlvTransformer *t=0) const
 Sets the corresponding data point from a screen point. More...
 
IlvChartDisplayerFactorysetDisplayerFactory (IlvChartDisplayerFactory *factory, IlBoolean reCreate=IlFalse)
 Sets the displayer factory that will be used by the current displayer. More...
 
IlvAbstractChartDisplayersetDisplayerModel (IlvAbstractChartDisplayer *model)
 Sets the model that will be used when creating child displayers. More...
 
virtual void setForeground (IlvColor *color, IlUInt index=0)
 Sets the foreground color of a palette used by the current displayer to display data. More...
 
virtual void setLegendItems (IlvChartLegend *legend) const
 Sets the legend items associated with the current displayer. More...
 
virtual void setLegendText (const char *text, IlUInt index=0)
 Sets the text that will be used in a legend for the current displayer. More...
 
virtual void setMode (IlvDrawMode mode)
 Sets the drawing mode. More...
 
virtual void setOrdinateInfo (IlvCoordinateInfo *ordinateInfo)
 Sets the coordinate information associated with the ordinate scale considered to display data. More...
 
virtual void setOverwrite (IlBoolean o)
 Sets the overwrite mode. More...
 
virtual void setPalette (IlvPalette *pal, IlUInt index=0)
 Sets a palette used by the current displayer to display data. More...
 
virtual void setPointInfoCollection (const IlvChartDataSet *dataSet, IlvPointInfoCollection *ptInfoCollection)
 Sets the point information collection that will be used to display a given data set. More...
 
virtual void write (IlvOutputFile &file) const
 Writes the attributes of the current object in a file. More...
 
- Public Member Functions inherited from IlvAbstractChartDisplayer
virtual ~IlvAbstractChartDisplayer ()
 Destructor. More...
 
void addDataSet (IlvChartDataSet *dataSet)
 Adds a real data set to be displayed by the current displayer. More...
 
virtual IlBoolean canBeProjectedIfOutOfBounds () const
 Indicates whether the graphical representation can be projected when it is out-of-bounds. More...
 
virtual IlvAbstractChartDisplayercopy () const =0
 Virtual copy constructor. More...
 
IlBoolean dataPointToDisplay (const IlvDoublePoint &dataPoint, IlvPoint &point, const IlvTransformer *t=0) const
 Projects a data point into screen coordinates. More...
 
virtual IlBoolean displayDataSet (const IlvChartDataSet *dataSet) const
 Indicates whether the current displayer displays a data set. More...
 
IlBoolean displayToDataPoint (const IlvPoint &point, IlvDoublePoint &dataPoint, const IlvTransformer *t=0) const
 Inversely projects a screen point to retrieve the corresponding data point. More...
 
IlvChartGraphicgetChartGraphic () const
 Returns the chart graphic which uses the current displayer. More...
 
IlvChartDataSetgetDataSet (IlUInt index=0) const
 Returns a data set used by the current displayer. More...
 
IlUInt getDataSetsCount () const
 Returns the number of data sets used by the current displayer. More...
 
IlUInt getMaxDataSetsCount () const
 Returns the maximum number of real data sets that the current displayer is allowed to display. More...
 
const char * getName () const
 Returns the name of the current displayer. More...
 
IlvCoordinateInfogetOrdinateInfo () const
 Deprecated Returns the coordinate information associated with the ordinate scale considered to display data. More...
 
const IlvCompositeChartDisplayergetParentDisplayer () const
 Returns the parent displayer. More...
 
virtual IlvChartDataPointInfogetPointInfo (IlUInt dataPtIdx, const IlvChartDataSet *dataSet=0) const
 Returns the point information associated with a given data point. More...
 
virtual IlvPalettegetProjectedPointsPalette () const
 Returns the palette used to display out-of-bounds values. More...
 
IlvChartDataSetgetRealDataSet (IlUInt index=0) const
 Returns a real data set to be displayed by the current displayer. More...
 
IlUInt getRealDataSetsCount () const
 Returns the number of real data sets. More...
 
virtual void insertDataSet (IlvChartDataSet *dataSet, IlUInt index=IlvLastPositionIndex)
 Inserts a real data set to be displayed by the current displayer. More...
 
IlBoolean isVisible () const
 Indicates whether the graphical representation is visible. More...
 
virtual void removeDataSet (IlvChartDataSet *dataSet)
 Removes a real data set from the data sets to be displayed by the current displayer. More...
 
virtual void removeDataSets ()
 Removes all the real data sets to be displayed by the current displayer.
 
void removePointInfoCollection (const IlvChartDataSet *dataSet)
 Removes the point information collection defined to be used to display a given data set. More...
 
virtual IlBoolean replaceDataSet (IlvChartDataSet *oldDataSet, IlvChartDataSet *newDataSet)
 Replaces a real data set with another one. More...
 
IlvOutputFilesave (IlvOutputFile &file) const
 Writes a complete description of the current object in a file. More...
 
virtual void setDataSet (IlvChartDataSet *dataSet, IlUInt index=0)
 Sets a real data set to be displayed by the current displayer. More...
 
void setDataSet (IlvChartDataSet *dataSet, IlvPalette *palette, IlUInt index=0)
 Sets a real data set to be displayed by the current displayer. More...
 
virtual void setDataSets (IlUInt count, IlvChartDataSet *const *dataSets)
 Sets the real data sets to be displayed by the current displayer. More...
 
void setName (const char *name)
 Sets the name of the current displayer. More...
 
void setParentDisplayer (const IlvCompositeChartDisplayer *displayer)
 Sets the parent displayer. More...
 
void setVirtualDataSet (IlvCombinedChartDataSet *vDataSet, IlUInt index=0)
 Sets a virtual data set used by the current displayer. More...
 
void setVisible (IlBoolean visible)
 Specifies whether the graphical representation is visible. More...
 

Protected Member Functions

virtual void dataSetRemoved (IlUInt index)
 Performs the updates needed when a real data set is removed. More...
 
virtual void updateVirtualDataSets ()
 Updates the virtual data sets. More...
 
- Protected Member Functions inherited from IlvCompositeChartDisplayer
 IlvCompositeChartDisplayer (const IlvCompositeChartDisplayer &displayer)
 Constructor. More...
 
 IlvCompositeChartDisplayer (IlvChartDisplayerFactory *factory=0)
 Constructor. More...
 
 IlvCompositeChartDisplayer (IlvInputFile &file)
 Constructor. More...
 
virtual IlvAbstractChartDisplayercreateDisplayer (IlUInt idx, IlvPalette *pal=0)
 Defines the child displayers that will be created by default to compose the current displayer. More...
 
void initDisplayers (IlUInt count, IlvPalette *const *palettes=0)
 Creates the displayers that compose the current displayer. More...
 
virtual IlvAbstractChartDisplayermakeDisplayer (IlUInt idx, IlvPalette *pal=0)
 Creates one of the displayers that compose the current displayer. More...
 
virtual void update ()
 Performs the updates needed when modifications (removing, adding, replacing) are made to the real data sets.
 
virtual void updateDisplayers ()
 Updates the displayers that compose the current displayer. More...
 
- Protected Member Functions inherited from IlvAbstractChartDisplayer
 IlvAbstractChartDisplayer ()
 Constructor. More...
 
 IlvAbstractChartDisplayer (const IlvAbstractChartDisplayer &displayer)
 Constructor. More...
 
 IlvAbstractChartDisplayer (IlvInputFile &file)
 Constructor. More...
 
virtual void dataSetAdded (IlUInt position=IlvLastPositionIndex)
 Performs the updates needed when a real data set is added. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from IlvAbstractChartDisplayer
static IlvAbstractChartDisplayerLoad (IlvInputFile &file)
 Reads a displayer object from a file. More...
 

Detailed Description

Base class for stacked data displayers.

Library: ilvcharts

This class is a subclass of IlvCompositeChartDisplayer. This class is the base class for displayers representing stacked data. It enables you to compare the contribution of a given data value to a total across several data sets. Some subclasses are provided that define the child displayers that are created by default to be stacked: bar displayers, polygon displayers, and so on.

The stacked displayers display as many data sets as you want. The first data set is represented at the bottom. The second one is represented stacked on the first one. The third one is represented stacked on the second one, and so on.

To represent the data stacked, the stacked displayer uses virtual data sets. The number of created virtual data sets is equal to the number of real data sets to be stacked.

If the data are not stacked with the total amount equal to 100%, the virtual data sets used are instances of the IlvAddChartDataSet class. These virtual data sets are composed of the added data items of the real data sets from which they are constructed. The first virtual data set is composed of only the first real data set to be stacked. The second virtual data set is composed of the first and the second real data sets to be stacked. The third virtual data set is composed of the first, the second, and the third real data sets to be stacked, and so on.

If the data are stacked with the total amount equal to 100%, the used virtual data sets are instances of the IlvStacked100ChartDataSet class. These virtual data sets are constructed from all the real data sets that are set on the stacked displayer.

The virtual data sets, constructed from the real data sets that are set on the displayer, are the data sets that are actually displayed by the displayer. (See the Detailed Description of the IlvAbstractChartDisplayer class for more details about virtual data sets.)

The stacked displayers can be used with any type of projection. (See the IlvAbstractProjector class for more details.)

See also
IlvCompositeChartDisplayer, IlvStackedBarChartDisplayer, IlvStacked3dBarChartDisplayer, IlvStackedPolygonChartDisplayer.

Constructor & Destructor Documentation

◆ IlvStackedChartDisplayer() [1/3]

IlvStackedChartDisplayer::IlvStackedChartDisplayer ( IlBoolean  stacked100PerCent = IlFalse)

Constructor.

Initializes a new IlvStackedChartDisplayer object.

Parameters
stacked100PerCentA Boolean indicating whether the data are stacked with the total amount equal to 100%.

◆ IlvStackedChartDisplayer() [2/3]

IlvStackedChartDisplayer::IlvStackedChartDisplayer ( IlvAbstractChartDisplayer model,
IlUInt  count,
IlvPalette *const *  palettes = 0,
IlBoolean  stacked100PerCent = IlFalse 
)

Constructor.

Initializes a new IlvStackedChartDisplayer object with count child displayers.

Parameters
modelThe displayer model that will be used to create the child displayers.
countThe number of child displayers that are created.
palettesThe palettes that will be used by the created child displayers. If a valid array of palettes is provided, its size must match count.
stacked100PerCentA Boolean indicating whether the data are stacked with the total amount equal to 100%.
See also
IlvCompositeChartDisplayer::setDisplayerModel.

◆ IlvStackedChartDisplayer() [3/3]

IlvStackedChartDisplayer::IlvStackedChartDisplayer ( IlvChartDisplayerFactory factory,
IlUInt  count,
IlvPalette *const *  palettes = 0,
IlBoolean  stacked100PerCent = IlFalse 
)

Constructor.

Initializes a new IlvStackedChartDisplayer object with count child displayers.

Parameters
factoryThe displayer factory that will be used to create the child displayers.
countThe number of child displayers that are created.
palettesThe palettes that will be used by the created child displayers. If a valid array of palettes is provided, its size must match count.
stacked100PerCentA Boolean indicating whether the data are stacked with the total amount equal to 100%.
See also
IlvChartDisplayerFactory, IlvCompositeChartDisplayer::setDisplayerFactory.

Member Function Documentation

◆ dataSetRemoved()

virtual void IlvStackedChartDisplayer::dataSetRemoved ( IlUInt  index)
protectedvirtual

Performs the updates needed when a real data set is removed.

This method removes the child displayer at the index index and then calls the IlvCompositeChartDisplayer::dataSetRemoved method.

Parameters
indexThe index of the removed data set.

Reimplemented from IlvAbstractChartDisplayer.

◆ draw()

virtual void IlvStackedChartDisplayer::draw ( IlvPort dst,
const IlvTransformer t,
const IlvRegion clip 
) const
virtual

Draws the child displayers.

This method is redefined to draw the child displayers in reverse order.

See also
IlvCompositeChartDisplayer::draw.

Reimplemented from IlvCompositeChartDisplayer.

◆ getDisplayerForDataSet()

virtual IlvAbstractChartDisplayer* IlvStackedChartDisplayer::getDisplayerForDataSet ( const IlvChartDataSet dataSet) const
virtual

Returns the child displayer used to display a given data set.

The default implementation returns a pointer to the first displayer that displays the data set dataSet among the displayers that compose the current displayer.

dataSet The data set for which we want to get the first displayer displaying this data set.

Returns
A pointer to the first displayer that displays the data set dataSet among the displayers that compose the current displayer, if one exists, and 0 otherwise.

Reimplemented from IlvCompositeChartDisplayer.

◆ getVirtualDataSet()

virtual IlvCombinedChartDataSet* IlvStackedChartDisplayer::getVirtualDataSet ( const IlvChartDataSet dataSet,
IlUInt index 
) const
virtual

Returns a virtual data set used by the current displayer.

The default implementation returns the first virtual data set among the virtual data sets used by the current displayer for which the data set dataSet is one of the real data sets used to construct this virtual data set.

Parameters
dataSetThe real data set for which we want to get the first virtual data set that uses it.
indexThe index of the virtual data set that is returned.
Returns
The first virtual data set among the virtual data sets used by the current displayer for which the data set dataSet is one of the real data sets used to construct this virtual data set.

Reimplemented from IlvAbstractChartDisplayer.

◆ isStacked100PerCent()

IlBoolean IlvStackedChartDisplayer::isStacked100PerCent ( ) const

Indicates whether the data are stacked with the total amount equal to 100%.

Returns
IlTrue if the data are stacked with the total amount equal to 100% and IlFalse otherwise.

◆ setStacked100PerCent()

void IlvStackedChartDisplayer::setStacked100PerCent ( IlBoolean  b)

Specifies whether the data are stacked with the total amount equal to 100%.

Parameters
bThe new value of the Boolean indicating whether the data are stacked with the total amount equal to 100%.

◆ updateVirtualDataSets()

virtual void IlvStackedChartDisplayer::updateVirtualDataSets ( )
protectedvirtual

Updates the virtual data sets.

This method first removes the existing virtual data sets and then constructs new virtual data sets from the real data sets that are set on the current displayer. The number of virtual data sets that are created is equal to the number of real data sets to be stacked.

If the data are not stacked with the total amount equal to 100%, the created virtual data sets are instances of the IlvAddChartDataSet class. The first virtual data set is composed of only the first real data set to be stacked. The second virtual data set is composed of the first and the second real data sets to be stacked. The third virtual data set is composed of the first, the second, and the third real data sets to be stacked, and so on.

If the data are stacked with the total amount equal to 100%, the created virtual data sets are instances of the IlvStacked100ChartDataSet class that are constructed from all the real data sets that are set on the current displayer.

Note
This method is used internally and should not be used directly by the user. It is called in the IlvAbstractChartDisplayer::update() method to update the virtual data sets when the real data sets have been modified.

Reimplemented from IlvAbstractChartDisplayer.

◆ useVirtualDataSets()

virtual IlBoolean IlvStackedChartDisplayer::useVirtualDataSets ( ) const
virtual

Indicates whether the current displayer uses virtual data sets.

Returns a Boolean that indicates whether the current displayer uses virtual data sets.

Returns
IlTrue by default.

Reimplemented from IlvAbstractChartDisplayer.