KDChart::CartesianCoordinatePlane Class Reference

#include <KDChartCartesianCoordinatePlane.h>

Inheritance diagram for KDChart::CartesianCoordinatePlane:

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

Collaboration graph
[legend]
List of all members.

Detailed Description

Cartesian coordinate plane.

Definition at line 42 of file KDChartCartesianCoordinatePlane.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 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().
 CartesianCoordinatePlane (Chart *parent=0)
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.

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.

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().
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)
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 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 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.
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

 ~CartesianCoordinatePlane ()

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

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

Definition at line 68 of file KDChartCartesianCoordinatePlane.cpp.

00069     : AbstractCoordinatePlane ( new Private(), parent )
00070 {
00071     // this bloc left empty intentionally
00072 }

CartesianCoordinatePlane::~CartesianCoordinatePlane (  ) 

Definition at line 74 of file KDChartCartesianCoordinatePlane.cpp.

00075 {
00076     // this bloc left empty intentionally
00077 }


Member Function Documentation

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

Adds a diagram to this coordinate plane.

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

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 85 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::addDiagram(), KDChart::AbstractCoordinatePlane::diagram(), KDChart::AbstractCoordinatePlane::propertiesChanged(), and slotLayoutChanged().

00086 {
00087     Q_ASSERT_X ( dynamic_cast<AbstractCartesianDiagram*> ( diagram ),
00088                  "CartesianCoordinatePlane::addDiagram", "Only cartesian "
00089                  "diagrams can be added to a cartesian coordinate plane!" );
00090     AbstractCoordinatePlane::addDiagram ( diagram );
00091     connect ( diagram,  SIGNAL ( layoutChanged ( AbstractDiagram* ) ),
00092               SLOT ( slotLayoutChanged ( AbstractDiagram* ) ) );
00093 
00094     connect( diagram, SIGNAL( propertiesChanged() ),this, SIGNAL( propertiesChanged() ) );
00095 }

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

Definition at line 175 of file KDChartCartesianCoordinatePlane.cpp.

Referenced by calculateRawDataBoundingRect().

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

void CartesianCoordinatePlane::adjustHorizontalRangeToData (  )  [slot]

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

See also:
adjustRangesToData

Definition at line 644 of file KDChartCartesianCoordinatePlane.cpp.

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

00645 {
00646     const QRectF dataBoundingRect( getRawDataBoundingRectFromDiagrams() );
00647     d->horizontalMin = dataBoundingRect.left();
00648     d->horizontalMax = dataBoundingRect.right();
00649     layoutDiagrams();
00650     emit propertiesChanged();
00651 }

void CartesianCoordinatePlane::adjustRangesToData (  )  [slot]

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 633 of file KDChartCartesianCoordinatePlane.cpp.

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

00634 {
00635     const QRectF dataBoundingRect( getRawDataBoundingRectFromDiagrams() );
00636     d->horizontalMin = dataBoundingRect.left();
00637     d->horizontalMax = dataBoundingRect.right();
00638     d->verticalMin = dataBoundingRect.top();
00639     d->verticalMax = dataBoundingRect.bottom();
00640     layoutDiagrams();
00641     emit propertiesChanged();
00642 }

void CartesianCoordinatePlane::adjustVerticalRangeToData (  )  [slot]

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

See also:
adjustRangesToData

Definition at line 653 of file KDChartCartesianCoordinatePlane.cpp.

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

00654 {
00655     const QRectF dataBoundingRect( getRawDataBoundingRectFromDiagrams() );
00656     d->verticalMin = dataBoundingRect.bottom();
00657     d->verticalMax = dataBoundingRect.top();
00658     layoutDiagrams();
00659     emit propertiesChanged();
00660 }

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

Definition at line 90 of file KDChartAbstractAreaBase.cpp.

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

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

Implements KDChart::AbstractAreaBase.

Definition at line 150 of file KDChartAbstractArea.cpp.

Referenced by 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

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

See also:
setAutoAdjustGridToZoom

Definition at line 751 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00752 {
00753     return d->autoAdjustGridToZoom;
00754 }

unsigned int CartesianCoordinatePlane::autoAdjustHorizontalRangeToData (  )  const

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 680 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00681 {
00682     return d->autoAdjustHorizontalRangeToData;
00683 }

unsigned int CartesianCoordinatePlane::autoAdjustVerticalRangeToData (  )  const

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 685 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00686 {
00687     return d->autoAdjustVerticalRangeToData;
00688 }

CartesianCoordinatePlane::AxesCalcMode CartesianCoordinatePlane::axesCalcModeX (  )  const

Definition at line 569 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by getDataDimensionsList().

00570 {
00571     return d->coordinateTransformation.axesCalcModeX;
00572 }

CartesianCoordinatePlane::AxesCalcMode CartesianCoordinatePlane::axesCalcModeY (  )  const

Definition at line 564 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by getDataDimensionsList().

00565 {
00566     return d->coordinateTransformation.axesCalcModeY;
00567 }

BackgroundAttributes AbstractAreaBase::backgroundAttributes (  )  const [inherited]

Definition at line 120 of file KDChartAbstractAreaBase.cpp.

References d.

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

00121 {
00122     return d->backgroundAttributes;
00123 }

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::CartesianAxis::maximumSize().

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]

Definition at line 215 of file KDChartCartesianCoordinatePlane.cpp.

References adjustedToMaxEmptyInnerPercentage(), d, and getRawDataBoundingRectFromDiagrams().

Referenced by getDataDimensionsList().

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

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

Returns true if both areas have the same settings.

Definition at line 75 of file KDChartAbstractAreaBase.cpp.

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

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

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 117 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::TernaryCoordinatePlane::addDiagram(), KDChart::PolarCoordinatePlane::addDiagram(), addDiagram(), KDChart::AbstractCoordinatePlane::addDiagram(), KDChart::Widget::diagram(), getRawDataBoundingRectFromDiagrams(), KDChart::TernaryCoordinatePlane::layoutDiagrams(), KDChart::PolarCoordinatePlane::layoutDiagrams(), KDChart::AbstractCoordinatePlane::replaceDiagram(), setGeometry(), KDChart::PolarCoordinatePlane::setStartPosition(), sharedAxisMasterPlane(), and KDChart::AbstractCoordinatePlane::takeDiagram().

00118 {
00119     if ( d->diagrams.isEmpty() )
00120     {
00121         return 0;
00122     } else {
00123         return d->diagrams.first();
00124     }
00125 }

ConstAbstractDiagramList AbstractCoordinatePlane::diagrams (  )  const [inherited]

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

Definition at line 132 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00133 {
00134     ConstAbstractDiagramList list;
00135 #ifndef QT_NO_STL
00136     qCopy( d->diagrams.begin(), d->diagrams.end(), std::back_inserter( list ) );
00137 #else
00138     Q_FOREACH( AbstractDiagram * a, d->diagrams )
00139         list.push_back( a );
00140 #endif
00141     return list;
00142 }

AbstractDiagramList AbstractCoordinatePlane::diagrams (  )  [inherited]

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

Definition at line 127 of file KDChartAbstractCoordinatePlane.cpp.

References d.

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

00128 {
00129     return d->diagrams;
00130 }

bool CartesianCoordinatePlane::doesIsometricScaling (  )  const

Definition at line 489 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00490 {
00491     return d->isometricScaling;
00492 }

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

Definition at line 516 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by setZoomCenter().

00517 {
00518     const bool done = ( d->coordinateTransformation.zoom.center() != point );
00519     if( done ){
00520         d->coordinateTransformation.zoom.setCenter( point );
00521         if( d->autoAdjustGridToZoom )
00522             d->grid->setNeedRecalculate();
00523     }
00524     return done;
00525 }

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

Definition at line 494 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by setZoomFactorX().

00495 {
00496     const bool done = ( d->coordinateTransformation.zoom.xFactor != factor );
00497     if( done ){
00498         d->coordinateTransformation.zoom.xFactor = factor;
00499         if( d->autoAdjustGridToZoom )
00500             d->grid->setNeedRecalculate();
00501     }
00502     return done;
00503 }

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

Definition at line 505 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by setZoomFactorY().

00506 {
00507     const bool done = ( d->coordinateTransformation.zoom.yFactor != factor );
00508     if( done ){
00509         d->coordinateTransformation.zoom.yFactor = factor;
00510         if( d->autoAdjustGridToZoom )
00511             d->grid->setNeedRecalculate();
00512     }
00513     return done;
00514 }

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

Definition at line 310 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::AbstractArea::areaGeometry().

Referenced by layoutDiagrams(), paint(), setGeometry(), and visibleDataRange().

00311 {
00312     const QRect rect( areaGeometry() );
00313     return QRectF ( rect.left()+1, rect.top()+1, rect.width() - 3, rect.height() - 3 );
00314 }

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

pure virtual in QLayoutItem

Definition at line 212 of file KDChartAbstractCoordinatePlane.cpp.

00213 {
00214     return Qt::Vertical | Qt::Horizontal;
00215 }

FrameAttributes AbstractAreaBase::frameAttributes (  )  const [inherited]

Definition at line 106 of file KDChartAbstractAreaBase.cpp.

References d.

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

00107 {
00108     return d->frameAttributes;
00109 }

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

pure virtual in QLayoutItem

Definition at line 246 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(), and KDChart::PolarCoordinatePlane::paint().

00247 {
00248     return d->geometry;
00249 }

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

Implements KDChart::AbstractCoordinatePlane.

Definition at line 260 of file KDChartCartesianCoordinatePlane.cpp.

References axesCalcModeX(), axesCalcModeY(), calculateRawDataBoundingRect(), KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractCoordinatePlane::diagrams(), KDChartEnums::GranularitySequence_10_20, gridAttributes(), KDChart::GridAttributes::gridGranularitySequence(), KDChart::GridAttributes::gridStepWidth(), KDChart::GridAttributes::gridSubStepWidth(), and KDChart::AbstractDiagram::percentMode().

00261 {
00262 
00263     DataDimensionsList l;
00264     const AbstractCartesianDiagram* dgr
00265         = diagrams().isEmpty() ? 0 : dynamic_cast<const AbstractCartesianDiagram*> (diagrams().first() );
00266 
00267     if( dgr ){
00268         const QRectF r( calculateRawDataBoundingRect() );
00269         // note:
00270         // We do *not* access d->gridAttributesHorizontal here, but
00271         // we use the getter function, to get the global attrs, if no
00272         // special ones have been set for the respective orientation.
00273         const GridAttributes gaH( gridAttributes( Qt::Horizontal ) );
00274         const GridAttributes gaV( gridAttributes( Qt::Vertical ) );
00275         // append the first dimension: for Abscissa axes
00276         l.append(
00277             DataDimension(
00278                 r.left(), r.right(),
00279                 dgr->datasetDimension() > 1,
00280                 axesCalcModeX(),
00281                 gaH.gridGranularitySequence(),
00282                 gaH.gridStepWidth(),
00283                 gaH.gridSubStepWidth() ) );
00284         // append the second dimension: for Ordinate axes
00285         if( dgr->percentMode() )
00286             l.append(
00287                 DataDimension(
00288                     // always return 0-100 when in percentMode
00289                     0.0, 100.0,
00290                     true,
00291                     axesCalcModeY(),
00292                     KDChartEnums::GranularitySequence_10_20,
00293                     10.0 ) );
00294         else
00295             l.append(
00296                 DataDimension(
00297                     r.bottom(), r.top(),
00298                     true,
00299                     axesCalcModeY(),
00300                     gaV.gridGranularitySequence(),
00301                     gaV.gridStepWidth(),
00302                     gaV.gridSubStepWidth() ) );
00303     }else{
00304         l.append( DataDimension() ); // This gets us the default 1..0 / 1..0 grid
00305         l.append( DataDimension() ); // shown, if there is no diagram on this plane.
00306     }
00307     return l;
00308 }

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

Definition at line 212 of file KDChartAbstractAreaBase.cpp.

References d.

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

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

QRectF CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams (  )  const [protected]

Definition at line 152 of file KDChartCartesianCoordinatePlane.cpp.

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

Referenced by adjustHorizontalRangeToData(), adjustRangesToData(), adjustVerticalRangeToData(), and calculateRawDataBoundingRect().

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

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

Returns:
The grid attributes used by this coordinate plane.

See also:
setGlobalGridAttributes

CartesianCoordinatePlane::gridAttributes

Definition at line 161 of file KDChartAbstractCoordinatePlane.cpp.

References d.

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

00162 {
00163     return d->gridAttributes;
00164 }

const GridAttributes CartesianCoordinatePlane::gridAttributes ( Qt::Orientation  orientation  )  const

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 710 of file KDChartCartesianCoordinatePlane.cpp.

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

Referenced by getDataDimensionsList().

00712 {
00713     if( hasOwnGridAttributes( orientation ) ){
00714         if( orientation == Qt::Horizontal )
00715             return d->gridAttributesHorizontal;
00716         else
00717             return d->gridAttributesVertical;
00718     }else{
00719         return globalGridAttributes();
00720     }
00721 }

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 166 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by layoutDiagrams(), and KDChart::CartesianAxis::maximumSize().

00167 {
00168     //KDChart::DataDimensionsList l( d->grid->updateData( this ) );
00169     //qDebug() << "AbstractCoordinatePlane::gridDimensionsList() Y-range:" << l.last().end - l.last().start << "   step width:" << l.last().stepWidth;
00170     //qDebug() << "AbstractCoordinatePlane::gridDimensionsList() X-range:" << l.first().end - l.first().start << "   step width:" << l.first().stepWidth;
00171     return d->grid->updateData( this );
00172 }

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

Definition at line 437 of file KDChartCartesianCoordinatePlane.cpp.

References d, setZoomCenter(), setZoomFactorX(), setZoomFactorY(), zoomCenter(), zoomFactorX(), and zoomFactorY().

Referenced by layoutDiagrams().

00438 {
00439     // is the feature enabled?
00440     if( !d->fixedDataCoordinateSpaceRelation )
00441         return;
00442 
00443     // is the new geometry ok?
00444     if( geometry.height() < 1 || geometry.width() < 1 )
00445         return;
00446 
00447     // if the size was changed, we calculate new zoom settings
00448     if( d->fixedDataCoordinateSpaceRelationOldSize != geometry && !d->fixedDataCoordinateSpaceRelationOldSize.isNull() )
00449     {
00450         const double newZoomX = zoomFactorX() * d->fixedDataCoordinateSpaceRelationOldSize.width() / geometry.width();
00451         const double newZoomY = zoomFactorY() * d->fixedDataCoordinateSpaceRelationOldSize.height() / geometry.height();
00452 
00453         const QPointF oldCenter = zoomCenter();
00454         const QPointF newCenter = QPointF( oldCenter.x() * geometry.width() / d->fixedDataCoordinateSpaceRelationOldSize.width(),
00455                                            oldCenter.y() * geometry.height() / d->fixedDataCoordinateSpaceRelationOldSize.height() );
00456 
00457         setZoomCenter( newCenter );
00458         setZoomFactorX( newZoomX );
00459         setZoomFactorY( newZoomY );
00460     }
00461 
00462     d->fixedDataCoordinateSpaceRelationOldSize = geometry;
00463 }

bool CartesianCoordinatePlane::hasFixedDataCoordinateSpaceRelation (  )  const

Definition at line 432 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00433 {
00434     return d->fixedDataCoordinateSpaceRelation;
00435 }

bool CartesianCoordinatePlane::hasOwnGridAttributes ( Qt::Orientation  orientation  )  const

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 733 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by gridAttributes().

00735 {
00736     return
00737         ( orientation == Qt::Horizontal )
00738         ? d->hasOwnGridAttributesHorizontal
00739         : d->hasOwnGridAttributesVertical;
00740 }

QPair< qreal, qreal > CartesianCoordinatePlane::horizontalRange (  )  const

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

If this is not explicitely 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 623 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00624 {
00625     return QPair<qreal, qreal>( d->horizontalMin, d->horizontalMax );
00626 }

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

Definition at line 228 of file KDChartAbstractAreaBase.cpp.

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

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

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

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

pure virtual in QLayoutItem

Definition at line 205 of file KDChartAbstractCoordinatePlane.cpp.

Referenced by layoutDiagrams().

00206 {
00207     return false; // never empty!
00208     // coordinate planes with no associated diagrams
00209     // are showing a default grid of ()1..10, 1..10) stepWidth 1
00210 }

bool CartesianCoordinatePlane::isHorizontalRangeReversed (  )  const

Returns:
Whether the horizontal range is reversed or not

Definition at line 813 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00814 {
00815     return d->reverseHorizontalPlane;
00816 }

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

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

Definition at line 280 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00281 {
00282     return d->enableRubberBandZooming;
00283 }

bool CartesianCoordinatePlane::isVerticalRangeReversed (  )  const

Returns:
Whether the vertical range is reversed or not

Definition at line 828 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00829 {
00830     return d->reverseVerticalPlane;
00831 }

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 403 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00404 {
00405     return d->isVisiblePoint( this, point );
00406 }

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

Distribute the available space among the diagrams and axes.

Implements KDChart::AbstractCoordinatePlane.

Definition at line 317 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::AbstractCoordinatePlane::diagrams(), KDChart::DataDimension::distance(), drawingArea(), KDChart::DataDimension::end, KDChart::AbstractCoordinatePlane::gridDimensionsList(), handleFixedDataCoordinateSpaceRelation(), KDChart::AbstractCoordinatePlane::isEmpty(), KDChart::DataDimension::start, translate(), and KDChart::AbstractCoordinatePlane::update().

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

00318 {
00319     //qDebug("CartesianCoordinatePlane::layoutDiagrams() called");
00320     if ( diagrams().isEmpty() )
00321     {   // FIXME evaluate what can still be prepared
00322         // FIXME decide default dimension if no diagrams are present (to make empty planes useable)
00323     }
00324     // the rectangle the diagrams cover in the *plane*:
00325     // (Why -3? We save 1px on each side for the antialiased drawing, and
00326     // respect the way QPainter calculates the width of a painted rect (the
00327     // size is the rectangle size plus the pen width). This way, most clipping
00328     // for regular pens should be avoided. When pens with a penWidth or larger
00329     // than 1 are used, this may not be sufficient.
00330     const QRectF drawArea( drawingArea() );
00331     //qDebug() << "drawingArea() returns" << drawArea;
00332 
00333     const DataDimensionsList dimensions( gridDimensionsList() );
00334     // test for programming errors: critical
00335     Q_ASSERT_X ( dimensions.count() == 2, "CartesianCoordinatePlane::layoutDiagrams",
00336                  "Error: gridDimensionsList() did not return exactly two dimensions." );
00337     const DataDimension dimX = dimensions.first();
00338     const DataDimension dimY = dimensions.last();
00339     const qreal distX = dimX.distance();
00340     const qreal distY = dimY.distance();
00341     //qDebug() << distX << distY;
00342     const QPointF pt(qMin(dimX.start, dimX.end), qMax(dimY.start, dimY.end));
00343     const QSizeF siz( qAbs(distX), -qAbs(distY) );
00344     const QRectF dataBoundingRect( pt, siz );
00345     //qDebug() << "dataBoundingRect" << dataBoundingRect;
00346 
00347     // calculate the remaining rectangle, and use it as the diagram area:
00348     QRectF diagramArea = drawArea;
00349     diagramArea.setTopLeft ( QPointF ( drawArea.left(), drawArea.top() ) );
00350     diagramArea.setBottomRight ( QPointF ( drawArea.right(), drawArea.bottom() ) );
00351 
00352     // determine coordinate transformation:
00353     QPointF diagramTopLeft;
00354     if( !d->reverseVerticalPlane && !d->reverseHorizontalPlane )
00355         diagramTopLeft = dataBoundingRect.topLeft();
00356     else if( d->reverseVerticalPlane && !d->reverseHorizontalPlane )
00357         diagramTopLeft = dataBoundingRect.bottomLeft();
00358     else if( d->reverseVerticalPlane && d->reverseHorizontalPlane )
00359         diagramTopLeft = dataBoundingRect.bottomRight();
00360     else if( !d->reverseVerticalPlane && d->reverseHorizontalPlane )
00361         diagramTopLeft = dataBoundingRect.topRight();
00362 
00363     double diagramWidth;
00364     if( !d->reverseHorizontalPlane )
00365         diagramWidth = dataBoundingRect.width();
00366     else
00367         diagramWidth = -dataBoundingRect.width();
00368 
00369     double diagramHeight;
00370     if( !d->reverseVerticalPlane )
00371         diagramHeight = dataBoundingRect.height();
00372     else
00373         diagramHeight = -dataBoundingRect.height();
00374 
00375     double planeWidth = diagramArea.width();
00376     double planeHeight = diagramArea.height();
00377     double scaleX;
00378     double scaleY;
00379 
00380     double diagramXUnitInCoordinatePlane;
00381     double diagramYUnitInCoordinatePlane;
00382 
00383     diagramXUnitInCoordinatePlane = diagramWidth != 0 ? planeWidth / diagramWidth : 1;
00384     diagramYUnitInCoordinatePlane = diagramHeight != 0 ? planeHeight / diagramHeight : 1;
00385     // calculate isometric scaling factor to maxscale the diagram into
00386     // the coordinate system:
00387     if ( d->isometricScaling )
00388     {
00389         double scale = qMin ( qAbs ( diagramXUnitInCoordinatePlane ),
00390                               qAbs ( diagramYUnitInCoordinatePlane ) );
00391 
00392         scaleX = qAbs( scale / diagramXUnitInCoordinatePlane );
00393         scaleY = qAbs( scale / diagramYUnitInCoordinatePlane );
00394     } else {
00395         scaleX = 1.0;
00396         scaleY = 1.0;
00397     }
00398 
00399     // calculate diagram origin in plane coordinates:
00400     QPointF coordinateOrigin = QPointF (
00401             diagramTopLeft.x() * -diagramXUnitInCoordinatePlane,
00402     diagramTopLeft.y() * -diagramYUnitInCoordinatePlane );
00403     coordinateOrigin += diagramArea.topLeft();
00404 
00405     d->coordinateTransformation.originTranslation = coordinateOrigin;
00406 
00407     d->coordinateTransformation.diagramRect = dataBoundingRect;
00408 
00409     d->coordinateTransformation.unitVectorX = diagramXUnitInCoordinatePlane;
00410     d->coordinateTransformation.unitVectorY = diagramYUnitInCoordinatePlane;
00411 
00412     d->coordinateTransformation.isoScaleX = scaleX;
00413     d->coordinateTransformation.isoScaleY = scaleY;
00414 
00415     //      adapt diagram area to effect of isometric scaling:
00416     diagramArea.setTopLeft( translate ( dataBoundingRect.topLeft() ) );
00417     diagramArea.setBottomRight ( translate ( dataBoundingRect.bottomRight() ) );
00418 
00419     // the plane area might have changed, so the zoom values might also be changed
00420     handleFixedDataCoordinateSpaceRelation( drawArea );
00421 
00422     //qDebug("CartesianCoordinatePlane::layoutDiagrams() done,\ncalling update() now:");
00423     update();
00424 }

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

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

Definition at line 263 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::needLayoutPlanes().

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

00264 {
00265     //qDebug("KDChart::AbstractCoordinatePlane::relayout() called");
00266     emit needLayoutPlanes();
00267 }

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::CartesianAxis::maximumSize().

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 }

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

pure virtual in QLayoutItem

Definition at line 217 of file KDChartAbstractCoordinatePlane.cpp.

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

00218 {
00219     // No maximum size set. Especially not parent()->size(), we are not layouting
00220     // to the parent widget's size when using Chart::paint()!
00221     return QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX);
00222 }

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

pure virtual in QLayoutItem

Definition at line 224 of file KDChartAbstractCoordinatePlane.cpp.

00225 {
00226     return QSize(60, 60); // this default can be overwritten by derived classes
00227 }

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

[reimplemented]

Reimplemented in KDChart::TernaryCoordinatePlane.

Definition at line 144 of file KDChartAbstractCoordinatePlane.cpp.

00145 {
00146     return QSize( 200, 200 );
00147 }

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

Definition at line 325 of file KDChartAbstractCoordinatePlane.cpp.

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

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

00326 {
00327     if( event->button() == Qt::RightButton )
00328     {
00329         // othewise the second click gets lost
00330         // which is pretty annoying when zooming out fast
00331         mousePressEvent( event );
00332     }
00333     KDAB_FOREACH( AbstractDiagram * a, d->diagrams )
00334     {
00335         a->mouseDoubleClickEvent( event );
00336     }
00337 }

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

Definition at line 387 of file KDChartAbstractCoordinatePlane.cpp.

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

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

00388 {
00389     if( d->rubberBand != 0 )
00390     {
00391         const QRect normalized = QRect( d->rubberBandOrigin, event->pos() ).normalized();
00392         d->rubberBand->setGeometry( normalized &  geometry() );
00393 
00394         event->accept();
00395     }
00396 
00397     KDAB_FOREACH( AbstractDiagram * a, d->diagrams )
00398     {
00399         a->mouseMoveEvent( event );
00400     }
00401 }

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

Definition at line 285 of file KDChartAbstractCoordinatePlane.cpp.

References d, KDChart::AbstractCoordinatePlane::parent(), KDChart::AbstractCoordinatePlane::setZoomCenter(), KDChart::AbstractCoordinatePlane::setZoomFactorX(), and KDChart::AbstractCoordinatePlane::setZoomFactorY().

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

00286 {
00287     if( event->button() == Qt::LeftButton )
00288     {
00289         if( d->enableRubberBandZooming && d->rubberBand == 0 )
00290             d->rubberBand = new QRubberBand( QRubberBand::Rectangle, qobject_cast< QWidget* >( parent() ) );
00291 
00292         if( d->rubberBand != 0 )
00293         {
00294             d->rubberBandOrigin = event->pos();
00295             d->rubberBand->setGeometry( QRect( event->pos(), QSize() ) );
00296             d->rubberBand->show();
00297 
00298             event->accept();
00299         }
00300     }
00301     else if( event->button() == Qt::RightButton )
00302     {
00303         if( d->enableRubberBandZooming && !d->rubberBandZoomConfigHistory.isEmpty() )
00304         {
00305             // restore the last config from the stack
00306             ZoomParameters config = d->rubberBandZoomConfigHistory.pop();
00307             setZoomFactorX( config.xFactor );
00308             setZoomFactorY( config.yFactor );
00309             setZoomCenter( config.center() );
00310 
00311             QWidget* const p = qobject_cast< QWidget* >( parent() );
00312             if( p != 0 )
00313                 p->update();
00314 
00315             event->accept();
00316         }
00317     }
00318 
00319     KDAB_FOREACH( AbstractDiagram * a, d->diagrams )
00320     {
00321         a->mousePressEvent( event );
00322     }
00323 }

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

Definition at line 339 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().

00340 {
00341     if( d->rubberBand != 0 )
00342     {
00343         // save the old config on the stack
00344         d->rubberBandZoomConfigHistory.push( ZoomParameters( zoomFactorX(), zoomFactorY(), zoomCenter() ) );
00345 
00346         // this is the height/width of the rubber band in pixel space
00347         const double rubberWidth = static_cast< double >( d->rubberBand->width() );
00348         const double rubberHeight = static_cast< double >( d->rubberBand->height() );
00349 
00350         // this is the center of the rubber band in pixel space
00351         const double rubberCenterX = static_cast< double >( d->rubberBand->geometry().center().x() - geometry().x() );
00352         const double rubberCenterY = static_cast< double >( d->rubberBand->geometry().center().y() - geometry().y() );
00353 
00354         // this is the height/width of the plane in pixel space
00355         const double myWidth = static_cast< double >( geometry().width() );
00356         const double myHeight = static_cast< double >( geometry().height() );
00357 
00358         // this describes the new center of zooming, relative to the plane pixel space
00359         const double newCenterX = rubberCenterX / myWidth / zoomFactorX() + zoomCenter().x() - 0.5 / zoomFactorX();
00360         const double newCenterY = rubberCenterY / myHeight / zoomFactorY() + zoomCenter().y() - 0.5 / zoomFactorY();
00361 
00362         // this will be the new zoom factor
00363         const double newZoomFactorX = zoomFactorX() * myWidth / rubberWidth;
00364         const double newZoomFactorY = zoomFactorY() * myHeight / rubberHeight;
00365 
00366         // and this the new center
00367         const QPointF newZoomCenter( newCenterX, newCenterY );
00368 
00369         setZoomFactorX( newZoomFactorX );
00370         setZoomFactorY( newZoomFactorY );
00371         setZoomCenter( newZoomCenter );
00372 
00373 
00374         d->rubberBand->parentWidget()->update();
00375         delete d->rubberBand;
00376         d->rubberBand = 0;
00377 
00378         event->accept();
00379     }
00380 
00381     KDAB_FOREACH( AbstractDiagram * a, d->diagrams )
00382     {
00383         a->mouseReleaseEvent( event );
00384     }
00385 }

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 *   )  [virtual]

reimpl

Implements KDChart::AbstractLayoutItem.

Definition at line 98 of file KDChartCartesianCoordinatePlane.cpp.

References d, KDChart::AbstractCoordinatePlane::diagrams(), and drawingArea().

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

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 196 of file KDChartAbstractAreaBase.cpp.

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

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

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

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

Definition at line 127 of file KDChartAbstractAreaBase.cpp.

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

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

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

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

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

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

Definition at line 77 of file KDChartLayoutItems.cpp.

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

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

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

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

Definition at line 204 of file KDChartAbstractAreaBase.cpp.

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

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

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

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

Definition at line 177 of file KDChartAbstractAreaBase.cpp.

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

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

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

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 194 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00195 {
00196     return d->parent;
00197 }

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

Definition at line 199 of file KDChartAbstractCoordinatePlane.cpp.

References d.

Referenced by KDChart::AbstractCoordinatePlane::AbstractCoordinatePlane(), KDChart::CartesianAxis::maximumSize(), KDChart::AbstractCoordinatePlane::mousePressEvent(), and KDChart::AbstractCoordinatePlane::setParent().

00200 {
00201     return d->parent;
00202 }

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

Definition at line 76 of file KDChartLayoutItems.h.

00077         {
00078             return mParentLayout;
00079         }

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 addDiagram(), adjustHorizontalRangeToData(), adjustRangesToData(), adjustVerticalRangeToData(), setAutoAdjustGridToZoom(), setAutoAdjustHorizontalRangeToData(), setAutoAdjustVerticalRangeToData(), setAxesCalcModes(), setAxesCalcModeX(), setAxesCalcModeY(), KDChart::PolarCoordinatePlane::setGridAttributes(), setGridAttributes(), setHorizontalRange(), setHorizontalRangeReversed(), setIsometricScaling(), setVerticalRange(), setVerticalRangeReversed(), setZoomCenter(), setZoomFactorX(), and 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 layed 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 layed out vertically or horizontally next to each other.

Returns:
The reference coordinate plane associated with this one.

Definition at line 184 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00185 {
00186     return d->referenceCoordinatePlane;
00187 }

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

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

Definition at line 257 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::needRelayout().

00258 {
00259     //qDebug("KDChart::AbstractCoordinatePlane::relayout() called");
00260     emit needRelayout();
00261 }

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

Definition at line 80 of file KDChartLayoutItems.h.

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

00081         {
00082             if( mParentLayout ){
00083                 if( widget() )
00084                     mParentLayout->removeWidget( widget() );
00085                 else
00086                     mParentLayout->removeItem( this );
00087             }
00088         }

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 86 of file KDChartAbstractCoordinatePlane.cpp.

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

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

00087 {
00088     if( diagram && oldDiagram_ != diagram ){
00089         AbstractDiagram* oldDiagram = oldDiagram_;
00090         if( d->diagrams.count() ){
00091             if( ! oldDiagram )
00092                 oldDiagram = d->diagrams.first();
00093             takeDiagram( oldDiagram );
00094         }
00095         delete oldDiagram;
00096         addDiagram( diagram );
00097         layoutDiagrams();
00098         layoutPlanes(); // there might be new axes, etc
00099         update();
00100     }
00101 }

void CartesianCoordinatePlane::resetGridAttributes ( Qt::Orientation  orientation  ) 

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 703 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::update().

00705 {
00706     setHasOwnGridAttributes( orientation, false );
00707     update();
00708 }

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::CartesianAxis::maximumSize().

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  ) 

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 742 of file KDChartCartesianCoordinatePlane.cpp.

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

00743 {
00744     if( d->autoAdjustGridToZoom != autoAdjust ){
00745         d->autoAdjustGridToZoom = autoAdjust;
00746         d->grid->setNeedRecalculate();
00747         emit propertiesChanged();
00748     }
00749 }

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

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 662 of file KDChartCartesianCoordinatePlane.cpp.

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

00663 {
00664     d->autoAdjustHorizontalRangeToData = percentEmpty;
00665     d->horizontalMin = 0.0;
00666     d->horizontalMax = 0.0;
00667     layoutDiagrams();
00668     emit propertiesChanged();
00669 }

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

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 671 of file KDChartCartesianCoordinatePlane.cpp.

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

00672 {
00673     d->autoAdjustVerticalRangeToData = percentEmpty;
00674     d->verticalMin = 0.0;
00675     d->verticalMax = 0.0;
00676     layoutDiagrams();
00677     emit propertiesChanged();
00678 }

void CartesianCoordinatePlane::setAxesCalcModes ( AxesCalcMode  mode  ) 

Specifies the calculation modes for all axes.

Definition at line 574 of file KDChartCartesianCoordinatePlane.cpp.

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

00575 {
00576     if( d->coordinateTransformation.axesCalcModeY != mode ||
00577         d->coordinateTransformation.axesCalcModeX != mode ){
00578         d->coordinateTransformation.axesCalcModeY = mode;
00579         d->coordinateTransformation.axesCalcModeX = mode;
00580         emit propertiesChanged();
00581     }
00582 }

void CartesianCoordinatePlane::setAxesCalcModeX ( AxesCalcMode  mode  ) 

Specifies the calculation mode for all Abscissa axes.

Definition at line 592 of file KDChartCartesianCoordinatePlane.cpp.

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

00593 {
00594     if( d->coordinateTransformation.axesCalcModeX != mode ){
00595         d->coordinateTransformation.axesCalcModeX = mode;
00596         emit propertiesChanged();
00597     }
00598 }

void CartesianCoordinatePlane::setAxesCalcModeY ( AxesCalcMode  mode  ) 

Specifies the calculation mode for all Ordinate axes.

Definition at line 584 of file KDChartCartesianCoordinatePlane.cpp.

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

00585 {
00586     if( d->coordinateTransformation.axesCalcModeY != mode ){
00587         d->coordinateTransformation.axesCalcModeY = mode;
00588         emit propertiesChanged();
00589     }
00590 }

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

Definition at line 111 of file KDChartAbstractAreaBase.cpp.

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

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

void CartesianCoordinatePlane::setFixedDataCoordinateSpaceRelation ( bool  fixed  ) 

Definition at line 426 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00427 {
00428     d->fixedDataCoordinateSpaceRelation = fixed;
00429     d->fixedDataCoordinateSpaceRelationOldSize = QRectF();
00430 }

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

Definition at line 97 of file KDChartAbstractAreaBase.cpp.

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

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

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

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

reimplement from AbstractCoordinatePlane

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 845 of file KDChartCartesianCoordinatePlane.cpp.

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

00846 {
00847     AbstractCoordinatePlane::setGeometry( rectangle );
00848     Q_FOREACH( AbstractDiagram* diagram, diagrams() ) {
00849         diagram->resize( drawingArea().size() );
00850     }
00851 }

void KDChart::AbstractCoordinatePlane::setGlobalGridAttributes ( const GridAttributes  )  [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 155 of file KDChartAbstractCoordinatePlane.cpp.

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

00156 {
00157     d->gridAttributes = a;
00158     update();
00159 }

void CartesianCoordinatePlane::setGridAttributes ( Qt::Orientation  orientation,
const GridAttributes  
)

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 690 of file KDChartCartesianCoordinatePlane.cpp.

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

00693 {
00694     if( orientation == Qt::Horizontal )
00695         d->gridAttributesHorizontal = a;
00696     else
00697         d->gridAttributesVertical = a;
00698     setHasOwnGridAttributes( orientation, true );
00699     update();
00700     emit propertiesChanged();
00701 }

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

Used by the chart to clear the cached grid data.

Definition at line 174 of file KDChartAbstractCoordinatePlane.cpp.

References d.

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

00175 {
00176     d->grid->setNeedRecalculate();
00177 }

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

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.
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 600 of file KDChartCartesianCoordinatePlane.cpp.

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

00601 {
00602     if ( d->horizontalMin != range.first || d->horizontalMax != range.second ) {
00603         d->autoAdjustHorizontalRangeToData = 100;
00604         d->horizontalMin = range.first;
00605         d->horizontalMax = range.second;
00606         layoutDiagrams();
00607         emit propertiesChanged();
00608     }
00609 }

void CartesianCoordinatePlane::setHorizontalRangeReversed ( bool  reverse  ) 

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 803 of file KDChartCartesianCoordinatePlane.cpp.

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

00804 {
00805     if( d->reverseHorizontalPlane == reverse )
00806         return;
00807 
00808     d->reverseHorizontalPlane = reverse;
00809     layoutDiagrams();
00810     emit propertiesChanged();
00811 }

void CartesianCoordinatePlane::setIsometricScaling ( bool  onOff  ) 

Definition at line 479 of file KDChartCartesianCoordinatePlane.cpp.

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

00480 {
00481     if ( d->isometricScaling != onOff )
00482     {
00483         d->isometricScaling = onOff;
00484         layoutDiagrams();
00485         emit propertiesChanged();
00486     }
00487 }

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

Called internally by KDChart::Chart.

Definition at line 189 of file KDChartAbstractCoordinatePlane.cpp.

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

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

00190 {
00191     d->parent = parent;
00192 }

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

Definition at line 72 of file KDChartLayoutItems.h.

00073         {
00074             mParentLayout = lay;
00075         }

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 64 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::mParent.

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

00065 {
00066     mParent = widget;
00067 }

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 179 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00180 {
00181     d->referenceCoordinatePlane = plane;
00182 }

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

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

Definition at line 269 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00270 {
00271     d->enableRubberBandZooming = enable;
00272 
00273     if( !enable && d->rubberBand != 0 )
00274     {
00275         delete d->rubberBand;
00276         d->rubberBand = 0;
00277     }
00278 }

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

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.
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 611 of file KDChartCartesianCoordinatePlane.cpp.

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

00612 {
00613 
00614     if ( d->verticalMin != range.first || d->verticalMax != range.second ) {
00615         d->autoAdjustVerticalRangeToData = 100;
00616         d->verticalMin = range.first;
00617         d->verticalMax = range.second;
00618         layoutDiagrams();
00619         emit propertiesChanged();
00620     }
00621 }

void CartesianCoordinatePlane::setVerticalRangeReversed ( bool  reverse  ) 

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 818 of file KDChartCartesianCoordinatePlane.cpp.

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

00819 {
00820     if( d->reverseVerticalPlane == reverse )
00821         return;
00822 
00823     d->reverseVerticalPlane = reverse;
00824     layoutDiagrams();
00825     emit propertiesChanged();
00826 }

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

See also:
zoomCenter, setZoomFactorX, setZoomFactorY

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 541 of file KDChartCartesianCoordinatePlane.cpp.

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

Referenced by handleFixedDataCoordinateSpaceRelation().

00542 {
00543     if( doneSetZoomCenter( point ) ){
00544         emit propertiesChanged();
00545     }
00546 }

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

See also:
zoomFactorX, setZoomCenter

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 527 of file KDChartCartesianCoordinatePlane.cpp.

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

Referenced by handleFixedDataCoordinateSpaceRelation().

00528 {
00529     if( doneSetZoomFactorX( factor ) ){
00530         emit propertiesChanged();
00531     }
00532 }

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

See also:
zoomFactorY, setZoomCenter

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 534 of file KDChartCartesianCoordinatePlane.cpp.

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

Referenced by handleFixedDataCoordinateSpaceRelation().

00535 {
00536     if( doneSetZoomFactorY( factor ) ){
00537         emit propertiesChanged();
00538     }
00539 }

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

reimpl

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 756 of file KDChartCartesianCoordinatePlane.cpp.

References KDChart::AbstractCartesianDiagram::axes(), KDChart::AbstractAxis::coordinatePlane(), KDChart::AbstractCoordinatePlane::diagram(), and translate().

00757 {
00758     CartesianCoordinatePlane* plane = this;
00759     AbstractCartesianDiagram* diag = dynamic_cast< AbstractCartesianDiagram* >( plane->diagram() );
00760     const CartesianAxis* sharedAxis = 0;
00761     if( diag != 0 )
00762     {
00763         const CartesianAxisList axes = diag->axes();
00764         KDAB_FOREACH( const CartesianAxis* a, axes )
00765         {
00766             CartesianCoordinatePlane* p = const_cast< CartesianCoordinatePlane* >(
00767                                               dynamic_cast< const CartesianCoordinatePlane* >( a->coordinatePlane() ) );
00768             if( p != 0 && p != this )
00769             {
00770                 plane = p;
00771                 sharedAxis = a;
00772             }
00773         }
00774     }
00775 
00776     if( plane == this || painter == 0 )
00777         return plane;
00778 
00779     const QPointF zero = QPointF( 0, 0 );
00780     const QPointF tenX = QPointF( 10, 0 );
00781     const QPointF tenY = QPointF( 0, 10 );
00782 
00783 
00784     if( sharedAxis->isOrdinate() )
00785     {
00786         painter->translate( translate( zero ).x(), 0.0 );
00787         const qreal factor = (translate( tenX ) - translate( zero ) ).x() / ( plane->translate( tenX ) - plane->translate( zero ) ).x();
00788         painter->scale( factor, 1.0 );
00789         painter->translate( -plane->translate( zero ).x(), 0.0 );
00790     }
00791     if( sharedAxis->isAbscissa() )
00792     {
00793         painter->translate( 0.0, translate( zero ).y() );
00794         const qreal factor = (translate( tenY ) - translate( zero ) ).y() / ( plane->translate( tenY ) - plane->translate( zero ) ).y();
00795         painter->scale( 1.0, factor );
00796         painter->translate( 0.0, -plane->translate( zero ).y() );
00797     }
00798 
00799 
00800     return plane;
00801 }

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

pure virtual in QLayoutItem

Definition at line 229 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::maximumSize().

00230 {
00231     // we return our maxiumu (which is the full size of the Chart)
00232     // even if we know the plane will be smaller
00233     return maximumSize();
00234 }

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

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

Definition at line 86 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::mParent.

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

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

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

[reimplemented]

Reimplemented in KDChart::TernaryCoordinatePlane.

Definition at line 150 of file KDChartAbstractCoordinatePlane.cpp.

00151 {
00152     return QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
00153 }

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

Definition at line 146 of file KDChartCartesianCoordinatePlane.cpp.

References layoutDiagrams().

Referenced by addDiagram().

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

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 104 of file KDChartAbstractCoordinatePlane.cpp.

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

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

00105 {
00106     const int idx = d->diagrams.indexOf( diagram );
00107     if( idx != -1 ){
00108         d->diagrams.removeAt( idx );
00109         diagram->setParent( 0 );
00110         diagram->setCoordinatePlane( 0 );
00111         layoutDiagrams();
00112         update();
00113     }
00114 }

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::CartesianAxis::maximumSize().

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]

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 465 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by layoutDiagrams(), and sharedAxisMasterPlane().

00466 {
00467     // Note: We do not test if the point lays inside of the data area,
00468     //       but we just apply the transformation calculations to the point.
00469     //       This allows for basic calculations done by the user, see e.g.
00470     //       the file  examples/Lines/BubbleChart/mainwindow.cpp
00471     return  d->coordinateTransformation.translate ( diagramPoint );
00472 }

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

Definition at line 474 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by visibleDataRange().

00475 {
00476     return  d->coordinateTransformation.translateBack ( screenPoint );
00477 }

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

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

Definition at line 251 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::needUpdate().

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

00252 {
00253     //qDebug("KDChart::AbstractCoordinatePlane::update() called");
00254     emit needUpdate();
00255 }

QPair< qreal, qreal > CartesianCoordinatePlane::verticalRange (  )  const

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

If this is not explicitely 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 628 of file KDChartCartesianCoordinatePlane.cpp.

References d.

00629 {
00630     return QPair<qreal, qreal>( d->verticalMin, d->verticalMax );
00631 }

QRectF CartesianCoordinatePlane::visibleDataRange (  )  const

Returns the currently visible data range.

Might be greater than the range of the grid.

Definition at line 833 of file KDChartCartesianCoordinatePlane.cpp.

References drawingArea(), and translateBack().

00834 {
00835     QRectF result;
00836 
00837     const QRectF drawArea = drawingArea();
00838 
00839     result.setTopLeft( translateBack( drawArea.topLeft() ) );
00840     result.setBottomRight( translateBack( drawArea.bottomRight() ) );
00841 
00842     return result.normalized();
00843 }

QPointF CartesianCoordinatePlane::zoomCenter (  )  const [virtual]

See also:
setZoomCenter, setZoomFactorX, setZoomFactorY

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 548 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by handleFixedDataCoordinateSpaceRelation().

00549 {
00550     return d->coordinateTransformation.zoom.center();
00551 }

double CartesianCoordinatePlane::zoomFactorX (  )  const [virtual]

See also:
setZoomFactorX, setZoomCenter

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 553 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by handleFixedDataCoordinateSpaceRelation().

00554 {
00555     return d->coordinateTransformation.zoom.xFactor;
00556 }

double CartesianCoordinatePlane::zoomFactorY (  )  const [virtual]

See also:
setZoomFactorY, setZoomCenter

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 558 of file KDChartCartesianCoordinatePlane.cpp.

References d.

Referenced by handleFixedDataCoordinateSpaceRelation().

00559 {
00560     return d->coordinateTransformation.zoom.yFactor;
00561 }


Member Data Documentation

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

Definition at line 90 of file KDChartLayoutItems.h.

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

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

Definition at line 91 of file KDChartLayoutItems.h.

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


The documentation for this class was generated from the following files:
Generated on Mon Sep 17 16:18:13 2007 for KD Chart 2 by  doxygen 1.5.1