KDChart::LeveyJenningsCoordinatePlane Class Reference

#include <KDChartLeveyJenningsCoordinatePlane.h>

Inheritance diagram for KDChart::LeveyJenningsCoordinatePlane:

Inheritance graph
[legend]
Collaboration diagram for KDChart::LeveyJenningsCoordinatePlane:

Collaboration graph
[legend]

List of all members.


Detailed Description

Levey Jennings coordinate plane This is actually nothing real more than a plain cartesian coordinate plane.

The difference is, that only Levey Jennings Diagrams can be added to it.

Definition at line 47 of file KDChartLeveyJenningsCoordinatePlane.h.


Public Types

enum  AxesCalcMode {
  Linear,
  Logarithmic
}

Public Slots

void adjustHorizontalRangeToData ()
 Adjust horizontal range settings to the ranges covered by the model's data values.
void adjustRangesToData ()
 Adjust both, horizontal and vertical range settings to the ranges covered by the model's data values.
void adjustVerticalRangeToData ()
 Adjust vertical range settings to the ranges covered by the model's data values.
void layoutPlanes ()
 Calling layoutPlanes() on the plane triggers the global KDChart::Chart::slotLayoutPlanes().
void relayout ()
 Calling relayout() on the plane triggers the global KDChart::Chart::slotRelayout().
void setGridNeedsRecalculate ()
 Used by the chart to clear the cached grid data.
void update ()
 Calling update() on the plane triggers the global KDChart::Chart::update().

Signals

void destroyedCoordinatePlane (AbstractCoordinatePlane *)
 Emitted when this coordinate plane is destroyed.
void geometryChanged (QRect, QRect)
 Emitted after the geometry of the Coordinate Plane has been changed.
void internal_geometryChanged (QRect, QRect)
void needLayoutPlanes ()
 Emitted when plane needs to trigger the Chart's layouting of the coord.
void needRelayout ()
 Emitted when plane needs to trigger the Chart's layouting.
void needUpdate ()
 Emitted when plane needs to update its drawings.
void positionChanged (AbstractArea *)
void propertiesChanged ()
 Emitted upon change of a property of the Coordinate Plane or any of its components.

Public Member Functions

void addDiagram (AbstractDiagram *diagram)
 Adds a diagram to this coordinate plane.
void alignToReferencePoint (const RelativePosition &position)
const bool autoAdjustGridToZoom () const
 Return the status of the built-in grid adjusting feature.
unsigned int autoAdjustHorizontalRangeToData () const
 Returns the maximal allowed percent of the horizontal space covered by the coordinate plane that may be empty.
unsigned int autoAdjustVerticalRangeToData () const
 Returns the maximal allowed percent of the vertical space covered by the coordinate plane that may be empty.
AxesCalcMode axesCalcModeX () const
AxesCalcMode axesCalcModeY () const
BackgroundAttributes backgroundAttributes () const
virtual int bottomOverlap (bool doNotRecalculate=false) const
 This is called at layout time by KDChart:AutoSpacerLayoutItem::sizeHint().
bool compare (const AbstractAreaBase *other) const
 Returns true if both areas have the same settings.
AbstractDiagramdiagram ()
 
Returns:
The first diagram associated with this coordinate plane.

QRectF diagramArea () const
 Returns the (physical) area occupied by the diagram.
ConstAbstractDiagramList diagrams () const
 
Returns:
The list of diagrams associated with this coordinate plane.

AbstractDiagramList diagrams ()
 
Returns:
The list of diagrams associated with this coordinate plane.

bool doesIsometricScaling () const
virtual Qt::Orientations expandingDirections () const
 pure virtual in QLayoutItem
FrameAttributes frameAttributes () const
virtual QRect geometry () const
 pure virtual in QLayoutItem
void getFrameLeadings (int &left, int &top, int &right, int &bottom) const
GridAttributes globalGridAttributes () const
 
Returns:
The grid attributes used by this coordinate plane.

const GridAttributes gridAttributes (Qt::Orientation orientation) const
 
Returns:
The attributes used for grid lines drawn in horizontal direction (or in vertical direction, resp.

LeveyJenningsGridAttributes gridAttributes () const
DataDimensionsList gridDimensionsList ()
 Returns the dimensions used for drawing the grid lines.
bool hasFixedDataCoordinateSpaceRelation () const
bool hasOwnGridAttributes (Qt::Orientation orientation) const
 
Returns:
Returns whether the grid attributes have been set for the respective direction via setGridAttributes( orientation ).

QPair< qreal, qreal > horizontalRange () const
 
Returns:
The largest and smallest visible horizontal value space value.

virtual bool isEmpty () const
 pure virtual in QLayoutItem
bool isHorizontalRangeReversed () const
 
Returns:
Whether the horizontal range is reversed or not

bool isRubberBandZoomingEnabled () const
 
Returns:
Whether zooming with a rubber band using the mouse is enabled.

bool isVerticalRangeReversed () const
 
Returns:
Whether the vertical range is reversed or not

const bool isVisiblePoint (const QPointF &point) const
 Tests, if a point is visible on the coordinate plane.
virtual int leftOverlap (bool doNotRecalculate=false) const
 This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().
 LeveyJenningsCoordinatePlane (Chart *parent=0)
QRectF logicalArea () const
 Returns the logical area, i.e., the rectangle defined by the very top left and very bottom right coordinate.
virtual QSize maximumSize () const
 pure virtual in QLayoutItem
virtual QSize minimumSize () const
 pure virtual in QLayoutItem
virtual QSize minimumSizeHint () const
 [reimplemented]
void mouseDoubleClickEvent (QMouseEvent *event)
void mouseMoveEvent (QMouseEvent *event)
void mousePressEvent (QMouseEvent *event)
void mouseReleaseEvent (QMouseEvent *event)
virtual void paint (QPainter *)
 reimpl
virtual void paintAll (QPainter &painter)
 Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked automatically.
virtual void paintBackground (QPainter &painter, const QRect &rectangle)
virtual void paintCtx (PaintContext *context)
 Default impl: Paint the complete item using its layouted position and size.
virtual void paintFrame (QPainter &painter, const QRect &rectangle)
virtual void paintIntoRect (QPainter &painter, const QRect &rect)
 Draws the background and frame, then calls paint().
const Chartparent () const
Chartparent ()
QLayout * parentLayout ()
AbstractCoordinatePlanereferenceCoordinatePlane () const
 There are two ways, in which planes can be caused to interact, in where they are put layouting wise: The first is the reference plane.
void removeFromParentLayout ()
virtual void replaceDiagram (AbstractDiagram *diagram, AbstractDiagram *oldDiagram=0)
 Replaces the old diagram, or appends the diagram, it there is none yet.
void resetGridAttributes (Qt::Orientation orientation)
 Reset the attributes to be used for grid lines drawn in horizontal direction (or in vertical direction, resp.
virtual int rightOverlap (bool doNotRecalculate=false) const
 This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().
void setAutoAdjustGridToZoom (bool autoAdjust)
 Disable / re-enable the built-in grid adjusting feature.
void setAutoAdjustHorizontalRangeToData (unsigned int percentEmpty=67)
 Automatically adjust horizontal range settings to the ranges covered by the model's values, when ever the data have changed, and then emit horizontalRangeAutomaticallyAdjusted.
void setAutoAdjustVerticalRangeToData (unsigned int percentEmpty=67)
 Automatically adjust vertical range settings to the ranges covered by the model's values, when ever the data have changed, and then emit verticalRangeAutomaticallyAdjusted.
void setAxesCalcModes (AxesCalcMode mode)
 Specifies the calculation modes for all axes.
void setAxesCalcModeX (AxesCalcMode mode)
 Specifies the calculation mode for all Abscissa axes.
void setAxesCalcModeY (AxesCalcMode mode)
 Specifies the calculation mode for all Ordinate axes.
void setBackgroundAttributes (const BackgroundAttributes &a)
void setFixedDataCoordinateSpaceRelation (bool fixed)
 Allows to specify a fixed data-space / coordinate-space relation.
void setFrameAttributes (const FrameAttributes &a)
void setGeometry (const QRect &r)
 reimplement from AbstractCoordinatePlane
void setGlobalGridAttributes (const GridAttributes &)
 Set the grid attributes to be used by this coordinate plane.
void setGridAttributes (Qt::Orientation orientation, const GridAttributes &)
 Set the attributes to be used for grid lines drawn in horizontal direction (or in vertical direction, resp.
void setGridAttributes (const LeveyJenningsGridAttributes &attr)
void setHorizontalRange (const QPair< qreal, qreal > &range)
 Set the boundaries of the visible value space displayed in horizontal direction.
void setHorizontalRangeReversed (bool reverse)
 Sets whether the horizontal range should be reversed or not, i.e.
void setIsometricScaling (bool onOff)
void setParent (Chart *parent)
 Called internally by KDChart::Chart.
void setParentLayout (QLayout *lay)
virtual void setParentWidget (QWidget *widget)
 Inform the item about its widget: This enables the item, to trigger that widget's update, whenever the size of the item's contents has changed.
void setReferenceCoordinatePlane (AbstractCoordinatePlane *plane)
 Set another coordinate plane to be used as the reference plane for this one.
void setRubberBandZoomingEnabled (bool enable)
 Enables or disables zooming with a rubber band using the mouse.
void setVerticalRange (const QPair< qreal, qreal > &range)
 Set the boundaries of the visible value space displayed in vertical direction.
void setVerticalRangeReversed (bool reverse)
 Sets whether the vertical range should be reversed or not, i.e.
virtual void setZoomCenter (const QPointF &center)
 
See also:
zoomCenter, setZoomFactorX, setZoomFactorY

virtual void setZoomFactors (double factorX, double factorY)
 
See also:
setZoomFactorX,setZoomFactorY

virtual void setZoomFactorX (double factor)
 
See also:
zoomFactorX, setZoomCenter

virtual void setZoomFactorY (double factor)
 
See also:
zoomFactorY, setZoomCenter

AbstractCoordinatePlanesharedAxisMasterPlane (QPainter *p=0)
 reimpl
virtual QSize sizeHint () const
 pure virtual in QLayoutItem
virtual void sizeHintChanged () const
 Report changed size hint: ask the parent widget to recalculate the layout.
virtual QSizePolicy sizePolicy () const
 [reimplemented]
virtual void takeDiagram (AbstractDiagram *diagram)
 Removes the diagram from the plane, without deleting it.
virtual int topOverlap (bool doNotRecalculate=false) const
 This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().
const QPointF translate (const QPointF &diagramPoint) const
 Translate the given point in value space coordinates to a position in pixel space.
QPair< qreal, qreal > verticalRange () const
 
Returns:
The largest and smallest visible horizontal value space value.

QRectF visibleDataRange () const
 Returns the currently visible data range.
QRectF visibleDiagramArea () const
 Returns the visible part of the diagram area, i.e.
virtual QPointF zoomCenter () const
 
See also:
setZoomCenter, setZoomFactorX, setZoomFactorY

virtual double zoomFactorX () const
 
See also:
setZoomFactorX, setZoomCenter

virtual double zoomFactorY () const
 
See also:
setZoomFactorY, setZoomCenter

 ~LeveyJenningsCoordinatePlane ()

Static Public Member Functions

static void paintBackgroundAttributes (QPainter &painter, const QRect &rectangle, const KDChart::BackgroundAttributes &attributes)
static void paintFrameAttributes (QPainter &painter, const QRect &rectangle, const KDChart::FrameAttributes &attributes)

Protected Slots

void slotLayoutChanged (AbstractDiagram *)

Protected Member Functions

QRectF adjustedToMaxEmptyInnerPercentage (const QRectF &r, unsigned int percentX, unsigned int percentY) const
virtual QRect areaGeometry () const
virtual QRectF calculateRawDataBoundingRect () const
bool doneSetZoomCenter (const QPointF &center)
bool doneSetZoomFactorX (double factor)
bool doneSetZoomFactorY (double factor)
virtual QRectF drawingArea () const
virtual DataDimensionsList getDataDimensionsList () const
QRectF getRawDataBoundingRectFromDiagrams () const
void handleFixedDataCoordinateSpaceRelation (const QRectF &geometry)
QRect innerRect () const
void layoutDiagrams ()
 Distribute the available space among the diagrams and axes.
void paintEvent (QPaintEvent *)
virtual void positionHasChanged ()
const QPointF translateBack (const QPointF &screenPoint) const

Protected Attributes

QWidgetmParent
QLayout * mParentLayout

Member Enumeration Documentation

enum KDChart::AbstractCoordinatePlane::AxesCalcMode [inherited]

Enumerator:
Linear 
Logarithmic 

Definition at line 57 of file KDChartAbstractCoordinatePlane.h.

00057 { Linear, Logarithmic };


Constructor & Destructor Documentation

LeveyJenningsCoordinatePlane::LeveyJenningsCoordinatePlane ( Chart parent = 0  )  [explicit]

Definition at line 50 of file KDChartLeveyJenningsCoordinatePlane.cpp.

00051     : CartesianCoordinatePlane( new Private(), parent )
00052 {
00053 }

LeveyJenningsCoordinatePlane::~LeveyJenningsCoordinatePlane (  ) 

Definition at line 55 of file KDChartLeveyJenningsCoordinatePlane.cpp.

00056 {
00057 }


Member Function Documentation

void LeveyJenningsCoordinatePlane::addDiagram ( AbstractDiagram diagram  )  [virtual]

Adds a diagram to this coordinate plane.

Parameters:
diagram The diagram to add.
See also:
replaceDiagram, takeDiagram

Reimplemented from KDChart::CartesianCoordinatePlane.

Definition at line 63 of file KDChartLeveyJenningsCoordinatePlane.cpp.

References KDChart::CartesianCoordinatePlane::addDiagram().

00064 {
00065     Q_ASSERT_X ( dynamic_cast<LeveyJenningsDiagram*>( diagram ),
00066                  "LeveyJenningsCoordinatePlane::addDiagram", "Only Levey Jennings "
00067                  "diagrams can be added to a ternary coordinate plane!" );
00068     CartesianCoordinatePlane::addDiagram ( diagram );
00069 }

QRectF CartesianCoordinatePlane::adjustedToMaxEmptyInnerPercentage ( const QRectF &  r,
unsigned int  percentX,
unsigned int  percentY 
) const [protected, inherited]

Definition at line 177 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::CartesianCoordinatePlane::axesCalcModeX(), KDChart::CartesianCoordinatePlane::axesCalcModeY(), and KDChart::AbstractCoordinatePlane::Logarithmic.

Referenced by KDChart::CartesianCoordinatePlane::calculateRawDataBoundingRect().

00179 {
00180     QRectF erg( r );
00181     if( ( axesCalcModeX() != Logarithmic || r.left() < 0.0 ) && (percentX > 0) && (percentX != 100) ) {
00182         const bool isPositive = (r.left() >= 0);
00183         if( (r.right() >= 0) == isPositive ){
00184             const qreal innerBound =
00185                     isPositive ? qMin(r.left(), r.right()) : qMax(r.left(), r.right());
00186             const qreal outerBound =
00187                     isPositive ? qMax(r.left(), r.right()) : qMin(r.left(), r.right());
00188             if( innerBound / outerBound * 100 <= percentX )
00189             {
00190                 if( isPositive )
00191                     erg.setLeft( 0.0 );
00192                 else
00193                     erg.setRight( 0.0 );
00194             }
00195         }
00196     }
00197     if( ( axesCalcModeY() != Logarithmic || r.bottom() < 0.0 ) && (percentY > 0) && (percentY != 100) ) {
00198         //qDebug() << erg.bottom() << erg.top();
00199         const bool isPositive = (r.bottom() >= 0);
00200         if( (r.top() >= 0) == isPositive ){
00201             const qreal innerBound =
00202                     isPositive ? qMin(r.top(), r.bottom()) : qMax(r.top(), r.bottom());
00203             const qreal outerBound =
00204                     isPositive ? qMax(r.top(), r.bottom()) : qMin(r.top(), r.bottom());
00205             //qDebug() << innerBound << outerBound;
00206             if( innerBound / outerBound * 100 <= percentY )
00207             {
00208                 if( isPositive )
00209                     erg.setBottom( 0.0 );
00210                 else
00211                     erg.setTop( 0.0 );
00212             }
00213         }
00214         //qDebug() << erg.bottom() << erg.top() << "!!";
00215     }
00216     return erg;
00217 }

void CartesianCoordinatePlane::adjustHorizontalRangeToData (  )  [slot, inherited]

Adjust horizontal range settings to the ranges covered by the model's data values.

See also:
adjustRangesToData

Definition at line 684 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams(), KDChart::CartesianCoordinatePlane::layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().

00685 {
00686     const QRectF dataBoundingRect( getRawDataBoundingRectFromDiagrams() );
00687     d->horizontalMin = dataBoundingRect.left();
00688     d->horizontalMax = dataBoundingRect.right();
00689     layoutDiagrams();
00690     emit propertiesChanged();
00691 }

void CartesianCoordinatePlane::adjustRangesToData (  )  [slot, inherited]

Adjust both, horizontal and vertical range settings to the ranges covered by the model's data values.

See also:
setHorizontalRange, setVerticalRange

adjustHorizontalRangeToData, adjustVerticalRangeToData

setAutoAdjustHorizontalRangeToData, setAutoAdjustVerticalRangeToData

Definition at line 673 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams(), KDChart::CartesianCoordinatePlane::layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().

00674 {
00675     const QRectF dataBoundingRect( getRawDataBoundingRectFromDiagrams() );
00676     d->horizontalMin = dataBoundingRect.left();
00677     d->horizontalMax = dataBoundingRect.right();
00678     d->verticalMin = dataBoundingRect.top();
00679     d->verticalMax = dataBoundingRect.bottom();
00680     layoutDiagrams();
00681     emit propertiesChanged();
00682 }

void CartesianCoordinatePlane::adjustVerticalRangeToData (  )  [slot, inherited]

Adjust vertical range settings to the ranges covered by the model's data values.

See also:
adjustRangesToData

Definition at line 693 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams(), KDChart::CartesianCoordinatePlane::layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().

00694 {
00695     const QRectF dataBoundingRect( getRawDataBoundingRectFromDiagrams() );
00696     d->verticalMin = dataBoundingRect.bottom();
00697     d->verticalMax = dataBoundingRect.top();
00698     layoutDiagrams();
00699     emit propertiesChanged();
00700 }

void AbstractAreaBase::alignToReferencePoint ( const RelativePosition position  )  [inherited]

Definition at line 91 of file KDChartAbstractAreaBase.cpp.

00092 {
00093     Q_UNUSED( position );
00094     // PENDING(kalle) FIXME
00095     qWarning( "Sorry, not implemented: void AbstractAreaBase::alignToReferencePoint( const RelativePosition& position )" );
00096 }

QRect AbstractArea::areaGeometry (  )  const [protected, virtual, inherited]

Implements KDChart::AbstractAreaBase.

Definition at line 150 of file KDChartAbstractArea.cpp.

Referenced by KDChart::CartesianCoordinatePlane::drawingArea(), KDChart::TernaryCoordinatePlane::layoutDiagrams(), KDChart::PolarCoordinatePlane::layoutDiagrams(), KDChart::TernaryCoordinatePlane::paint(), KDChart::CartesianAxis::paint(), KDChart::AbstractArea::paintAll(), and KDChart::CartesianAxis::paintCtx().

00151 {
00152     return geometry();
00153 }

const bool CartesianCoordinatePlane::autoAdjustGridToZoom (  )  const [inherited]

Return the status of the built-in grid adjusting feature.

See also:
setAutoAdjustGridToZoom

Definition at line 794 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00795 {
00796     return d->autoAdjustGridToZoom;
00797 }

unsigned int CartesianCoordinatePlane::autoAdjustHorizontalRangeToData (  )  const [inherited]

Returns the maximal allowed percent of the horizontal space covered by the coordinate plane that may be empty.

Returns:
A percent value indicating how much of the horizontal space may be empty. If more than this is empty, automatic range adjusting is applied. A return value of 100 indicates that no such automatic adjusting is done at all.
See also:
setAutoAdjustHorizontalRangeToData, adjustRangesToData

Definition at line 720 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00721 {
00722     return d->autoAdjustHorizontalRangeToData;
00723 }

unsigned int CartesianCoordinatePlane::autoAdjustVerticalRangeToData (  )  const [inherited]

Returns the maximal allowed percent of the vertical space covered by the coordinate plane that may be empty.

Returns:
A percent value indicating how much of the vertical space may be empty. If more than this is empty, automatic range adjusting is applied. A return value of 100 indicates that no such automatic adjusting is done at all.
See also:
setAutoAdjustVerticalRangeToData, adjustRangesToData

Definition at line 725 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00726 {
00727     return d->autoAdjustVerticalRangeToData;
00728 }

CartesianCoordinatePlane::AxesCalcMode CartesianCoordinatePlane::axesCalcModeX (  )  const [inherited]

Definition at line 609 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by KDChart::CartesianCoordinatePlane::adjustedToMaxEmptyInnerPercentage(), and KDChart::CartesianCoordinatePlane::getDataDimensionsList().

00610 {
00611     return d->coordinateTransformation.axesCalcModeX;
00612 }

CartesianCoordinatePlane::AxesCalcMode CartesianCoordinatePlane::axesCalcModeY (  )  const [inherited]

Definition at line 604 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by KDChart::CartesianCoordinatePlane::adjustedToMaxEmptyInnerPercentage(), and KDChart::CartesianCoordinatePlane::getDataDimensionsList().

00605 {
00606     return d->coordinateTransformation.axesCalcModeY;
00607 }

BackgroundAttributes AbstractAreaBase::backgroundAttributes (  )  const [inherited]

Definition at line 121 of file KDChartAbstractAreaBase.cpp.

References d.

Referenced by KDChart::AbstractAreaBase::compare(), and updateCommonBrush().

00122 {
00123     return d->backgroundAttributes;
00124 }

int AbstractArea::bottomOverlap ( bool  doNotRecalculate = false  )  const [virtual, inherited]

This is called at layout time by KDChart:AutoSpacerLayoutItem::sizeHint().

The method triggers AbstractArea::sizeHint() to find out the amount of overlap at the bottom edge of the area.

Note:
The default implementation is not using any caching, it might make sense to implement a more sophisticated solution for derived classes that have complex work to do in sizeHint(). All we have here is a primitive flag to be set by the caller if it is sure that no sizeHint() needs to be called.

Definition at line 101 of file KDChartAbstractArea.cpp.

References d.

Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().

00102 {
00103     // Re-calculate the sizes,
00104     // so we also get the amountOf..Overlap members set newly:
00105     if( ! doNotRecalculate )
00106         sizeHint();
00107     return d->amountOfBottomOverlap;
00108 }

QRectF CartesianCoordinatePlane::calculateRawDataBoundingRect (  )  const [protected, virtual, inherited]

Definition at line 220 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::CartesianCoordinatePlane::adjustedToMaxEmptyInnerPercentage(), d, KDChart::CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams(), and StockDiagram::Private::Private().

Referenced by KDChart::CartesianCoordinatePlane::getDataDimensionsList().

00221 {
00222     // are manually set ranges to be applied?
00223     const bool bAutoAdjustHorizontalRange = (d->autoAdjustHorizontalRangeToData < 100);
00224     const bool bAutoAdjustVerticalRange   = (d->autoAdjustVerticalRangeToData   < 100);
00225 
00226     const bool bHardHorizontalRange = (d->horizontalMin != d->horizontalMax) && ! bAutoAdjustHorizontalRange;
00227     const bool bHardVerticalRange   = (d->verticalMin   != d->verticalMax)   && ! bAutoAdjustVerticalRange;
00228     QRectF dataBoundingRect;
00229 
00230     // if custom boundaries are set on the plane, use them
00231     if ( bHardHorizontalRange && bHardVerticalRange ) {
00232         dataBoundingRect.setLeft(   d->horizontalMin );
00233         dataBoundingRect.setRight(  d->horizontalMax );
00234         dataBoundingRect.setBottom( d->verticalMin );
00235         dataBoundingRect.setTop(    d->verticalMax );
00236     }else{
00237         // determine unit of the rectangles of all involved diagrams:
00238         dataBoundingRect = getRawDataBoundingRectFromDiagrams();
00239         if ( bHardHorizontalRange ) {
00240             dataBoundingRect.setLeft(  d->horizontalMin );
00241             dataBoundingRect.setRight( d->horizontalMax );
00242         }
00243         if ( bHardVerticalRange ) {
00244             dataBoundingRect.setBottom( d->verticalMin );
00245             dataBoundingRect.setTop(    d->verticalMax );
00246         }
00247     }
00248     // recalculate the bounds, if automatic adjusting of ranges is desired AND
00249     //                         both bounds are at the same side of the zero line
00250     dataBoundingRect = adjustedToMaxEmptyInnerPercentage(
00251             dataBoundingRect, d->autoAdjustHorizontalRangeToData, d->autoAdjustVerticalRangeToData );
00252     if( bAutoAdjustHorizontalRange ){
00253         const_cast<CartesianCoordinatePlane::Private *>(d)->horizontalMin = dataBoundingRect.left();
00254         const_cast<CartesianCoordinatePlane::Private *>(d)->horizontalMax = dataBoundingRect.right();
00255     }
00256     if( bAutoAdjustVerticalRange ){
00257         const_cast<CartesianCoordinatePlane*>(this)->d->verticalMin = dataBoundingRect.bottom();
00258         const_cast<CartesianCoordinatePlane*>(this)->d->verticalMax = dataBoundingRect.top();
00259     }
00260     //qDebug() << "CartesianCoordinatePlane::calculateRawDataBoundingRect()\nreturns data boundaries: " << dataBoundingRect;
00261     return dataBoundingRect;
00262 }

bool AbstractAreaBase::compare ( const AbstractAreaBase other  )  const [inherited]

Returns true if both areas have the same settings.

Definition at line 76 of file KDChartAbstractAreaBase.cpp.

References KDChart::AbstractAreaBase::backgroundAttributes(), and KDChart::AbstractAreaBase::frameAttributes().

00077 {
00078     if( other == this ) return true;
00079     if( ! other ){
00080         //qDebug() << "CartesianAxis::compare() cannot compare to Null pointer";
00081         return false;
00082     }
00083     /*
00084     qDebug() << "AbstractAreaBase:" << (frameAttributes() == other->frameAttributes())
00085         << (backgroundAttributes() == other->backgroundAttributes()) << "\n";
00086     */
00087     return  (frameAttributes()      == other->frameAttributes()) &&
00088             (backgroundAttributes() == other->backgroundAttributes());
00089 }

void KDChart::AbstractCoordinatePlane::destroyedCoordinatePlane ( AbstractCoordinatePlane  )  [signal, inherited]

Emitted when this coordinate plane is destroyed.

Referenced by KDChart::AbstractCoordinatePlane::~AbstractCoordinatePlane().

AbstractDiagram * AbstractCoordinatePlane::diagram (  )  [inherited]

Returns:
The first diagram associated with this coordinate plane.

Definition at line 125 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::Widget::diagram(), KDChart::CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams(), KDChart::TernaryCoordinatePlane::layoutDiagrams(), KDChart::PolarCoordinatePlane::layoutDiagrams(), KDChart::CartesianCoordinatePlane::setGeometry(), KDChart::PolarCoordinatePlane::setStartPosition(), KDChart::Widget::setType(), and KDChart::CartesianCoordinatePlane::sharedAxisMasterPlane().

00126 {
00127     if ( d->diagrams.isEmpty() )
00128     {
00129         return 0;
00130     } else {
00131         return d->diagrams.first();
00132     }
00133 }

QRectF CartesianCoordinatePlane::diagramArea (  )  const [inherited]

Returns the (physical) area occupied by the diagram.

Unless zoom is applied (which is also true when a fixed data coordinate / space relation is used),

.
See also:
setFixedDataCoordinateSpaceRelation

drawingArea

Definition at line 359 of file KDChartCartesianCoordinatePlane.cpp.

References d, and KDChart::CartesianCoordinatePlane::logicalArea().

Referenced by KDChart::CartesianCoordinatePlane::visibleDiagramArea().

00360 {
00361     const QRectF logArea( logicalArea() );
00362     QPointF physicalTopLeft = d->coordinateTransformation.translate( logArea.topLeft() );
00363     QPointF physicalBottomRight = d->coordinateTransformation.translate( logArea.bottomRight() );
00364 
00365     return QRectF( physicalTopLeft, physicalBottomRight ).normalized();
00366 }

ConstAbstractDiagramList AbstractCoordinatePlane::diagrams (  )  const [inherited]

Returns:
The list of diagrams associated with this coordinate plane.

Definition at line 140 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00141 {
00142     ConstAbstractDiagramList list;
00143 #ifndef QT_NO_STL
00144     qCopy( d->diagrams.begin(), d->diagrams.end(), std::back_inserter( list ) );
00145 #else
00146     Q_FOREACH( AbstractDiagram * a, d->diagrams )
00147         list.push_back( a );
00148 #endif
00149     return list;

AbstractDiagramList AbstractCoordinatePlane::diagrams (  )  [inherited]

Returns:
The list of diagrams associated with this coordinate plane.

Definition at line 135 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::Chart::event(), KDChart::CartesianCoordinatePlane::getDataDimensionsList(), KDChart::CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams(), KDChart::TernaryCoordinatePlane::layoutDiagrams(), KDChart::PolarCoordinatePlane::layoutDiagrams(), KDChart::CartesianCoordinatePlane::layoutDiagrams(), KDChart::Chart::mouseDoubleClickEvent(), KDChart::Chart::mouseMoveEvent(), KDChart::Chart::mousePressEvent(), KDChart::Chart::mouseReleaseEvent(), KDChart::TernaryCoordinatePlane::paint(), KDChart::PolarCoordinatePlane::paint(), KDChart::CartesianCoordinatePlane::paint(), and KDChart::CartesianCoordinatePlane::setGeometry().

00136 {
00137     return d->diagrams;
00138 }

bool CartesianCoordinatePlane::doesIsometricScaling (  )  const [inherited]

Definition at line 522 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00523 {
00524     return d->isometricScaling;
00525 }

bool CartesianCoordinatePlane::doneSetZoomCenter ( const QPointF &  center  )  [protected, inherited]

Definition at line 549 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by KDChart::CartesianCoordinatePlane::handleFixedDataCoordinateSpaceRelation(), and KDChart::CartesianCoordinatePlane::setZoomCenter().

00550 {
00551     const bool done = ( d->coordinateTransformation.zoom.center() != point );
00552     if( done ){
00553         d->coordinateTransformation.zoom.setCenter( point );
00554         if( d->autoAdjustGridToZoom )
00555             d->grid->setNeedRecalculate();
00556     }
00557     return done;
00558 }

bool CartesianCoordinatePlane::doneSetZoomFactorX ( double  factor  )  [protected, inherited]

Definition at line 527 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by KDChart::CartesianCoordinatePlane::handleFixedDataCoordinateSpaceRelation(), KDChart::CartesianCoordinatePlane::setZoomFactors(), and KDChart::CartesianCoordinatePlane::setZoomFactorX().

00528 {
00529     const bool done = ( d->coordinateTransformation.zoom.xFactor != factor );
00530     if( done ){
00531         d->coordinateTransformation.zoom.xFactor = factor;
00532         if( d->autoAdjustGridToZoom )
00533             d->grid->setNeedRecalculate();
00534     }
00535     return done;
00536 }

bool CartesianCoordinatePlane::doneSetZoomFactorY ( double  factor  )  [protected, inherited]

Definition at line 538 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by KDChart::CartesianCoordinatePlane::handleFixedDataCoordinateSpaceRelation(), KDChart::CartesianCoordinatePlane::setZoomFactors(), and KDChart::CartesianCoordinatePlane::setZoomFactorY().

00539 {
00540     const bool done = ( d->coordinateTransformation.zoom.yFactor != factor );
00541     if( done ){
00542         d->coordinateTransformation.zoom.yFactor = factor;
00543         if( d->autoAdjustGridToZoom )
00544             d->grid->setNeedRecalculate();
00545     }
00546     return done;
00547 }

QRectF CartesianCoordinatePlane::drawingArea (  )  const [protected, virtual, inherited]

Definition at line 317 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::AbstractArea::areaGeometry().

Referenced by KDChart::CartesianCoordinatePlane::layoutDiagrams(), KDChart::CartesianCoordinatePlane::paint(), KDChart::CartesianCoordinatePlane::setGeometry(), KDChart::CartesianCoordinatePlane::visibleDataRange(), and KDChart::CartesianCoordinatePlane::visibleDiagramArea().

00318 {
00319     // the rectangle the diagrams cover in the *plane*:
00320     // (Why -3? We save 1px on each side for the antialiased drawing, and
00321     // respect the way QPainter calculates the width of a painted rect (the
00322     // size is the rectangle size plus the pen width). This way, most clipping
00323     // for regular pens should be avoided. When pens with a penWidth or larger
00324     // than 1 are used, this may not be sufficient.
00325     const QRect rect( areaGeometry() );
00326     return QRectF ( rect.left()+1, rect.top()+1, rect.width() - 3, rect.height() - 3 );
00327 }

Qt::Orientations KDChart::AbstractCoordinatePlane::expandingDirections (  )  const [virtual, inherited]

pure virtual in QLayoutItem

Definition at line 219 of file KDChartAbstractCoordinatePlane.cpp.

00221 {
00222     return Qt::Vertical | Qt::Horizontal;

FrameAttributes AbstractAreaBase::frameAttributes (  )  const [inherited]

Definition at line 107 of file KDChartAbstractAreaBase.cpp.

References d.

Referenced by KDChart::Legend::clone(), KDChart::AbstractAreaBase::compare(), and updateCommonBrush().

00108 {
00109     return d->frameAttributes;
00110 }

QRect KDChart::AbstractCoordinatePlane::geometry (  )  const [virtual, inherited]

pure virtual in QLayoutItem

Definition at line 259 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::Chart::mouseDoubleClickEvent(), KDChart::Chart::mouseMoveEvent(), KDChart::AbstractCoordinatePlane::mouseMoveEvent(), KDChart::Chart::mousePressEvent(), KDChart::Chart::mouseReleaseEvent(), KDChart::AbstractCoordinatePlane::mouseReleaseEvent(), KDChart::PolarDiagram::paint(), KDChart::PolarCoordinatePlane::paint(), and KDChart::CartesianCoordinatePlane::setGeometry().

00261 {
00262     return d->geometry;

void KDChart::AbstractCoordinatePlane::geometryChanged ( QRect  ,
QRect   
) [signal, inherited]

Emitted after the geometry of the Coordinate Plane has been changed.

and control has returned to the event loop.

Parameters are the the old geometry, the new geometry.

DataDimensionsList CartesianCoordinatePlane::getDataDimensionsList (  )  const [protected, virtual, inherited]

Implements KDChart::AbstractCoordinatePlane.

Definition at line 265 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::CartesianCoordinatePlane::axesCalcModeX(), KDChart::CartesianCoordinatePlane::axesCalcModeY(), KDChart::CartesianCoordinatePlane::calculateRawDataBoundingRect(), KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractCoordinatePlane::diagrams(), KDChart::CartesianCoordinatePlane::gridAttributes(), KDChart::GridAttributes::gridGranularitySequence(), KDChart::GridAttributes::gridStepWidth(), KDChart::GridAttributes::gridSubStepWidth(), KDChart::BarDiagram::orientation(), r, and KDChart::AbstractCartesianDiagram::referenceDiagram().

00266 {
00267 
00268     DataDimensionsList l;
00269     const AbstractCartesianDiagram* dgr
00270         = diagrams().isEmpty() ? 0 : dynamic_cast<const AbstractCartesianDiagram*> (diagrams().first() );
00271     if( dgr && dgr->referenceDiagram() )
00272         dgr = dgr->referenceDiagram();
00273         const BarDiagram *barDiagram = qobject_cast< const BarDiagram* >( dgr );
00274 
00275         // note:
00276         // It does make sense to retrieve the orientation from the first diagram. This is because
00277         // a coordinate plane can either be for horizontal *or* for vertical diagrams. Both at the
00278         // same time won't work, and thus the orientation for all diagrams is the same as for the first one.
00279         const Qt::Orientation diagramOrientation = barDiagram != 0 ? barDiagram->orientation() : Qt::Vertical;
00280 
00281     const bool diagramIsVertical = diagramOrientation == Qt::Vertical;
00282 
00283 
00284     if( dgr ){
00285         const QRectF r( calculateRawDataBoundingRect() );
00286         // note:
00287         // We do *not* access d->gridAttributesHorizontal here, but
00288         // we use the getter function, to get the global attrs, if no
00289         // special ones have been set for the respective orientation.
00290         const GridAttributes gaH( gridAttributes( Qt::Horizontal ) );
00291         const GridAttributes gaV( gridAttributes( Qt::Vertical ) );
00292         // append the first dimension: for Abscissa axes
00293         l.append(
00294             DataDimension(
00295                 r.left(), r.right(),
00296                 diagramIsVertical ? ( dgr->datasetDimension() > 1 ) : true,
00297                 axesCalcModeX(),
00298                 gaH.gridGranularitySequence(),
00299                 gaH.gridStepWidth(),
00300                 gaH.gridSubStepWidth() ) );
00301         // append the second dimension: for Ordinate axes
00302         l.append(
00303             DataDimension(
00304                 r.bottom(), r.top(),
00305                 diagramIsVertical ? true : ( dgr->datasetDimension() > 1 ),
00306                 axesCalcModeY(),
00307                 gaV.gridGranularitySequence(),
00308                 gaV.gridStepWidth(),
00309                 gaV.gridSubStepWidth() ) );
00310     }else{
00311         l.append( DataDimension() ); // This gets us the default 1..0 / 1..0 grid
00312         l.append( DataDimension() ); // shown, if there is no diagram on this plane.
00313     }
00314     return l;
00315 }

void AbstractAreaBase::getFrameLeadings ( int &  left,
int &  top,
int &  right,
int &  bottom 
) const [inherited]

Definition at line 213 of file KDChartAbstractAreaBase.cpp.

References d.

Referenced by KDChart::AbstractAreaBase::innerRect(), and KDChart::AbstractAreaWidget::paintAll().

00214 {
00215     if( d && d->frameAttributes.isVisible() ){
00216         const int padding = qMax( d->frameAttributes.padding(), 0 );
00217         left   = padding;
00218         top    = padding;
00219         right  = padding;
00220         bottom = padding;
00221     }else{
00222         left   = 0;
00223         top    = 0;
00224         right  = 0;
00225         bottom = 0;
00226     }
00227 }

QRectF CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams (  )  const [protected, inherited]

Definition at line 154 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::AbstractDiagram::dataBoundaries(), KDChart::AbstractCoordinatePlane::diagram(), and KDChart::AbstractCoordinatePlane::diagrams().

Referenced by KDChart::CartesianCoordinatePlane::adjustHorizontalRangeToData(), KDChart::CartesianCoordinatePlane::adjustRangesToData(), KDChart::CartesianCoordinatePlane::adjustVerticalRangeToData(), and KDChart::CartesianCoordinatePlane::calculateRawDataBoundingRect().

00155 {
00156     // determine unit of the rectangles of all involved diagrams:
00157     qreal minX, maxX, minY, maxY;
00158     bool bStarting = true;
00159     Q_FOREACH( const AbstractDiagram* diagram, diagrams() )
00160     {
00161         QPair<QPointF, QPointF> dataBoundariesPair = diagram->dataBoundaries();
00162         //qDebug() << "CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams()\ngets diagram->dataBoundaries: " << dataBoundariesPair.first << dataBoundariesPair.second;
00163         if ( bStarting || dataBoundariesPair.first.x()  < minX ) minX = dataBoundariesPair.first.x();
00164         if ( bStarting || dataBoundariesPair.first.y()  < minY ) minY = dataBoundariesPair.first.y();
00165         if ( bStarting || dataBoundariesPair.second.x() > maxX ) maxX = dataBoundariesPair.second.x();
00166         if ( bStarting || dataBoundariesPair.second.y() > maxY ) maxY = dataBoundariesPair.second.y();
00167         bStarting = false;
00168     }
00169     //qDebug() << "CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams()\nreturns data boundaries: " << QRectF( QPointF(minX, minY), QSizeF(maxX - minX, maxY - minY) );
00170     QRectF dataBoundingRect;
00171     dataBoundingRect.setBottomLeft( QPointF(minX, minY) );
00172     dataBoundingRect.setTopRight(   QPointF(maxX, maxY) );
00173     return dataBoundingRect;
00174 }

GridAttributes KDChart::AbstractCoordinatePlane::globalGridAttributes (  )  const [inherited]

Returns:
The grid attributes used by this coordinate plane.

See also:
setGlobalGridAttributes

CartesianCoordinatePlane::gridAttributes

Definition at line 168 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::PolarCoordinatePlane::gridAttributes(), and KDChart::CartesianCoordinatePlane::gridAttributes().

00170 {
00171     return d->gridAttributes;

const GridAttributes CartesianCoordinatePlane::gridAttributes ( Qt::Orientation  orientation  )  const [inherited]

Returns:
The attributes used for grid lines drawn in horizontal direction (or in vertical direction, resp.

).

Note:
This function always returns a valid set of grid attributes: If no special grid attributes were set foe this orientation the global attributes are returned, as returned by AbstractCoordinatePlane::globalGridAttributes.
See also:
setGridAttributes

resetGridAttributes

AbstractCoordinatePlane::globalGridAttributes

hasOwnGridAttributes

Definition at line 750 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::AbstractCoordinatePlane::globalGridAttributes(), and KDChart::CartesianCoordinatePlane::hasOwnGridAttributes().

Referenced by KDChart::CartesianCoordinatePlane::getDataDimensionsList().

00752 {
00753     if( hasOwnGridAttributes( orientation ) ){
00754         if( orientation == Qt::Horizontal )
00755             return d->gridAttributesHorizontal;
00756         else
00757             return d->gridAttributesVertical;
00758     }else{
00759         return globalGridAttributes();
00760     }
00761 }

LeveyJenningsGridAttributes LeveyJenningsCoordinatePlane::gridAttributes (  )  const

Definition at line 78 of file KDChartLeveyJenningsCoordinatePlane.cpp.

References d.

00079 {
00080     return d->gridAttributes;
00081 }

KDChart::DataDimensionsList KDChart::AbstractCoordinatePlane::gridDimensionsList (  )  [inherited]

Returns the dimensions used for drawing the grid lines.

Returned data is the result of (cached) grid calculations, so - if you need that information for your own tasks - make sure to call again this function after every data modification that has changed the data range, since grid calculation is based upon the data range, thus the grid start/end might have changed if the data was changed.

Note:
Returned list will contain different numbers of DataDimension, depending on the kind of coordinate plane used. For CartesianCoordinatePlane two DataDimension are returned: the first representing grid lines in X direction (matching the Abscissa axes) and the second indicating vertical grid lines (or Ordinate axes, resp.).
Returns:
The dimensions used for drawing the grid lines.
See also:
DataDimension

Definition at line 173 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::CartesianCoordinatePlane::layoutDiagrams().

00175 {
00176     //KDChart::DataDimensionsList l( d->grid->updateData( this ) );
00177     //qDebug() << "AbstractCoordinatePlane::gridDimensionsList() Y-range:" << l.last().end - l.last().start << "   step width:" << l.last().stepWidth;
00178     //qDebug() << "AbstractCoordinatePlane::gridDimensionsList() X-range:" << l.first().end - l.first().start << "   step width:" << l.first().stepWidth;
00179     return d->grid->updateData( this );

void CartesianCoordinatePlane::handleFixedDataCoordinateSpaceRelation ( const QRectF &  geometry  )  [protected, inherited]

Definition at line 461 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::CartesianCoordinatePlane::doneSetZoomCenter(), KDChart::CartesianCoordinatePlane::doneSetZoomFactorX(), KDChart::CartesianCoordinatePlane::doneSetZoomFactorY(), KDChart::AbstractCoordinatePlane::propertiesChanged(), KDChart::CartesianCoordinatePlane::zoomCenter(), KDChart::CartesianCoordinatePlane::zoomFactorX(), and KDChart::CartesianCoordinatePlane::zoomFactorY().

Referenced by KDChart::CartesianCoordinatePlane::layoutDiagrams().

00462 {
00463     // is the feature enabled?
00464     if( !d->fixedDataCoordinateSpaceRelation )
00465         return;
00466 
00467     // is the new geometry ok?
00468     if( geometry.height() < 1 || geometry.width() < 1 )
00469         return;
00470 
00471     // if the size was changed, we calculate new zoom settings
00472     if( d->fixedDataCoordinateSpaceRelationOldSize != geometry && !d->fixedDataCoordinateSpaceRelationOldSize.isNull() )
00473     {
00474         const double newZoomX = zoomFactorX() * d->fixedDataCoordinateSpaceRelationOldSize.width() / geometry.width();
00475         const double newZoomY = zoomFactorY() * d->fixedDataCoordinateSpaceRelationOldSize.height() / geometry.height();
00476 
00477         const QPointF oldCenter = zoomCenter();
00478         const QPointF newCenter = QPointF( oldCenter.x() * geometry.width() / d->fixedDataCoordinateSpaceRelationOldSize.width(),
00479                                            oldCenter.y() * geometry.height() / d->fixedDataCoordinateSpaceRelationOldSize.height() );
00480 
00481         // Use these internal methods to avoid sending
00482         // the propertiesChanged signal three times:
00483         bool bChanged = false;
00484         if( doneSetZoomFactorY( newZoomY ) )
00485             bChanged = true;
00486         if( doneSetZoomFactorX( newZoomX ) )
00487             bChanged = true;
00488         if( doneSetZoomCenter( newCenter ) )
00489             bChanged = true;
00490         if( bChanged ){
00491             emit propertiesChanged();
00492         }
00493     }
00494 
00495     d->fixedDataCoordinateSpaceRelationOldSize = geometry;
00496 }

bool CartesianCoordinatePlane::hasFixedDataCoordinateSpaceRelation (  )  const [inherited]

Definition at line 456 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00457 {
00458     return d->fixedDataCoordinateSpaceRelation;
00459 }

bool CartesianCoordinatePlane::hasOwnGridAttributes ( Qt::Orientation  orientation  )  const [inherited]

Returns:
Returns whether the grid attributes have been set for the respective direction via setGridAttributes( orientation ).

If false, the grid will use the global attributes set by AbstractCoordinatePlane::globalGridAttributes (or the default attributes, resp.)

See also:
setGridAttributes

resetGridAttributes

AbstractCoordinatePlane::globalGridAttributes

Definition at line 773 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by KDChart::CartesianCoordinatePlane::gridAttributes().

00775 {
00776     return
00777         ( orientation == Qt::Horizontal )
00778         ? d->hasOwnGridAttributesHorizontal
00779         : d->hasOwnGridAttributesVertical;
00780 }

QPair< qreal, qreal > CartesianCoordinatePlane::horizontalRange (  )  const [inherited]

Returns:
The largest and smallest visible horizontal value space value.

If this is not explicitly set,or if both values are the same, the plane will use the union of the dataBoundaries of all associated diagrams.

See also:
KDChart::AbstractDiagram::dataBoundaries

Definition at line 663 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00664 {
00665     return QPair<qreal, qreal>( d->horizontalMin, d->horizontalMax );
00666 }

QRect AbstractAreaBase::innerRect (  )  const [protected, inherited]

Definition at line 229 of file KDChartAbstractAreaBase.cpp.

References KDChart::AbstractAreaBase::areaGeometry(), and KDChart::AbstractAreaBase::getFrameLeadings().

Referenced by KDChart::TextArea::paintAll(), and KDChart::AbstractArea::paintAll().

00230 {
00231     int left;
00232     int top;
00233     int right;
00234     int bottom;
00235     getFrameLeadings( left, top, right, bottom );
00236     return
00237         QRect( QPoint(0,0), areaGeometry().size() )
00238             .adjusted( left, top, -right, -bottom );
00239 }

void KDChart::AbstractCoordinatePlane::internal_geometryChanged ( QRect  ,
QRect   
) [signal, inherited]

Referenced by KDChart::AbstractCoordinatePlane::setGeometry().

bool KDChart::AbstractCoordinatePlane::isEmpty (  )  const [virtual, inherited]

pure virtual in QLayoutItem

Definition at line 212 of file KDChartAbstractCoordinatePlane.cpp.

Referenced by KDChart::CartesianCoordinatePlane::layoutDiagrams().

00214 {
00215     return false; // never empty!
00216     // coordinate planes with no associated diagrams
00217     // are showing a default grid of ()1..10, 1..10) stepWidth 1

bool CartesianCoordinatePlane::isHorizontalRangeReversed (  )  const [inherited]

Returns:
Whether the horizontal range is reversed or not

Definition at line 856 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00857 {
00858     return d->reverseHorizontalPlane;
00859 }

bool KDChart::AbstractCoordinatePlane::isRubberBandZoomingEnabled (  )  const [inherited]

Returns:
Whether zooming with a rubber band using the mouse is enabled.

Definition at line 293 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00295 {
00296     return d->enableRubberBandZooming;

bool CartesianCoordinatePlane::isVerticalRangeReversed (  )  const [inherited]

Returns:
Whether the vertical range is reversed or not

Definition at line 871 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00872 {
00873     return d->reverseVerticalPlane;
00874 }

const bool KDChart::AbstractCoordinatePlane::isVisiblePoint ( const QPointF &  point  )  const [inherited]

Tests, if a point is visible on the coordinate plane.

Note:
Before calling this function the point must have been translated into coordinate plane space.

Definition at line 421 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00423 {
00424     return d->isVisiblePoint( this, point );

void CartesianCoordinatePlane::layoutDiagrams (  )  [protected, virtual, inherited]

Distribute the available space among the diagrams and axes.

Implements KDChart::AbstractCoordinatePlane.

Definition at line 373 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::AbstractCoordinatePlane::diagrams(), KDChart::CartesianCoordinatePlane::drawingArea(), KDChart::AbstractCoordinatePlane::gridDimensionsList(), KDChart::CartesianCoordinatePlane::handleFixedDataCoordinateSpaceRelation(), KDChart::AbstractCoordinatePlane::isEmpty(), KDChart::CartesianCoordinatePlane::logicalArea(), and KDChart::AbstractCoordinatePlane::update().

Referenced by KDChart::CartesianCoordinatePlane::adjustHorizontalRangeToData(), KDChart::CartesianCoordinatePlane::adjustRangesToData(), KDChart::CartesianCoordinatePlane::adjustVerticalRangeToData(), KDChart::CartesianCoordinatePlane::setAutoAdjustHorizontalRangeToData(), KDChart::CartesianCoordinatePlane::setAutoAdjustVerticalRangeToData(), KDChart::CartesianCoordinatePlane::setHorizontalRange(), KDChart::CartesianCoordinatePlane::setHorizontalRangeReversed(), KDChart::CartesianCoordinatePlane::setIsometricScaling(), KDChart::CartesianCoordinatePlane::setVerticalRange(), KDChart::CartesianCoordinatePlane::setVerticalRangeReversed(), and KDChart::CartesianCoordinatePlane::slotLayoutChanged().

00374 {
00375     if ( diagrams().isEmpty() )
00376     {   // FIXME evaluate what can still be prepared
00377         // FIXME decide default dimension if no diagrams are present (to make empty planes useable)
00378     }
00379 
00380     d->dimensions = gridDimensionsList();
00381     // test for programming errors: critical
00382     Q_ASSERT_X ( d->dimensions.count() == 2, "CartesianCoordinatePlane::layoutDiagrams",
00383                  "Error: gridDimensionsList() did not return exactly two dimensions." );
00384 
00385     // physical area of the plane
00386     const QRectF physicalArea( drawingArea() );
00387     // .. in contrast to the logical area
00388     const QRectF logArea( logicalArea() );
00389 
00390     d->coordinateTransformation.unitVectorX = logArea.width()  != 0 ? physicalArea.width()  / logArea.width()  : 1.0;
00391     d->coordinateTransformation.unitVectorY = logArea.height() != 0 ? physicalArea.height() / logArea.height() : 1.0;
00392 
00393     const double diagramXUnitInCoordinatePlane = d->coordinateTransformation.unitVectorX;
00394     const double diagramYUnitInCoordinatePlane = d->coordinateTransformation.unitVectorY;
00395 
00396     double scaleX;
00397     double scaleY;
00398 
00399     // calculate isometric scaling factor to maxscale the diagram into
00400     // the coordinate system:
00401     if ( d->isometricScaling )
00402     {
00403         double scale = qMin ( qAbs ( diagramXUnitInCoordinatePlane ),
00404                               qAbs ( diagramYUnitInCoordinatePlane ) );
00405 
00406         scaleX = qAbs( scale / diagramXUnitInCoordinatePlane );
00407         scaleY = qAbs( scale / diagramYUnitInCoordinatePlane );
00408     } else {
00409         scaleX = 1.0;
00410         scaleY = 1.0;
00411     }
00412 
00413     const QPointF logicalTopLeft = logArea.topLeft();
00414     // calculate diagram origin in plane coordinates:
00415     QPointF coordinateOrigin = QPointF ( logicalTopLeft.x() * -diagramXUnitInCoordinatePlane,
00416                                          logicalTopLeft.y() * -diagramYUnitInCoordinatePlane );
00417     coordinateOrigin += physicalArea.topLeft();
00418 
00419     d->coordinateTransformation.originTranslation = coordinateOrigin;
00420 
00421     // As in the first quadrant of the coordinate system, the origin is the bottom left, not top left.
00422     // This origin is then the top left point of the resulting diagramRect for our coordinateTransformation.
00423     const QRectF normalizedLogArea = logArea.normalized();
00424     d->coordinateTransformation.diagramRect = QRectF( normalizedLogArea.bottomLeft(), normalizedLogArea.topRight() );
00425 
00426     d->coordinateTransformation.isoScaleX = scaleX;
00427     d->coordinateTransformation.isoScaleY = scaleY;
00428 
00429     // the plane area might have changed, so the zoom values might also be changed
00430     handleFixedDataCoordinateSpaceRelation( physicalArea );
00431 
00432     update();
00433 }

void KDChart::AbstractCoordinatePlane::layoutPlanes (  )  [slot, inherited]

Calling layoutPlanes() on the plane triggers the global KDChart::Chart::slotLayoutPlanes().

Definition at line 276 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::needLayoutPlanes().

Referenced by KDChart::AbstractCoordinatePlane::addDiagram(), KDChart::CartesianAxis::layoutPlanes(), KDChart::AbstractCartesianDiagram::layoutPlanes(), KDChart::AbstractCoordinatePlane::replaceDiagram(), and KDChart::AbstractCoordinatePlane::takeDiagram().

00278 {
00279     //qDebug("KDChart::AbstractCoordinatePlane::relayout() called");
00280     emit needLayoutPlanes();

int AbstractArea::leftOverlap ( bool  doNotRecalculate = false  )  const [virtual, inherited]

This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().

The method triggers AbstractArea::sizeHint() to find out the amount of overlap at the left edge of the area.

Note:
The default implementation is not using any caching, it might make sense to implement a more sophisticated solution for derived classes that have complex work to do in sizeHint(). All we have here is a primitive flag to be set by the caller if it is sure that no sizeHint() needs to be called.

Definition at line 77 of file KDChartAbstractArea.cpp.

References d.

Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().

00078 {
00079     // Re-calculate the sizes,
00080     // so we also get the amountOf..Overlap members set newly:
00081     if( ! doNotRecalculate )
00082         sizeHint();
00083     return d->amountOfLeftOverlap;
00084 }

QRectF CartesianCoordinatePlane::logicalArea (  )  const [inherited]

Returns the logical area, i.e., the rectangle defined by the very top left and very bottom right coordinate.

Definition at line 330 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::DataDimension::distance(), KDChart::DataDimension::end, and KDChart::DataDimension::start.

Referenced by KDChart::CartesianCoordinatePlane::diagramArea(), and KDChart::CartesianCoordinatePlane::layoutDiagrams().

00331 {
00332     if ( d->dimensions.isEmpty() )
00333         return QRectF();
00334 
00335     const DataDimension dimX = d->dimensions.first();
00336     const DataDimension dimY = d->dimensions.last();
00337     const QPointF pt( qMin( dimX.start, dimX.end ), qMax( dimY.start, dimY.end ) );
00338     const QSizeF siz( qAbs( dimX.distance() ), -qAbs( dimY.distance() ) );
00339     const QRectF dataBoundingRect( pt, siz );
00340 
00341     // determine logical top left, taking the "reverse" option of
00342     // horizontal and vertical dimension into account
00343     QPointF topLeft;
00344     if( !d->reverseVerticalPlane && !d->reverseHorizontalPlane )
00345         topLeft = dataBoundingRect.topLeft();
00346     else if( d->reverseVerticalPlane && !d->reverseHorizontalPlane )
00347         topLeft = dataBoundingRect.bottomLeft();
00348     else if( d->reverseVerticalPlane && d->reverseHorizontalPlane )
00349         topLeft = dataBoundingRect.bottomRight();
00350     else if( !d->reverseVerticalPlane && d->reverseHorizontalPlane )
00351         topLeft = dataBoundingRect.topRight();
00352 
00353     const double width  = dataBoundingRect.width()  * ( d->reverseHorizontalPlane ? -1.0 : 1.0 );
00354     const double height = dataBoundingRect.height() * ( d->reverseVerticalPlane   ? -1.0 : 1.0 );
00355 
00356     return QRectF( topLeft, QSizeF( width, height ) );
00357 }

QSize KDChart::AbstractCoordinatePlane::maximumSize (  )  const [virtual, inherited]

pure virtual in QLayoutItem

Definition at line 224 of file KDChartAbstractCoordinatePlane.cpp.

Referenced by KDChart::AbstractCoordinatePlane::sizeHint().

00226 {
00227     // No maximum size set. Especially not parent()->size(), we are not layouting
00228     // to the parent widget's size when using Chart::paint()!
00229     return QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX);

QSize KDChart::AbstractCoordinatePlane::minimumSize (  )  const [virtual, inherited]

pure virtual in QLayoutItem

Definition at line 231 of file KDChartAbstractCoordinatePlane.cpp.

00233 {
00234     return QSize(60, 60); // this default can be overwritten by derived classes

QSize KDChart::AbstractCoordinatePlane::minimumSizeHint (  )  const [virtual, inherited]

[reimplemented]

Reimplemented in KDChart::TernaryCoordinatePlane.

Definition at line 151 of file KDChartAbstractCoordinatePlane.cpp.

00153 {
00154     return QSize( 200, 200 );

void KDChart::AbstractCoordinatePlane::mouseDoubleClickEvent ( QMouseEvent *  event  )  [inherited]

Definition at line 338 of file KDChartAbstractCoordinatePlane.cpp.

References d, and KDChart::AbstractCoordinatePlane::mousePressEvent().

Referenced by KDChart::Chart::mouseDoubleClickEvent().

00340 {
00341     if( event->button() == Qt::RightButton )
00342     {
00343         // othewise the second click gets lost
00344         // which is pretty annoying when zooming out fast
00345         mousePressEvent( event );
00346     }
00347     KDAB_FOREACH( AbstractDiagram * a, d->diagrams )
00348     {
00349         a->mouseDoubleClickEvent( event );
00350     }

void KDChart::AbstractCoordinatePlane::mouseMoveEvent ( QMouseEvent *  event  )  [inherited]

Definition at line 402 of file KDChartAbstractCoordinatePlane.cpp.

References d, and KDChart::AbstractCoordinatePlane::geometry().

Referenced by KDChart::Chart::mouseMoveEvent().

00404 {
00405     if( d->rubberBand != 0 )
00406     {
00407         const QRect normalized = QRect( d->rubberBandOrigin, event->pos() ).normalized();
00408         d->rubberBand->setGeometry( normalized &  geometry() );
00409 
00410         event->accept();
00411     }
00412 
00413     KDAB_FOREACH( AbstractDiagram * a, d->diagrams )
00414     {
00415         a->mouseMoveEvent( event );
00416     }

void KDChart::AbstractCoordinatePlane::mousePressEvent ( QMouseEvent *  event  )  [inherited]

Definition at line 298 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::ZoomParameters::center(), d, p, KDChart::AbstractCoordinatePlane::parent(), KDChart::AbstractCoordinatePlane::setZoomCenter(), KDChart::AbstractCoordinatePlane::setZoomFactorX(), KDChart::AbstractCoordinatePlane::setZoomFactorY(), KDChart::ZoomParameters::xFactor, and KDChart::ZoomParameters::yFactor.

Referenced by KDChart::AbstractCoordinatePlane::mouseDoubleClickEvent(), and KDChart::Chart::mousePressEvent().

00300 {
00301     if( event->button() == Qt::LeftButton )
00302     {
00303         if( d->enableRubberBandZooming && d->rubberBand == 0 )
00304             d->rubberBand = new QRubberBand( QRubberBand::Rectangle, qobject_cast< QWidget* >( parent() ) );
00305 
00306         if( d->rubberBand != 0 )
00307         {
00308             d->rubberBandOrigin = event->pos();
00309             d->rubberBand->setGeometry( QRect( event->pos(), QSize() ) );
00310             d->rubberBand->show();
00311 
00312             event->accept();
00313         }
00314     }
00315     else if( event->button() == Qt::RightButton )
00316     {
00317         if( d->enableRubberBandZooming && !d->rubberBandZoomConfigHistory.isEmpty() )
00318         {
00319             // restore the last config from the stack
00320             ZoomParameters config = d->rubberBandZoomConfigHistory.pop();
00321             setZoomFactorX( config.xFactor );
00322             setZoomFactorY( config.yFactor );
00323             setZoomCenter( config.center() );
00324 
00325             QWidget* const p = qobject_cast< QWidget* >( parent() );
00326             if( p != 0 )
00327                 p->update();
00328 
00329             event->accept();
00330         }
00331     }
00332 
00333     KDAB_FOREACH( AbstractDiagram * a, d->diagrams )
00334     {
00335         a->mousePressEvent( event );
00336     }

void KDChart::AbstractCoordinatePlane::mouseReleaseEvent ( QMouseEvent *  event  )  [inherited]

Definition at line 352 of file KDChartAbstractCoordinatePlane.cpp.

References d, KDChart::AbstractCoordinatePlane::geometry(), KDChart::AbstractCoordinatePlane::setZoomCenter(), KDChart::AbstractCoordinatePlane::setZoomFactorX(), KDChart::AbstractCoordinatePlane::setZoomFactorY(), KDChart::AbstractCoordinatePlane::zoomCenter(), KDChart::AbstractCoordinatePlane::zoomFactorX(), and KDChart::AbstractCoordinatePlane::zoomFactorY().

Referenced by KDChart::Chart::mouseReleaseEvent().

00354 {
00355     if( d->rubberBand != 0 )
00356     {
00357         // save the old config on the stack
00358         d->rubberBandZoomConfigHistory.push( ZoomParameters( zoomFactorX(), zoomFactorY(), zoomCenter() ) );
00359 
00360         // this is the height/width of the rubber band in pixel space
00361         const double rubberWidth = static_cast< double >( d->rubberBand->width() );
00362         const double rubberHeight = static_cast< double >( d->rubberBand->height() );
00363 
00364         if( rubberWidth > 0.0 && rubberHeight > 0.0 )
00365         {
00366             // this is the center of the rubber band in pixel space
00367             const double rubberCenterX = static_cast< double >( d->rubberBand->geometry().center().x() - geometry().x() );
00368             const double rubberCenterY = static_cast< double >( d->rubberBand->geometry().center().y() - geometry().y() );
00369 
00370             // this is the height/width of the plane in pixel space
00371             const double myWidth = static_cast< double >( geometry().width() );
00372             const double myHeight = static_cast< double >( geometry().height() );
00373 
00374             // this describes the new center of zooming, relative to the plane pixel space
00375             const double newCenterX = rubberCenterX / myWidth / zoomFactorX() + zoomCenter().x() - 0.5 / zoomFactorX();
00376             const double newCenterY = rubberCenterY / myHeight / zoomFactorY() + zoomCenter().y() - 0.5 / zoomFactorY();
00377 
00378             // this will be the new zoom factor
00379             const double newZoomFactorX = zoomFactorX() * myWidth / rubberWidth;
00380             const double newZoomFactorY = zoomFactorY() * myHeight / rubberHeight;
00381 
00382             // and this the new center
00383             const QPointF newZoomCenter( newCenterX, newCenterY );
00384 
00385             setZoomFactorX( newZoomFactorX );
00386             setZoomFactorY( newZoomFactorY );
00387             setZoomCenter( newZoomCenter );
00388         }
00389 
00390         d->rubberBand->parentWidget()->update();
00391         delete d->rubberBand;
00392         d->rubberBand = 0;
00393 
00394         event->accept();
00395     }
00396 
00397     KDAB_FOREACH( AbstractDiagram * a, d->diagrams )
00398     {
00399         a->mouseReleaseEvent( event );
00400     }

void KDChart::AbstractCoordinatePlane::needLayoutPlanes (  )  [signal, inherited]

Emitted when plane needs to trigger the Chart's layouting of the coord.

planes.

Referenced by KDChart::AbstractCoordinatePlane::layoutPlanes().

void KDChart::AbstractCoordinatePlane::needRelayout (  )  [signal, inherited]

Emitted when plane needs to trigger the Chart's layouting.

Referenced by KDChart::AbstractCoordinatePlane::relayout().

void KDChart::AbstractCoordinatePlane::needUpdate (  )  [signal, inherited]

Emitted when plane needs to update its drawings.

Referenced by KDChart::AbstractCoordinatePlane::update().

void CartesianCoordinatePlane::paint ( QPainter *  painter  )  [virtual, inherited]

reimpl

Implements KDChart::AbstractLayoutItem.

Definition at line 100 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::AbstractCoordinatePlane::diagrams(), KDChart::CartesianCoordinatePlane::drawingArea(), KDChart::PaintContext::setCoordinatePlane(), KDChart::PaintContext::setPainter(), and KDChart::PaintContext::setRectangle().

00101 {
00102     // prevent recursive call:
00103     //qDebug("attempt plane::paint()");
00104     if( d->bPaintIsRunning ){
00105         return;
00106     }
00107     d->bPaintIsRunning = true;
00108 
00109     //qDebug() << "start plane::paint()";
00110 
00111     AbstractDiagramList diags = diagrams();
00112     if ( !diags.isEmpty() )
00113     {
00114         PaintContext ctx;
00115         ctx.setPainter ( painter );
00116         ctx.setCoordinatePlane ( this );
00117         const QRectF drawArea( drawingArea() );
00118         ctx.setRectangle ( drawArea );
00119 
00120         // enabling clipping so that we're not drawing outside
00121         PainterSaver painterSaver( painter );
00122         QRect clipRect = drawArea.toRect().adjusted( -1, -1, 1, 1 );
00123         QRegion clipRegion( clipRect );
00124         painter->setClipRegion( clipRegion );
00125 
00126         // paint the coordinate system rulers:
00127         d->grid->drawGrid( &ctx );
00128 
00129         // paint the diagrams:
00130         for ( int i = 0; i < diags.size(); i++ )
00131         {
00132 //qDebug("  start diags[i]->paint ( &ctx );");
00133             PainterSaver diagramPainterSaver( painter );
00134             diags[i]->paint ( &ctx );
00135 //qDebug("  done: diags[i]->paint ( &ctx );");
00136         }
00137 
00138         //for debugging:
00139         //    painter->drawRect( drawArea.adjusted(4,4,-4,-4) );
00140         //    painter->drawRect( drawArea.adjusted(2,2,-2,-2) );
00141         //    painter->drawRect( drawArea );
00142     }
00143     d->bPaintIsRunning = false;
00144     //qDebug("done: plane::paint()");
00145 }

void AbstractArea::paintAll ( QPainter &  painter  )  [virtual, inherited]

Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked automatically.

Reimplemented from KDChart::AbstractLayoutItem.

Reimplemented in KDChart::TernaryAxis.

Definition at line 123 of file KDChartAbstractArea.cpp.

References KDChart::AbstractArea::areaGeometry(), d, KDChart::AbstractAreaBase::innerRect(), KDChart::AbstractLayoutItem::paint(), KDChart::AbstractAreaBase::paintBackground(), and KDChart::AbstractAreaBase::paintFrame().

Referenced by KDChart::AbstractArea::paintIntoRect().

00124 {
00125     // Paint the background and frame
00126     const QRect overlappingArea( geometry().adjusted(
00127             -d->amountOfLeftOverlap,
00128             -d->amountOfTopOverlap,
00129             d->amountOfRightOverlap,
00130             d->amountOfBottomOverlap ) );
00131     paintBackground( painter, overlappingArea );
00132     paintFrame(      painter, overlappingArea );
00133 
00134     // temporarily adjust the widget size, to be sure all content gets calculated
00135     // to fit into the inner rectangle
00136     const QRect oldGeometry( areaGeometry()  );
00137     QRect inner( innerRect() );
00138     inner.moveTo(
00139         oldGeometry.left() + inner.left(),
00140         oldGeometry.top()  + inner.top() );
00141     const bool needAdjustGeometry = oldGeometry != inner;
00142     if( needAdjustGeometry )
00143         setGeometry( inner );
00144     paint( &painter );
00145     if( needAdjustGeometry )
00146         setGeometry( oldGeometry );
00147     //qDebug() << "AbstractAreaWidget::paintAll() done.";
00148 }

void AbstractAreaBase::paintBackground ( QPainter &  painter,
const QRect &  rectangle 
) [virtual, inherited]

Definition at line 197 of file KDChartAbstractAreaBase.cpp.

References d, and KDChart::AbstractAreaBase::paintBackgroundAttributes().

Referenced by KDChart::TextArea::paintAll(), KDChart::AbstractAreaWidget::paintAll(), and KDChart::AbstractArea::paintAll().

00198 {
00199     Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()",
00200                 "Private class was not initialized!" );
00201     paintBackgroundAttributes( painter, rect, d->backgroundAttributes );
00202 }

void AbstractAreaBase::paintBackgroundAttributes ( QPainter &  painter,
const QRect &  rectangle,
const KDChart::BackgroundAttributes attributes 
) [static, inherited]

Definition at line 128 of file KDChartAbstractAreaBase.cpp.

References KDChart::BackgroundAttributes::BackgroundPixmapModeCentered, KDChart::BackgroundAttributes::BackgroundPixmapModeNone, KDChart::BackgroundAttributes::BackgroundPixmapModeScaled, KDChart::BackgroundAttributes::BackgroundPixmapModeStretched, KDChart::BackgroundAttributes::brush(), KDChart::BackgroundAttributes::isVisible(), m, KDChart::BackgroundAttributes::pixmap(), and KDChart::BackgroundAttributes::pixmapMode().

Referenced by KDChart::AbstractAreaBase::paintBackground().

00130 {
00131     if( !attributes.isVisible() ) return;
00132 
00133     /* first draw the brush (may contain a pixmap)*/
00134     if( Qt::NoBrush != attributes.brush().style() ) {
00135         KDChart::PainterSaver painterSaver( &painter );
00136         painter.setPen( Qt::NoPen );
00137         const QPointF newTopLeft( painter.deviceMatrix().map( rect.topLeft() ) );
00138         painter.setBrushOrigin( newTopLeft );
00139         painter.setBrush( attributes.brush() );
00140         painter.drawRect( rect.adjusted( 0, 0, -1, -1 ) );
00141     }
00142     /* next draw the backPixmap over the brush */
00143     if( !attributes.pixmap().isNull() &&
00144         attributes.pixmapMode() != BackgroundAttributes::BackgroundPixmapModeNone ) {
00145         QPointF ol = rect.topLeft();
00146         if( BackgroundAttributes::BackgroundPixmapModeCentered == attributes.pixmapMode() )
00147         {
00148             ol.setX( rect.center().x() - attributes.pixmap().width() / 2 );
00149             ol.setY( rect.center().y() - attributes.pixmap().height()/ 2 );
00150             painter.drawPixmap( ol, attributes.pixmap() );
00151         } else {
00152             QMatrix m;
00153             double zW = (double)rect.width()  / (double)attributes.pixmap().width();
00154             double zH = (double)rect.height() / (double)attributes.pixmap().height();
00155             switch( attributes.pixmapMode() ) {
00156             case BackgroundAttributes::BackgroundPixmapModeScaled:
00157             {
00158                 double z;
00159                 z = qMin( zW, zH );
00160                 m.scale( z, z );
00161             }
00162             break;
00163             case BackgroundAttributes::BackgroundPixmapModeStretched:
00164                 m.scale( zW, zH );
00165                 break;
00166             default:
00167                 ; // Cannot happen, previously checked
00168             }
00169             QPixmap pm = attributes.pixmap().transformed( m );
00170             ol.setX( rect.center().x() - pm.width() / 2 );
00171             ol.setY( rect.center().y() - pm.height()/ 2 );
00172             painter.drawPixmap( ol, pm );
00173         }
00174     }
00175 }

void KDChart::AbstractLayoutItem::paintCtx ( PaintContext context  )  [virtual, inherited]

Default impl: Paint the complete item using its layouted position and size.

Reimplemented in KDChart::CartesianAxis, KDChart::LeveyJenningsAxis, and KDChart::TernaryAxis.

Definition at line 78 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::paint(), and KDChart::PaintContext::painter().

00079 {
00080     if( context )
00081         paint( context->painter() );
00082 }

void KDChart::CartesianCoordinatePlane::paintEvent ( QPaintEvent *   )  [protected, inherited]

void AbstractAreaBase::paintFrame ( QPainter &  painter,
const QRect &  rectangle 
) [virtual, inherited]

Definition at line 205 of file KDChartAbstractAreaBase.cpp.

References d, and KDChart::AbstractAreaBase::paintFrameAttributes().

Referenced by KDChart::TextArea::paintAll(), KDChart::AbstractAreaWidget::paintAll(), and KDChart::AbstractArea::paintAll().

00206 {
00207     Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()",
00208                 "Private class was not initialized!" );
00209     paintFrameAttributes( painter, rect, d->frameAttributes );
00210 }

void AbstractAreaBase::paintFrameAttributes ( QPainter &  painter,
const QRect &  rectangle,
const KDChart::FrameAttributes attributes 
) [static, inherited]

Definition at line 178 of file KDChartAbstractAreaBase.cpp.

References KDChart::FrameAttributes::isVisible(), KDChart::FrameAttributes::pen(), and KDChart::PrintingParameters::scalePen().

Referenced by KDChart::AbstractAreaBase::paintFrame().

00180 {
00181 
00182     if( !attributes.isVisible() ) return;
00183 
00184     // Note: We set the brush to NoBrush explicitly here.
00185     //       Otherwise we might get a filled rectangle, so any
00186     //       previously drawn background would be overwritten by that area.
00187 
00188     const QPen   oldPen(   painter.pen() );
00189     const QBrush oldBrush( painter.brush() );
00190     painter.setPen(  PrintingParameters::scalePen( attributes.pen() ) );
00191     painter.setBrush( Qt::NoBrush );
00192     painter.drawRect( rect.adjusted( 0, 0, -1, -1 ) );
00193     painter.setBrush( oldBrush );
00194     painter.setPen( oldPen );
00195 }

void AbstractArea::paintIntoRect ( QPainter &  painter,
const QRect &  rect 
) [virtual, inherited]

Draws the background and frame, then calls paint().

In most cases there is no need to overwrite this method in a derived class, but you would overwrite AbstractLayoutItem::paint() instead.

Definition at line 111 of file KDChartAbstractArea.cpp.

References KDChart::AbstractArea::paintAll().

00112 {
00113     const QRect oldGeometry( geometry() );
00114     if( oldGeometry != rect )
00115         setGeometry( rect );
00116     painter.translate( rect.left(), rect.top() );
00117     paintAll( painter );
00118     painter.translate( -rect.left(), -rect.top() );
00119     if( oldGeometry != rect )
00120         setGeometry( oldGeometry );
00121 }

const KDChart::Chart * KDChart::AbstractCoordinatePlane::parent (  )  const [inherited]

Definition at line 201 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00203 {
00204     return d->parent;

KDChart::Chart * KDChart::AbstractCoordinatePlane::parent (  )  [inherited]

Definition at line 206 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::AbstractCoordinatePlane::mousePressEvent(), KDChart::LeveyJenningsAxis::paintAsAbscissa(), and KDChart::LeveyJenningsAxis::paintAsOrdinate().

00208 {
00209     return d->parent;

QLayout* KDChart::AbstractLayoutItem::parentLayout (  )  [inherited]

Definition at line 79 of file KDChartLayoutItems.h.

00080         {
00081             return mParentLayout;
00082         }

void KDChart::AbstractArea::positionChanged ( AbstractArea  )  [signal, inherited]

Referenced by KDChart::AbstractArea::positionHasChanged().

void AbstractArea::positionHasChanged (  )  [protected, virtual, inherited]

Reimplemented from KDChart::AbstractAreaBase.

Definition at line 155 of file KDChartAbstractArea.cpp.

References KDChart::AbstractArea::positionChanged().

00156 {
00157     emit positionChanged( this );
00158 }

void KDChart::AbstractCoordinatePlane::propertiesChanged (  )  [signal, inherited]

Emitted upon change of a property of the Coordinate Plane or any of its components.

Referenced by KDChart::CartesianCoordinatePlane::addDiagram(), KDChart::CartesianCoordinatePlane::adjustHorizontalRangeToData(), KDChart::CartesianCoordinatePlane::adjustRangesToData(), KDChart::CartesianCoordinatePlane::adjustVerticalRangeToData(), KDChart::CartesianCoordinatePlane::handleFixedDataCoordinateSpaceRelation(), KDChart::CartesianCoordinatePlane::setAutoAdjustGridToZoom(), KDChart::CartesianCoordinatePlane::setAutoAdjustHorizontalRangeToData(), KDChart::CartesianCoordinatePlane::setAutoAdjustVerticalRangeToData(), KDChart::CartesianCoordinatePlane::setAxesCalcModes(), KDChart::CartesianCoordinatePlane::setAxesCalcModeX(), KDChart::CartesianCoordinatePlane::setAxesCalcModeY(), KDChart::PolarCoordinatePlane::setGridAttributes(), KDChart::CartesianCoordinatePlane::setGridAttributes(), KDChart::CartesianCoordinatePlane::setHorizontalRange(), KDChart::CartesianCoordinatePlane::setHorizontalRangeReversed(), KDChart::CartesianCoordinatePlane::setIsometricScaling(), KDChart::CartesianCoordinatePlane::setVerticalRange(), KDChart::CartesianCoordinatePlane::setVerticalRangeReversed(), KDChart::CartesianCoordinatePlane::setZoomCenter(), KDChart::CartesianCoordinatePlane::setZoomFactors(), KDChart::CartesianCoordinatePlane::setZoomFactorX(), and KDChart::CartesianCoordinatePlane::setZoomFactorY().

AbstractCoordinatePlane * KDChart::AbstractCoordinatePlane::referenceCoordinatePlane (  )  const [inherited]

There are two ways, in which planes can be caused to interact, in where they are put layouting wise: The first is the reference plane.

If such a reference plane is set, on a plane, it will use the same cell in the layout as that one. In addition to this, planes can share an axis. In that case they will be laid out in relation to each other as suggested by the position of the axis. If, for example Plane1 and Plane2 share an axis at position Left, that will result in the layout: Axis Plane1 Plane 2, vertically. If Plane1 also happens to be Plane2's reference plane, both planes are drawn over each other. The reference plane concept allows two planes to share the same space even if neither has any axis, and in case there are shared axis, it is used to decided, whether the planes should be painted on top of each other or laid out vertically or horizontally next to each other.

Returns:
The reference coordinate plane associated with this one.

Definition at line 191 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00193 {
00194     return d->referenceCoordinatePlane;

void KDChart::AbstractCoordinatePlane::relayout (  )  [slot, inherited]

Calling relayout() on the plane triggers the global KDChart::Chart::slotRelayout().

Definition at line 270 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::needRelayout().

00272 {
00273     //qDebug("KDChart::AbstractCoordinatePlane::relayout() called");
00274     emit needRelayout();

void KDChart::AbstractLayoutItem::removeFromParentLayout (  )  [inherited]

Definition at line 83 of file KDChartLayoutItems.h.

Referenced by KDChart::Chart::takeCoordinatePlane().

00084         {
00085             if( mParentLayout ){
00086                 if( widget() )
00087                     mParentLayout->removeWidget( widget() );
00088                 else
00089                     mParentLayout->removeItem( this );
00090             }
00091         }

void AbstractCoordinatePlane::replaceDiagram ( AbstractDiagram diagram,
AbstractDiagram oldDiagram = 0 
) [virtual, inherited]

Replaces the old diagram, or appends the diagram, it there is none yet.

Parameters:
diagram The diagram to be used instead of the old diagram. This parameter must not be zero, or the method will do nothing.
oldDiagram The diagram to be removed by the new diagram. This diagram will be deleted automatically. If the parameter is omitted, the very first diagram will be replaced. In case, there was no diagram yet, the new diagram will just be added.
Note:
If you want to re-use the old diagram, call takeDiagram and addDiagram, instead of using replaceDiagram.
See also:
addDiagram, takeDiagram

Definition at line 90 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::addDiagram(), d, KDChart::AbstractCoordinatePlane::layoutDiagrams(), KDChart::AbstractCoordinatePlane::layoutPlanes(), KDChart::AbstractCoordinatePlane::takeDiagram(), and KDChart::AbstractCoordinatePlane::update().

Referenced by KDChart::Widget::setType().

00091 {
00092     if( diagram && oldDiagram_ != diagram ){
00093         AbstractDiagram* oldDiagram = oldDiagram_;
00094         if( d->diagrams.count() ){
00095             if( ! oldDiagram ){
00096                 oldDiagram = d->diagrams.first();
00097                 if( oldDiagram == diagram )
00098                     return;
00099             }
00100             takeDiagram( oldDiagram );
00101         }
00102         delete oldDiagram;
00103         addDiagram( diagram );
00104         layoutDiagrams();
00105         layoutPlanes(); // there might be new axes, etc
00106         update();
00107     }
00108 }

void CartesianCoordinatePlane::resetGridAttributes ( Qt::Orientation  orientation  )  [inherited]

Reset the attributes to be used for grid lines drawn in horizontal direction (or in vertical direction, resp.

). By calling this method you specify that the global attributes set by AbstractCoordinatePlane::setGlobalGridAttributes be used.

See also:
setGridAttributes, gridAttributes

setAutoAdjustGridToZoom

AbstractCoordinatePlane::globalGridAttributes

hasOwnGridAttributes

Definition at line 743 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::update().

00745 {
00746     setHasOwnGridAttributes( orientation, false );
00747     update();
00748 }

int AbstractArea::rightOverlap ( bool  doNotRecalculate = false  )  const [virtual, inherited]

This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().

The method triggers AbstractArea::sizeHint() to find out the amount of overlap at the right edge of the area.

Note:
The default implementation is not using any caching, it might make sense to implement a more sophisticated solution for derived classes that have complex work to do in sizeHint(). All we have here is a primitive flag to be set by the caller if it is sure that no sizeHint() needs to be called.

Definition at line 85 of file KDChartAbstractArea.cpp.

References d.

Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().

00086 {
00087     // Re-calculate the sizes,
00088     // so we also get the amountOf..Overlap members set newly:
00089     if( ! doNotRecalculate )
00090         sizeHint();
00091     return d->amountOfRightOverlap;
00092 }

void CartesianCoordinatePlane::setAutoAdjustGridToZoom ( bool  autoAdjust  )  [inherited]

Disable / re-enable the built-in grid adjusting feature.

By default additional lines will be drawn in a Linear grid when zooming in.

See also:
autoAdjustGridToZoom, setGridAttributes

Definition at line 782 of file KDChartCartesianCoordinatePlane.cpp.

References d, and KDChart::AbstractCoordinatePlane::propertiesChanged().

00783 {
00784     if( d->autoAdjustGridToZoom != autoAdjust ){
00785         d->autoAdjustGridToZoom = autoAdjust;
00786         d->grid->setNeedRecalculate();
00787         emit propertiesChanged();
00788     }
00789 }

void CartesianCoordinatePlane::setAutoAdjustHorizontalRangeToData ( unsigned int  percentEmpty = 67  )  [inherited]

Automatically adjust horizontal range settings to the ranges covered by the model's values, when ever the data have changed, and then emit horizontalRangeAutomaticallyAdjusted.

By default the horizontal range is adjusted automatically, if more than 67 percent of the available horizontal space would be empty otherwise.

Range setting is adjusted if more than percentEmpty percent of the horizontal space covered by the coordinate plane would otherwise be empty. Automatic range adjusting can happen, when either all of the data are positive or all are negative.

Set percentEmpty to 100 to disable automatic range adjusting.

Parameters:
percentEmpty The maximal percentage of horizontal space that may be empty.
See also:
horizontalRangeAutomaticallyAdjusted

autoAdjustHorizontalRangeToData, adjustRangesToData

setHorizontalRange, setVerticalRange

setAutoAdjustVerticalRangeToData

Definition at line 702 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::CartesianCoordinatePlane::layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().

00703 {
00704     d->autoAdjustHorizontalRangeToData = percentEmpty;
00705     d->horizontalMin = 0.0;
00706     d->horizontalMax = 0.0;
00707     layoutDiagrams();
00708     emit propertiesChanged();
00709 }

void CartesianCoordinatePlane::setAutoAdjustVerticalRangeToData ( unsigned int  percentEmpty = 67  )  [inherited]

Automatically adjust vertical range settings to the ranges covered by the model's values, when ever the data have changed, and then emit verticalRangeAutomaticallyAdjusted.

By default the vertical range is adjusted automatically, if more than 67 percent of the available vertical space would be empty otherwise.

Range setting is adjusted if more than percentEmpty percent of the horizontal space covered by the coordinate plane would otherwise be empty. Automatic range adjusting can happen, when either all of the data are positive or all are negative.

Set percentEmpty to 100 to disable automatic range adjusting.

Parameters:
percentEmpty The maximal percentage of horizontal space that may be empty.
See also:
verticalRangeAutomaticallyAdjusted

autoAdjustVerticalRangeToData, adjustRangesToData

setHorizontalRange, setVerticalRange

setAutoAdjustHorizontalRangeToData

Definition at line 711 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::CartesianCoordinatePlane::layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().

00712 {
00713     d->autoAdjustVerticalRangeToData = percentEmpty;
00714     d->verticalMin = 0.0;
00715     d->verticalMax = 0.0;
00716     layoutDiagrams();
00717     emit propertiesChanged();
00718 }

void CartesianCoordinatePlane::setAxesCalcModes ( AxesCalcMode  mode  )  [inherited]

Specifies the calculation modes for all axes.

Definition at line 614 of file KDChartCartesianCoordinatePlane.cpp.

References d, and KDChart::AbstractCoordinatePlane::propertiesChanged().

00615 {
00616     if( d->coordinateTransformation.axesCalcModeY != mode ||
00617         d->coordinateTransformation.axesCalcModeX != mode ){
00618         d->coordinateTransformation.axesCalcModeY = mode;
00619         d->coordinateTransformation.axesCalcModeX = mode;
00620         emit propertiesChanged();
00621     }
00622 }

void CartesianCoordinatePlane::setAxesCalcModeX ( AxesCalcMode  mode  )  [inherited]

Specifies the calculation mode for all Abscissa axes.

Definition at line 632 of file KDChartCartesianCoordinatePlane.cpp.

References d, and KDChart::AbstractCoordinatePlane::propertiesChanged().

00633 {
00634     if( d->coordinateTransformation.axesCalcModeX != mode ){
00635         d->coordinateTransformation.axesCalcModeX = mode;
00636         emit propertiesChanged();
00637     }
00638 }

void CartesianCoordinatePlane::setAxesCalcModeY ( AxesCalcMode  mode  )  [inherited]

Specifies the calculation mode for all Ordinate axes.

Definition at line 624 of file KDChartCartesianCoordinatePlane.cpp.

References d, and KDChart::AbstractCoordinatePlane::propertiesChanged().

00625 {
00626     if( d->coordinateTransformation.axesCalcModeY != mode ){
00627         d->coordinateTransformation.axesCalcModeY = mode;
00628         emit propertiesChanged();
00629     }
00630 }

void AbstractAreaBase::setBackgroundAttributes ( const BackgroundAttributes a  )  [inherited]

Definition at line 112 of file KDChartAbstractAreaBase.cpp.

References d, and KDChart::AbstractAreaBase::positionHasChanged().

00113 {
00114     if( d->backgroundAttributes == a )
00115         return;
00116 
00117     d->backgroundAttributes = a;
00118     positionHasChanged();
00119 }

void CartesianCoordinatePlane::setFixedDataCoordinateSpaceRelation ( bool  fixed  )  [inherited]

Allows to specify a fixed data-space / coordinate-space relation.

If set to true then fixed bar widths are used, so you see more bars as the window is made wider.

This allows to completely restrict the size of bars in a graph such that, upon resizing a window, the graphs coordinate plane will grow (add more ticks to x- and y-coordinates) rather than have the image grow.

Definition at line 435 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00436 {
00437     d->fixedDataCoordinateSpaceRelation = fixed;
00438     d->fixedDataCoordinateSpaceRelationOldSize = QRectF();
00439     /*
00440     //TODO(khz): We need to discuss if we want to do this:
00441     if( ! fixed ){
00442         bool bChanged = false;
00443         if( doneSetZoomFactorY( 1.0 ) )
00444             bChanged = true;
00445         if( doneSetZoomFactorX( 1.0 ) )
00446             bChanged = true;
00447         if( doneSetZoomCenter( QPointF(0.5, 0.5) ) )
00448             bChanged = true;
00449         if( bChanged ){
00450             emit propertiesChanged();
00451         }
00452     }
00453     */
00454 }

void AbstractAreaBase::setFrameAttributes ( const FrameAttributes a  )  [inherited]

Definition at line 98 of file KDChartAbstractAreaBase.cpp.

References d, and KDChart::AbstractAreaBase::positionHasChanged().

Referenced by KDChart::Legend::clone().

00099 {
00100     if( d->frameAttributes == a )
00101         return;
00102 
00103     d->frameAttributes = a;
00104     positionHasChanged();
00105 }

void CartesianCoordinatePlane::setGeometry ( const QRect &  r  )  [virtual, inherited]

reimplement from AbstractCoordinatePlane

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 888 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::diagram(), KDChart::AbstractCoordinatePlane::diagrams(), KDChart::CartesianCoordinatePlane::drawingArea(), KDChart::AbstractCoordinatePlane::geometry(), KDChart::AbstractDiagram::resize(), and KDChart::AbstractCoordinatePlane::setGeometry().

00889 {
00890     if( rectangle == geometry() )
00891         return;
00892 
00893     AbstractCoordinatePlane::setGeometry( rectangle );
00894     Q_FOREACH( AbstractDiagram* diagram, diagrams() ) {
00895         diagram->resize( drawingArea().size() );
00896     }
00897 }

void KDChart::AbstractCoordinatePlane::setGlobalGridAttributes ( const GridAttributes a  )  [inherited]

Set the grid attributes to be used by this coordinate plane.

To disable grid painting, for example, your code should like this:

 GridAttributes ga = plane->globalGridAttributes();
 ga.setGlobalGridVisible( false );
 plane->setGlobalGridAttributes( ga );
See also:
globalGridAttributes

CartesianCoordinatePlane::setGridAttributes

Definition at line 162 of file KDChartAbstractCoordinatePlane.cpp.

References d, and KDChart::AbstractCoordinatePlane::update().

00164 {
00165     d->gridAttributes = a;
00166     update();

void CartesianCoordinatePlane::setGridAttributes ( Qt::Orientation  orientation,
const GridAttributes a 
) [inherited]

Set the attributes to be used for grid lines drawn in horizontal direction (or in vertical direction, resp.

).

To disable horizontal grid painting, for example, your code should like this:

 GridAttributes ga = plane->gridAttributes( Qt::Horizontal );
 ga.setGridVisible( false );
 plane-setGridAttributes( Qt::Horizontal, ga );

Note:
setGridAttributes overwrites the global attributes that were set by AbstractCoordinatePlane::setGlobalGridAttributes. To re-activate these global attributes you can call resetGridAttributes.
See also:
resetGridAttributes, gridAttributes

setAutoAdjustGridToZoom

AbstractCoordinatePlane::setGlobalGridAttributes

hasOwnGridAttributes

Definition at line 730 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::AbstractCoordinatePlane::propertiesChanged(), and KDChart::AbstractCoordinatePlane::update().

00733 {
00734     if( orientation == Qt::Horizontal )
00735         d->gridAttributesHorizontal = a;
00736     else
00737         d->gridAttributesVertical = a;
00738     setHasOwnGridAttributes( orientation, true );
00739     update();
00740     emit propertiesChanged();
00741 }

void LeveyJenningsCoordinatePlane::setGridAttributes ( const LeveyJenningsGridAttributes attr  ) 

Definition at line 83 of file KDChartLeveyJenningsCoordinatePlane.cpp.

References d.

00084 {
00085     d->gridAttributes = attr;
00086 }

void KDChart::AbstractCoordinatePlane::setGridNeedsRecalculate (  )  [slot, inherited]

Used by the chart to clear the cached grid data.

Definition at line 181 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::Chart::resizeEvent().

00183 {
00184     d->grid->setNeedRecalculate();

void CartesianCoordinatePlane::setHorizontalRange ( const QPair< qreal, qreal > &  range  )  [inherited]

Set the boundaries of the visible value space displayed in horizontal direction.

This is also known as the horizontal viewport.

By default the horizontal range is adjusted to the range covered by the model's data, see setAutoAdjustHorizontalRangeToData for details. Calling setHorizontalRange with a valid range disables this default automatic adjusting, while on the other hand automatic adjusting will set these ranges.

To disable use of this range you can either pass an empty pair by using the default constructor QPair() or you can set both values to the same which constitutes a null range.

Note:
By default the visible data range often is larger than the range calculated from the data model (or set by setHoriz.|Vert.Range(), resp.). This is due to the built-in grid calculation feature: The visible start/end values get adjusted so that they match a main-grid line. You can turn this feature off for any of the four bounds by calling GridAttributes::setAdjustBoundsToGrid() for either the global grid-attributes or for the horizontal/vertical attrs separately.

If you use user defined vertical ranges together with logarithmic scale, only positive values are supported. If you set it to negative values, the result is undefined.

Parameters:
range a pair of values representing the smalles and the largest horizontal value space coordinate displayed.
See also:
setAutoAdjustHorizontalRangeToData, setVerticalRange

GridAttributes::setAdjustBoundsToGrid()

Definition at line 640 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::CartesianCoordinatePlane::layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().

00641 {
00642     if ( d->horizontalMin != range.first || d->horizontalMax != range.second ) {
00643         d->autoAdjustHorizontalRangeToData = 100;
00644         d->horizontalMin = range.first;
00645         d->horizontalMax = range.second;
00646         layoutDiagrams();
00647         emit propertiesChanged();
00648     }
00649 }

void CartesianCoordinatePlane::setHorizontalRangeReversed ( bool  reverse  )  [inherited]

Sets whether the horizontal range should be reversed or not, i.e.

small values to the left and large values to the right (the default) or vice versa.

Parameters:
reverse Whether the horizontal range should be reversed or not

Definition at line 846 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::CartesianCoordinatePlane::layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().

00847 {
00848     if( d->reverseHorizontalPlane == reverse )
00849         return;
00850 
00851     d->reverseHorizontalPlane = reverse;
00852     layoutDiagrams();
00853     emit propertiesChanged();
00854 }

void CartesianCoordinatePlane::setIsometricScaling ( bool  onOff  )  [inherited]

Definition at line 512 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::CartesianCoordinatePlane::layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().

00513 {
00514     if ( d->isometricScaling != onOff )
00515     {
00516         d->isometricScaling = onOff;
00517         layoutDiagrams();
00518         emit propertiesChanged();
00519     }
00520 }

void KDChart::AbstractCoordinatePlane::setParent ( KDChart::Chart parent  )  [inherited]

Called internally by KDChart::Chart.

Definition at line 196 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::Chart::addCoordinatePlane(), and KDChart::Chart::takeCoordinatePlane().

00198 {
00199     d->parent = parent;

void KDChart::AbstractLayoutItem::setParentLayout ( QLayout *  lay  )  [inherited]

Definition at line 75 of file KDChartLayoutItems.h.

00076         {
00077             mParentLayout = lay;
00078         }

void KDChart::AbstractLayoutItem::setParentWidget ( QWidget widget  )  [virtual, inherited]

Inform the item about its widget: This enables the item, to trigger that widget's update, whenever the size of the item's contents has changed.

Thus, you need to call setParentWidget on every item, that has a non-fixed size.

Definition at line 65 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::mParent.

Referenced by KDChart::HeaderFooter::setParent(), and KDChart::AbstractCartesianDiagram::takeAxis().

00066 {
00067     mParent = widget;
00068 }

void KDChart::AbstractCoordinatePlane::setReferenceCoordinatePlane ( AbstractCoordinatePlane plane  )  [inherited]

Set another coordinate plane to be used as the reference plane for this one.

Parameters:
plane The coordinate plane to be used the reference plane for this one.
See also:
referenceCoordinatePlane

Definition at line 186 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00188 {
00189     d->referenceCoordinatePlane = plane;

void KDChart::AbstractCoordinatePlane::setRubberBandZoomingEnabled ( bool  enable  )  [inherited]

Enables or disables zooming with a rubber band using the mouse.

Definition at line 282 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00284 {
00285     d->enableRubberBandZooming = enable;
00286 
00287     if( !enable && d->rubberBand != 0 )
00288     {
00289         delete d->rubberBand;
00290         d->rubberBand = 0;
00291     }

void CartesianCoordinatePlane::setVerticalRange ( const QPair< qreal, qreal > &  range  )  [inherited]

Set the boundaries of the visible value space displayed in vertical direction.

This is also known as the vertical viewport.

By default the vertical range is adjusted to the range covered by the model's data, see setAutoAdjustVerticalRangeToData for details. Calling setVerticalRange with a valid range disables this default automatic adjusting, while on the other hand automatic adjusting will set these ranges.

To disable use of this range you can either pass an empty pair by using the default constructor QPair() or you can set setting both values to the same which constitutes a null range.

Note:
By default the visible data range often is larger than the range calculated from the data model (or set by setHoriz.|Vert.Range(), resp.). This is due to the built-in grid calculation feature: The visible start/end values get adjusted so that they match a main-grid line. You can turn this feature off for any of the four bounds by calling GridAttributes::setAdjustBoundsToGrid() for either the global grid-attributes or for the horizontal/vertical attrs separately.

If you use user defined vertical ranges together with logarithmic scale, only positive values are supported. If you set it to negative values, the result is undefined.

Parameters:
range a pair of values representing the smalles and the largest vertical value space coordinate displayed.
See also:
setAutoAdjustVerticalRangeToData, setHorizontalRange

GridAttributes::setAdjustBoundsToGrid()

Definition at line 651 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::CartesianCoordinatePlane::layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().

00652 {
00653 
00654     if ( d->verticalMin != range.first || d->verticalMax != range.second ) {
00655         d->autoAdjustVerticalRangeToData = 100;
00656         d->verticalMin = range.first;
00657         d->verticalMax = range.second;
00658         layoutDiagrams();
00659         emit propertiesChanged();
00660     }
00661 }

void CartesianCoordinatePlane::setVerticalRangeReversed ( bool  reverse  )  [inherited]

Sets whether the vertical range should be reversed or not, i.e.

small values at the bottom and large values at the top (the default) or vice versa.

Parameters:
reverse Whether the vertical range should be reversed or not

Definition at line 861 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::CartesianCoordinatePlane::layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().

00862 {
00863     if( d->reverseVerticalPlane == reverse )
00864         return;
00865 
00866     d->reverseVerticalPlane = reverse;
00867     layoutDiagrams();
00868     emit propertiesChanged();
00869 }

void CartesianCoordinatePlane::setZoomCenter ( const QPointF &  center  )  [virtual, inherited]

See also:
zoomCenter, setZoomFactorX, setZoomFactorY

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 581 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::CartesianCoordinatePlane::doneSetZoomCenter(), and KDChart::AbstractCoordinatePlane::propertiesChanged().

00582 {
00583     if( doneSetZoomCenter( point ) ){
00584         emit propertiesChanged();
00585     }
00586 }

void CartesianCoordinatePlane::setZoomFactors ( double  factorX,
double  factorY 
) [virtual, inherited]

See also:
setZoomFactorX,setZoomFactorY

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 560 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::CartesianCoordinatePlane::doneSetZoomFactorX(), KDChart::CartesianCoordinatePlane::doneSetZoomFactorY(), and KDChart::AbstractCoordinatePlane::propertiesChanged().

00561 {
00562     if( doneSetZoomFactorX( factorX ) || doneSetZoomFactorY( factorY ) ){
00563         emit propertiesChanged();
00564     }
00565 }

void CartesianCoordinatePlane::setZoomFactorX ( double  factor  )  [virtual, inherited]

See also:
zoomFactorX, setZoomCenter

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 567 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::CartesianCoordinatePlane::doneSetZoomFactorX(), and KDChart::AbstractCoordinatePlane::propertiesChanged().

00568 {
00569     if( doneSetZoomFactorX( factor ) ){
00570         emit propertiesChanged();
00571     }
00572 }

void CartesianCoordinatePlane::setZoomFactorY ( double  factor  )  [virtual, inherited]

See also:
zoomFactorY, setZoomCenter

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 574 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::CartesianCoordinatePlane::doneSetZoomFactorY(), and KDChart::AbstractCoordinatePlane::propertiesChanged().

00575 {
00576     if( doneSetZoomFactorY( factor ) ){
00577         emit propertiesChanged();
00578     }
00579 }

AbstractCoordinatePlane * CartesianCoordinatePlane::sharedAxisMasterPlane ( QPainter *  p = 0  )  [virtual, inherited]

reimpl

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 799 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::AbstractCartesianDiagram::axes(), KDChart::AbstractAxis::coordinatePlane(), KDChart::AbstractCoordinatePlane::diagram(), KDChart::CartesianAxis::isAbscissa(), KDChart::CartesianAxis::isOrdinate(), p, and KDChart::CartesianCoordinatePlane::translate().

00800 {
00801     CartesianCoordinatePlane* plane = this;
00802     AbstractCartesianDiagram* diag = dynamic_cast< AbstractCartesianDiagram* >( plane->diagram() );
00803     const CartesianAxis* sharedAxis = 0;
00804     if( diag != 0 )
00805     {
00806         const CartesianAxisList axes = diag->axes();
00807         KDAB_FOREACH( const CartesianAxis* a, axes )
00808         {
00809             CartesianCoordinatePlane* p = const_cast< CartesianCoordinatePlane* >(
00810                                               dynamic_cast< const CartesianCoordinatePlane* >( a->coordinatePlane() ) );
00811             if( p != 0 && p != this )
00812             {
00813                 plane = p;
00814                 sharedAxis = a;
00815             }
00816         }
00817     }
00818 
00819     if( plane == this || painter == 0 )
00820         return plane;
00821 
00822     const QPointF zero = QPointF( 0, 0 );
00823     const QPointF tenX = QPointF( 10, 0 );
00824     const QPointF tenY = QPointF( 0, 10 );
00825 
00826 
00827     if( sharedAxis->isOrdinate() )
00828     {
00829         painter->translate( translate( zero ).x(), 0.0 );
00830         const qreal factor = (translate( tenX ) - translate( zero ) ).x() / ( plane->translate( tenX ) - plane->translate( zero ) ).x();
00831         painter->scale( factor, 1.0 );
00832         painter->translate( -plane->translate( zero ).x(), 0.0 );
00833     }
00834     if( sharedAxis->isAbscissa() )
00835     {
00836         painter->translate( 0.0, translate( zero ).y() );
00837         const qreal factor = (translate( tenY ) - translate( zero ) ).y() / ( plane->translate( tenY ) - plane->translate( zero ) ).y();
00838         painter->scale( 1.0, factor );
00839         painter->translate( 0.0, -plane->translate( zero ).y() );
00840     }
00841 
00842 
00843     return plane;
00844 }

QSize KDChart::AbstractCoordinatePlane::sizeHint (  )  const [virtual, inherited]

pure virtual in QLayoutItem

Definition at line 236 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::maximumSize().

00238 {
00239     // we return our maxiumu (which is the full size of the Chart)
00240     // even if we know the plane will be smaller
00241     return maximumSize();

void KDChart::AbstractLayoutItem::sizeHintChanged (  )  const [virtual, inherited]

Report changed size hint: ask the parent widget to recalculate the layout.

Definition at line 87 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::mParent.

Referenced by KDChart::TextLayoutItem::sizeHintAndRotatedCorners().

00088 {
00089     // This is exactly like what QWidget::updateGeometry does.
00090 //  qDebug("KDChart::AbstractLayoutItem::sizeHintChanged() called");
00091     if( mParent ) {
00092         if ( mParent->layout() )
00093             mParent->layout()->invalidate();
00094         else
00095             QApplication::postEvent( mParent, new QEvent( QEvent::LayoutRequest ) );
00096     }
00097 }

QSizePolicy KDChart::AbstractCoordinatePlane::sizePolicy (  )  const [virtual, inherited]

[reimplemented]

Reimplemented in KDChart::TernaryCoordinatePlane.

Definition at line 157 of file KDChartAbstractCoordinatePlane.cpp.

00159 {
00160     return QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );

void CartesianCoordinatePlane::slotLayoutChanged ( AbstractDiagram  )  [protected, slot, inherited]

Definition at line 148 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::CartesianCoordinatePlane::layoutDiagrams().

Referenced by KDChart::CartesianCoordinatePlane::addDiagram().

00149 {
00150     // old: if ( d->initialResizeEventReceived )
00151     layoutDiagrams();
00152 }

void AbstractCoordinatePlane::takeDiagram ( AbstractDiagram diagram  )  [virtual, inherited]

Removes the diagram from the plane, without deleting it.

The plane no longer owns the diagram, so it is the caller's responsibility to delete the diagram.

See also:
addDiagram, replaceDiagram

Definition at line 111 of file KDChartAbstractCoordinatePlane.cpp.

References d, KDChart::AbstractCoordinatePlane::layoutDiagrams(), KDChart::AbstractCoordinatePlane::layoutPlanes(), KDChart::AbstractDiagram::setCoordinatePlane(), and KDChart::AbstractCoordinatePlane::update().

Referenced by KDChart::AbstractCoordinatePlane::replaceDiagram().

00112 {
00113     const int idx = d->diagrams.indexOf( diagram );
00114     if( idx != -1 ){
00115         d->diagrams.removeAt( idx );
00116         diagram->setParent( 0 );
00117         diagram->setCoordinatePlane( 0 );
00118         disconnect( diagram, SIGNAL( modelsChanged() ), this, SLOT( layoutPlanes() ) );
00119         layoutDiagrams();
00120         update();
00121     }
00122 }

int AbstractArea::topOverlap ( bool  doNotRecalculate = false  )  const [virtual, inherited]

This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().

The method triggers AbstractArea::sizeHint() to find out the amount of overlap at the top edge of the area.

Note:
The default implementation is not using any caching, it might make sense to implement a more sophisticated solution for derived classes that have complex work to do in sizeHint(). All we have here is a primitive flag to be set by the caller if it is sure that no sizeHint() needs to be called.

Definition at line 93 of file KDChartAbstractArea.cpp.

References d.

Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().

00094 {
00095     // Re-calculate the sizes,
00096     // so we also get the amountOf..Overlap members set newly:
00097     if( ! doNotRecalculate )
00098         sizeHint();
00099     return d->amountOfTopOverlap;
00100 }

const QPointF CartesianCoordinatePlane::translate ( const QPointF &  diagramPoint  )  const [virtual, inherited]

Translate the given point in value space coordinates to a position in pixel space.

Parameters:
diagramPoint The point in value coordinates.
Returns:
The translated point.

Implements KDChart::AbstractCoordinatePlane.

Definition at line 498 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by KDChart::LeveyJenningsAxis::paintAsOrdinate(), and KDChart::CartesianCoordinatePlane::sharedAxisMasterPlane().

00499 {
00500     // Note: We do not test if the point lays inside of the data area,
00501     //       but we just apply the transformation calculations to the point.
00502     //       This allows for basic calculations done by the user, see e.g.
00503     //       the file  examples/Lines/BubbleChart/mainwindow.cpp
00504     return  d->coordinateTransformation.translate ( diagramPoint );
00505 }

const QPointF LeveyJenningsCoordinatePlane::translateBack ( const QPointF &  screenPoint  )  const [protected]

Reimplemented from KDChart::CartesianCoordinatePlane.

Definition at line 88 of file KDChartLeveyJenningsCoordinatePlane.cpp.

References KDChart::CartesianCoordinatePlane::translateBack().

00089 {
00090     return CartesianCoordinatePlane::translateBack( screenPoint );
00091 }

void KDChart::AbstractCoordinatePlane::update (  )  [slot, inherited]

Calling update() on the plane triggers the global KDChart::Chart::update().

Definition at line 264 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::needUpdate().

Referenced by KDChart::AbstractCoordinatePlane::addDiagram(), KDChart::PolarCoordinatePlane::adjustZoomAndRepaint(), KDChart::CartesianCoordinatePlane::layoutDiagrams(), KDChart::AbstractCoordinatePlane::replaceDiagram(), KDChart::PolarCoordinatePlane::resetGridAttributes(), KDChart::CartesianCoordinatePlane::resetGridAttributes(), KDChart::AbstractCoordinatePlane::setGlobalGridAttributes(), KDChart::PolarCoordinatePlane::setGridAttributes(), KDChart::CartesianCoordinatePlane::setGridAttributes(), and KDChart::AbstractCoordinatePlane::takeDiagram().

00266 {
00267     //qDebug("KDChart::AbstractCoordinatePlane::update() called");
00268     emit needUpdate();

QPair< qreal, qreal > CartesianCoordinatePlane::verticalRange (  )  const [inherited]

Returns:
The largest and smallest visible horizontal value space value.

If this is not explicitly set, or if both values are the same, the plane will use the union of the dataBoundaries of all associated diagrams.

See also:
KDChart::AbstractDiagram::dataBoundaries

Definition at line 668 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00669 {
00670     return QPair<qreal, qreal>( d->verticalMin, d->verticalMax );
00671 }

QRectF CartesianCoordinatePlane::visibleDataRange (  )  const [inherited]

Returns the currently visible data range.

Might be greater than the range of the grid.

Definition at line 876 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::CartesianCoordinatePlane::drawingArea(), and KDChart::CartesianCoordinatePlane::translateBack().

00877 {
00878     QRectF result;
00879 
00880     const QRectF drawArea = drawingArea();
00881 
00882     result.setTopLeft( translateBack( drawArea.topLeft() ) );
00883     result.setBottomRight( translateBack( drawArea.bottomRight() ) );
00884 
00885     return result;
00886 }

QRectF CartesianCoordinatePlane::visibleDiagramArea (  )  const [inherited]

Returns the visible part of the diagram area, i.e.

 diagramArea().intersected( drawingArea() ) 
See also:
diagramArea

Definition at line 368 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::CartesianCoordinatePlane::diagramArea(), and KDChart::CartesianCoordinatePlane::drawingArea().

Referenced by KDChart::Measure::sizeOfArea().

00369 {
00370     return diagramArea().intersected( drawingArea() );
00371 }

QPointF CartesianCoordinatePlane::zoomCenter (  )  const [virtual, inherited]

See also:
setZoomCenter, setZoomFactorX, setZoomFactorY

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 588 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by KDChart::CartesianCoordinatePlane::handleFixedDataCoordinateSpaceRelation().

00589 {
00590     return d->coordinateTransformation.zoom.center();
00591 }

double CartesianCoordinatePlane::zoomFactorX (  )  const [virtual, inherited]

See also:
setZoomFactorX, setZoomCenter

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 593 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by KDChart::CartesianCoordinatePlane::handleFixedDataCoordinateSpaceRelation().

00594 {
00595     return d->coordinateTransformation.zoom.xFactor;
00596 }

double CartesianCoordinatePlane::zoomFactorY (  )  const [virtual, inherited]

See also:
setZoomFactorY, setZoomCenter

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 598 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by KDChart::CartesianCoordinatePlane::handleFixedDataCoordinateSpaceRelation().

00599 {
00600     return d->coordinateTransformation.zoom.yFactor;
00601 }


Member Data Documentation

QWidget* KDChart::AbstractLayoutItem::mParent [protected, inherited]

Definition at line 93 of file KDChartLayoutItems.h.

Referenced by KDChart::AbstractLayoutItem::setParentWidget(), KDChart::TextLayoutItem::setText(), KDChart::TextLayoutItem::setTextAlignment(), KDChart::TextLayoutItem::setTextAttributes(), and KDChart::AbstractLayoutItem::sizeHintChanged().

QLayout* KDChart::AbstractLayoutItem::mParentLayout [protected, inherited]

Definition at line 94 of file KDChartLayoutItems.h.

Referenced by KDChart::AutoSpacerLayoutItem::paint().


The documentation for this class was generated from the following files:
Generated on Thu Mar 4 23:26:04 2010 for KD Chart 2 by  doxygen 1.5.4