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

Implementation of predefined pie charts. More...

#include <ilviews/charts/simplegr.h>

Inheritance diagram for IlvPieChartGraphic:
IlvPolarChart IlvChartGraphic IlvSimpleGraphic IlvGraphic IlvValueInterface

Public Member Functions

 IlvPieChartGraphic (IlvDisplay *display, const IlvRect &bbox, IlDouble startingAngle=0., IlDouble range=360., IlDouble centerRatio=0., IlvPalette *palette=0)
 Constructor. More...
 
IlvPieChartDisplayeraddPieDisplayer (IlvChartDataSet *dataSet, IlDouble radiusRatio=1., IlvPalette *palette=0)
 Creates and adds a pie displayer. More...
 
virtual void draw (IlvPort *dst, const IlvTransformer *t=0, const IlvRegion *clip=0) const
 Draws the current object. More...
 
IlDouble getCenterRatio () const
 Returns the ratio of the center part relative to the data display area. More...
 
IlvPieChartDisplayergetPieDisplayer (IlUInt index) const
 Returns a given pie displayer. More...
 
IlDouble getRange () const
 Returns the range of the pie(s). More...
 
IlDouble getStartingAngle () const
 Returns the angle at which the first slice of the pie(s) is drawn. More...
 
IlBoolean isUsingAutoRadius () const
 Indicates whether the radius of the pie(s) is automatically computed. More...
 
void setCenterRatio (IlDouble ratio)
 Sets the ratio of the center part relative to the data display area. More...
 
void setRange (IlDouble range)
 Sets the angle range of the pie(s). More...
 
void setStartingAngle (IlDouble angle)
 Sets the angle at which the first slice of the pie(s) is drawn. More...
 
void useAutoRadius (IlBoolean b)
 Specifies whether the radius of the pie(s) is automatically computed. More...
 
- Public Member Functions inherited from IlvPolarChart
 IlvPolarChart (IlvDisplay *display, const IlvRect &bbox, IlBoolean useGrid=IlFalse, IlDouble startingAngle=0.0, IlDouble range=0.0, IlBoolean orientedClockwise=IlFalse, IlvPalette *palette=0, IlvPalette *gridPalette=0)
 Constructor. More...
 
- Public Member Functions inherited from IlvChartGraphic
 IlvChartGraphic (IlvDisplay *display, const IlvRect &bbox, IlvPalette *palette=0)
 Constructor. More...
 
virtual ~IlvChartGraphic ()
 Destructor. More...
 
IlvAbstractChartCursoraddAbscissaCursor (IlDouble value, IlvPalette *palette=0, IlBoolean reDraw=IlTrue)
 Adds a cursor on the abscissa axis. More...
 
IlvAbstractGridDisplayeraddAbscissaGrid (IlvPalette *majorPalette=0, IlvPalette *minorPalette=0, IlBoolean reDraw=IlTrue)
 Adds a grid on the abscissa axis. More...
 
virtual IlBoolean addDisplayer (IlvAbstractChartDisplayer *displayer, IlUInt count, IlvChartDataSet *const *dataSets, IlvCoordinateInfo *ordinateInfo=0, IlUInt position=IlvLastPositionIndex)
 Adds a displayer connected to several data sets. More...
 
IlBoolean addDisplayer (IlvAbstractChartDisplayer *displayer, IlvChartDataSet *dataSet=0, IlvCoordinateInfo *ordinateInfo=0, IlUInt position=IlvLastPositionIndex)
 Adds a displayer connected to one data set. More...
 
IlvAbstractChartCursoraddOrdinateCursor (IlDouble value, IlvPalette *palette=0, IlUInt index=0, IlBoolean reDraw=IlTrue)
 Adds a cursor on an ordinate axis. More...
 
IlvAbstractGridDisplayeraddOrdinateGrid (IlvPalette *majorPalette=0, IlvPalette *minorPalette=0, IlUInt index=0, IlBoolean reDraw=IlTrue)
 Adds a grid to an ordinate axis. More...
 
void addOrdinateScale (IlvAbstractScaleDisplayer *scale)
 Adds an ordinate scale. More...
 
virtual void dataPointsAdded (const IlvChartDataSet *ds, IlUInt iMin, IlUInt iMax, IlBoolean reDraw=IlTrue)
 Performs the automatic update when new data are added. More...
 
IlBoolean dataPointsToDisplay (IlUInt count, const IlvDoublePoint *dataPoints, IlvPoint *points, const IlvCoordinateInfo *ordinateInfo, IlBoolean shiftOfCycleLength, const IlvTransformer *t=0) const
 Converts data points to screen coordinates. More...
 
IlBoolean displayToDataPoints (IlUInt count, const IlvPoint *points, IlvDoublePoint *dataPoints, const IlvCoordinateInfo *ordinateInfo, IlBoolean shiftOfCycleLength, const IlvTransformer *t=0) const
 Converts screen coordinates to data points. More...
 
void enableFastScroll (IlBoolean enable)
 Enables a very efficient refresh in Shift scroll mode. More...
 
IlvAbstractGridDisplayergetAbscissaGrid () const
 Returns the abscissa grid. More...
 
IlvCoordinateInfogetAbscissaInfo () const
 Returns the coordinate information object of the abscissa. More...
 
IlvSingleScaleDisplayergetAbscissaScale () const
 Returns the abscissa scale. More...
 
const IlvAxisCrossinggetAxisCrossing (IlInt index) const
 Gets crossing between coordinate axes. More...
 
IlvAbstractChartCursorgetCycleCursor () const
 Returns the cycle cursor. More...
 
IlvAbstractChartDatagetData () const
 Returns the chart data object that manages the data sets displayed by the current object. More...
 
void getDataDisplayArea (const IlvCoordinateInfo *coordInfo, IlvRect &dataDisplayArea, const IlvTransformer *t=0) const
 Returns the rectangle where the data values of a coordinate are projected. More...
 
void getDataDisplayArea (IlvRect &dataDisplayArea, const IlvTransformer *t=0) const
 Returns the data display area of the chart. More...
 
IlvChartDataSetgetDataSet (IlUInt dataSetIndex) const
 Returns a given data set. More...
 
IlUInt getDataSetIndex (const IlvChartDataSet *dataSet) const
 Returns the index of a given data set. More...
 
IlvChartDataSet *const * getDataSets (IlUInt &dataSetCount) const
 Returns the data sets. More...
 
IlUInt getDataSetsCount () const
 Returns the number of data sets. More...
 
IlvAbstractChartDisplayergetDisplayer (IlUInt displayerIndex) const
 Gets one specific displayer by index. More...
 
IlvAbstractChartDisplayergetDisplayerByName (const char *name) const
 Gets one specific displayer by name. More...
 
IlUInt getDisplayerIndex (const IlvAbstractChartDisplayer *displayer) const
 Returns the index of a displayer. More...
 
IlUInt getDisplayersCount () const
 Returns the number of displayers. More...
 
IlUInt getDisplayItem (IlvAbstractChartDisplayer *&displayer, IlvChartDataSet *&dataSet, const IlvPoint &viewPoint, const IlvTransformer *t) const
 Returns the data point whose representation on the chart includes a given screen point of the chart graphic. More...
 
IlBoolean getDrawingArea (IlvRect &drawingArea, const IlvTransformer *t=0) const
 Returns the drawing area of the chart. More...
 
void getGraphArea (IlvRect &graphArea, const IlvTransformer *t=0) const
 Returns the graph area of the chart. More...
 
IlvChartLayoutgetLayout () const
 Returns the chart layout object. More...
 
IlvChartLegendgetLegend () const
 Returns the legend. More...
 
IlUInt getNearestPoint (IlvAbstractChartDisplayer *&displayer, IlvChartDataSet *&dataSet, const IlvPoint &viewPoint, IlvDim distance, IlvPoint &point, const IlvTransformer *t) const
 Returns the nearest data point from a screen point of the chart graphic. More...
 
IlvAbstractGridDisplayergetOrdinateGrid (IlUInt index=0) const
 Gets an ordinate grid by index. More...
 
IlUInt getOrdinateGridIndex (const IlvAbstractGridDisplayer *grid) const
 Returns the index of an ordinate grid. More...
 
IlvCoordinateInfogetOrdinateInfo (IlUInt index=0) const
 Returns the coordinate information object of an ordinate axis. More...
 
IlUInt getOrdinateInfoCount () const
 Returns the number of ordinate coordinate information objects. More...
 
IlUInt getOrdinateInfoIndex (const IlvCoordinateInfo *info) const
 Returns the index of an ordinate coordinate information object. More...
 
IlvAbstractScaleDisplayergetOrdinateScale (IlUInt index=0) const
 Gets an ordinate scale by index. More...
 
IlUInt getOrdinateScaleIndex (const IlvAbstractScaleDisplayer *scale) const
 Returns the index of an ordinate scale. More...
 
IlUInt getOrdinateScalesCount () const
 Returns the number of ordinate scales. More...
 
IlvSingleScaleDisplayergetOrdinateSingleScale (IlUInt index=0) const
 Gets a single ordinate scale by index. More...
 
IlvPalettegetProjectedPointsPalette () const
 Returns the palette used to display the out-of-bounds data points that are projected. More...
 
IlvAbstractProjectorgetProjector () const
 Returns the projector. More...
 
void getProjectorArea (const IlvAbstractScaleDisplayer *scale, IlvProjectorArea &projArea, const IlvTransformer *t=0) const
 Returns the description of the projecting area associated with a scale. More...
 
void getProjectorArea (const IlvCoordinateInfo *coordInfo, IlvProjectorArea &projArea, const IlvTransformer *t) const
 Returns the description of the projecting area associated with a coordinate. More...
 
IlvSingleScaleDisplayergetScaleForCursor (const IlvAbstractChartCursor *cursor) const
 Returns the scale for a cursor. More...
 
IlvAbstractChartCursorgetScrollCursor () const
 Returns the scrolling cursor. More...
 
ScrollMode getScrollMode () const
 Returns the scrolling mode. More...
 
IlDouble getScrollRatio () const
 Returns the scrolling ratio. More...
 
virtual void insertOrdinateScale (IlvAbstractScaleDisplayer *scale, IlUInt index=0)
 Inserts an ordinate scale. More...
 
IlBoolean isFastScrollEnabled () const
 Queries for the Fast Scroll mode. More...
 
IlBoolean isReDrawnWhenNotified () const
 Indicates whether an automatic redraw is performed. More...
 
void moveCursor (IlvAbstractChartCursor *cursor, IlDouble newValue, IlBoolean reDraw=IlTrue)
 Moves a cursor. More...
 
virtual void moveDisplayer (IlUInt displayerIndex, IlUInt newIndex)
 Changes the stacking order of a displayer. More...
 
IlBoolean projectHorizontally () const
 Indicates whether there is a horizontal projection of out-of-bounds data points. More...
 
IlBoolean projectVertically () const
 Indicates whether there is a vertical projection of out-of-bounds data points. More...
 
void reDrawWhenNotified (IlBoolean reDraw)
 Specifies whether an automatic redraw is performed. More...
 
IlvAbstractChartCursorremoveAbscissaCursor (IlvAbstractChartCursor *cursor, IlBoolean reDraw=IlTrue)
 Removes a cursor from the abscissa axis. More...
 
void removeAbscissaGrid (IlBoolean reDraw=IlTrue)
 Removes the grid from the abscissa axis. More...
 
virtual void removeAbscissaScale ()
 Removes the abscissa scale. More...
 
virtual IlBoolean removeDisplayer (IlUInt displayerIndex)
 Removes a displayer. More...
 
virtual void removeDisplayers ()
 Removes all displayers.
 
IlvAbstractChartCursorremoveOrdinateCursor (IlvAbstractChartCursor *cursor, IlUInt index=0, IlBoolean reDraw=IlTrue)
 Removes a cursor from an ordinate axis. More...
 
void removeOrdinateGrid (IlUInt index=0, IlBoolean reDraw=IlTrue)
 Removes the grid from an ordinate axis. More...
 
virtual void removeOrdinateGrids ()
 Removes all the ordinate grids. More...
 
virtual void removeOrdinateScale (IlUInt index)
 Removes an ordinate scale. More...
 
virtual void removeOrdinateScales ()
 Removes all the ordinate scales. More...
 
virtual IlBoolean replaceDisplayer (IlvAbstractChartDisplayer *oldDisplayer, IlvAbstractChartDisplayer *newDisplayer, IlBoolean copyPalettes=IlFalse)
 Replaces one displayer by another. More...
 
virtual void setAbscissaGrid (IlvAbstractGridDisplayer *grid)
 Sets the abscissa grid. More...
 
virtual void setAbscissaScale (IlvSingleScaleDisplayer *scale)
 Sets the abscissa scale. More...
 
void setAxisCrossing (IlInt index, IlDouble val)
 Specifies the crossing between coordinate axes at a fixed value. More...
 
void setAxisCrossing (IlInt index, IlvAxisCrossing *)
 Specifies the crossing between coordinate axes. More...
 
void setCursorVisible (IlvAbstractChartCursor *cursor, IlBoolean visible)
 Shows or hides a cursor. More...
 
virtual void setData (IlvAbstractChartData *data)
 Sets the chart data object that manages the data sets displayed by the current object. More...
 
void setDrawOrder (IlvDrawOrder drawOrder)
 Sets the drawing order for all the scales and grids defined. More...
 
virtual void setLayout (IlvChartLayout *layout)
 Sets the chart layout object. More...
 
void setLegend (IlvChartLegend *legend)
 Sets the legend. More...
 
virtual void setOrdinateGrid (IlUInt index, IlvAbstractGridDisplayer *grid)
 Adds or replaces an ordinate grid. More...
 
virtual void setOrdinateScale (IlUInt index, IlvAbstractScaleDisplayer *scale)
 Adds or replaces an ordinate scale. More...
 
void setProjectedPointsPalette (IlvPalette *palette)
 Sets the palette used to display the out-of-bounds data points that are projected. More...
 
void setProjectHorizontally (IlBoolean projectHorizontally)
 Specifies whether there is a horizontal projection of out-of-bounds data points. More...
 
virtual IlBoolean setProjector (IlvAbstractProjector *projector)
 Sets the projector. More...
 
void setProjectVertically (IlBoolean projectVertically)
 Specifies whether there is a vertical projection of out-of-bounds data points. More...
 
void setScrollMode (ScrollMode mode, IlBoolean createCursor=IlFalse)
 Sets the scrolling mode. More...
 
void setScrollRatio (IlDouble ratio)
 Sets the scrolling ratio. More...
 
void stackScales (IlUInt count, const IlvSingleScaleDisplayer *const *scales, IlDouble offsetRatio)
 Stack several ordinate scales. More...
 
virtual void translateCharts (IlDouble deltaAbscissa, IlDouble deltaOrdinate, IlUInt ordinateAxisIndex=0, IlBoolean redraw=IlTrue, IlBoolean clipToAutoRange=IlTrue)
 Translates the graphical representations of data. More...
 
virtual void update ()
 Updates the current object. More...
 
void updateAndReDraw ()
 Updates and redraws the current object. More...
 
IlBoolean zoomCharts (const IlvCoordInterval &abscissaRange, const IlvCoordInterval &ordinateRange, IlUInt ordinateAxisIndex=0, IlBoolean redraw=IlTrue, IlBoolean clipToAutoRange=IlTrue)
 Zooms the graphical representations of data. More...
 
virtual IlBoolean zoomCharts (const IlvCoordInterval &abscissaRange, IlBoolean redraw=IlTrue, IlBoolean clipToAutoRange=IlTrue)
 Zooms the graphical representations of data on the abscissa axis. More...
 
virtual IlBoolean zoomCharts (const IlvCoordInterval &ordinateRange, IlUInt ordinateAxisIndex, IlBoolean redraw=IlTrue, IlBoolean clipToAutoRange=IlTrue)
 Zooms the graphical representations of data on an ordinate axis. More...
 

Protected Member Functions

virtual IlvPieChartDisplayercreatePieDisplayer (IlDouble radiusRatio, IlDouble startingAngle, IlDouble range) const
 Creates a new pie displayer. More...
 

Additional Inherited Members

- Public Types inherited from IlvChartGraphic
enum  FillMode { FillNone, FillDataArea, FillGraphArea, FillDataAndGraphArea }
 Available chart fill modes. More...
 
enum  ScrollMode { IlvScrollModeStop, IlvScrollModeShift, IlvScrollModeCycle }
 Available scrolling modes. More...
 

Detailed Description

Implementation of predefined pie charts.

Library: ilvcharts

This class is a subclass of IlvPolarChart which allows you to display a chart made of one or several pies centered on the same point.

The pies centered on the same point can be displayed with a center part as you can see on the left in the image below. The center part is made of a circle drawn with the foreground color of the palette of the chart and filled with the background color of the palette of the chart.

Two examples of pie charts are shown below. The pie chart on the left is made of two pies (displayed by two pie displayers) and a center part. The pie chart on the right is made of only one pie (displayed by a pie displayer).

See also
IlvPolarChart.

Constructor & Destructor Documentation

◆ IlvPieChartGraphic()

IlvPieChartGraphic::IlvPieChartGraphic ( IlvDisplay display,
const IlvRect bbox,
IlDouble  startingAngle = 0.,
IlDouble  range = 360.,
IlDouble  centerRatio = 0.,
IlvPalette palette = 0 
)

Constructor.

Initializes a new IlvPieChartGraphic object. The flag indicating whether the radius of the pie(s) is automatically computed is set to IlTrue by default.

Parameters
displayThe display connection that will handle the drawing of this object.
bboxThe initial bounding box of the chart graphic.
startingAngleThe angle at which the first slice of the pie(s) will be drawn.
rangeThe angle range covered by the slices of the pie(s).
centerRatioThe ratio of the center part relative to the data display area. This value must be between 0 and 1. If it is equal to 0, no center part will be drawn.
paletteThe palette associated with the chart.
Note
No pie displayer is added by default. To add the pie displayers you want to be used by this object, you should use the IlvPieChartGraphic::addPieDisplayer() method.

Member Function Documentation

◆ addPieDisplayer()

IlvPieChartDisplayer* IlvPieChartGraphic::addPieDisplayer ( IlvChartDataSet dataSet,
IlDouble  radiusRatio = 1.,
IlvPalette palette = 0 
)

Creates and adds a pie displayer.

The pie displayer that is added is created inside this method by calling the IlvPieChartGraphic::createPieDisplayer() method.

Parameters
dataSetThe data set that will be displayed by the new pie displayer.
radiusRatioThe ratio of the radius of the pie relative to the ordinate range of the chart graphic. This value must be between 0 and 1. This value will be taken into account only if the flag indicating whether the radius of the pie(s) is automatically computed is equal to IlFalse.
paletteThe palette that will be used by the pie displayer.
Returns
A pointer to the pie displayer that has been created.
Note
If the flag indicating whether the radius of the pie(s) is automatically computed is equal to IlTrue (see the method IlvPieChartGraphic::isUsingAutoRadius()), the radius of all the pie displayers that are defined is automatically recomputed. The radius are recomputed so that the visible portion of the pies takes all the available space in the data display area once the space taken by the center part has been removed and so that the visible portion of the pies has the same width.

◆ createPieDisplayer()

virtual IlvPieChartDisplayer* IlvPieChartGraphic::createPieDisplayer ( IlDouble  radiusRatio,
IlDouble  startingAngle,
IlDouble  range 
) const
protectedvirtual

Creates a new pie displayer.

Parameters
radiusRatioThe ratio of the radius of the pie relative to the ordinate range of the chart graphic. This value must be between 0 and 1.
startingAngleThe angle at which the first slice will be drawn for the pie.
rangeThe angle range of the pie.
Note
This method is used internally and should not be used directly by the user. It is called in the IlvPieChartGraphic::addPieDisplayer() method to create the pie displayer that is added to the current object.

◆ draw()

virtual void IlvPieChartGraphic::draw ( IlvPort dst,
const IlvTransformer t = 0,
const IlvRegion clip = 0 
) const
virtual

Draws the current object.

The current implementation of the method calls the IlvPolarChart::draw method to draw the chart graphic (including all the pie displayers that have been added) and then draws the center part if the center ratio is different from 0. The center part is made of a circle drawn with the foreground color of the palette of the chart and filled with the background color of the palette of the chart. The drawing is performed in the port dst using the transformer t and the clipping region clip.

Parameters
dstThe port used for the drawing.
tThe optional transformer.
clipThe optional clipping region.

Reimplemented from IlvChartGraphic.

◆ getCenterRatio()

IlDouble IlvPieChartGraphic::getCenterRatio ( ) const

Returns the ratio of the center part relative to the data display area.

Returns
The ratio of the center part relative to the data display area.

◆ getPieDisplayer()

IlvPieChartDisplayer* IlvPieChartGraphic::getPieDisplayer ( IlUInt  index) const

Returns a given pie displayer.

Parameters
indexThe index of a pie displayer that has been added to the current object.
Returns
A pointer to the pie displayer with the index index that has been added to the current object.

◆ getRange()

IlDouble IlvPieChartGraphic::getRange ( ) const

Returns the range of the pie(s).

Returns
The angle range of the pie(s).
See also
setRange.

◆ getStartingAngle()

IlDouble IlvPieChartGraphic::getStartingAngle ( ) const

Returns the angle at which the first slice of the pie(s) is drawn.

Returns
The angle at which the first slice of the pie(s) is drawn.
See also
setStartingAngle.

◆ isUsingAutoRadius()

IlBoolean IlvPieChartGraphic::isUsingAutoRadius ( ) const

Indicates whether the radius of the pie(s) is automatically computed.

Returns
IlTrue if the radius of the pie(s) is automatically computed and IlFalse otherwise.

◆ setCenterRatio()

void IlvPieChartGraphic::setCenterRatio ( IlDouble  ratio)

Sets the ratio of the center part relative to the data display area.

Parameters
ratioThe new ratio of the center part relative to the data display area. This value must be between 0 and 1.

◆ setRange()

void IlvPieChartGraphic::setRange ( IlDouble  range)

Sets the angle range of the pie(s).

This range corresponds to the sum of the angles of the slices. If range is equal to 360 degrees, the slices will cover a whole circle.

Parameters
rangeThe new angle range of the pie(s). The angle range must be expressed in degrees.

◆ setStartingAngle()

void IlvPieChartGraphic::setStartingAngle ( IlDouble  angle)

Sets the angle at which the first slice of the pie(s) is drawn.

Note
This angle must be expressed in degrees.
Parameters
angleThe new angle at which the first slice of the pie(s) is drawn.

◆ useAutoRadius()

void IlvPieChartGraphic::useAutoRadius ( IlBoolean  b)

Specifies whether the radius of the pie(s) is automatically computed.

Parameters
bThe new value of the Boolean indicating whether the radius of the pie(s) is automatically computed.