KDChart::TernaryCoordinatePlane Class Reference

#include <KDChartTernaryCoordinatePlane.h>

Inheritance diagram for KDChart::TernaryCoordinatePlane:

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

Collaboration graph
[legend]

List of all members.


Detailed Description

Ternary coordinate plane.

Definition at line 42 of file KDChartTernaryCoordinatePlane.h.


Public Types

enum  AxesCalcMode {
  Linear,
  Logarithmic
}

Public Slots

void layoutPlanes ()
 Calling layoutPlanes() on the plane triggers the global KDChart::Chart::slotLayoutPlanes().
void relayout ()
 Calling relayout() on the plane triggers the global KDChart::Chart::slotRelayout().
void setGridNeedsRecalculate ()
 Used by the chart to clear the cached grid data.
void update ()
 Calling update() on the plane triggers the global KDChart::Chart::update().

Signals

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

Public Member Functions

void addDiagram (AbstractDiagram *diagram)
 Adds a diagram to this coordinate plane.
void alignToReferencePoint (const RelativePosition &position)
BackgroundAttributes backgroundAttributes () const
virtual int bottomOverlap (bool doNotRecalculate=false) const
 This is called at layout time by KDChart:AutoSpacerLayoutItem::sizeHint().
bool compare (const AbstractAreaBase *other) const
 Returns true if both areas have the same settings.
AbstractDiagramdiagram ()
 
Returns:
The first diagram associated with this coordinate plane.

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.

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

DataDimensionsList gridDimensionsList ()
 Returns the dimensions used for drawing the grid lines.
virtual bool isEmpty () const
 pure virtual in QLayoutItem
bool isRubberBandZoomingEnabled () const
 
Returns:
Whether zooming with a rubber band using the mouse is enabled.

const bool isVisiblePoint (const QPointF &point) const
 Tests, if a point is visible on the coordinate plane.
void layoutDiagrams ()
 Distribute the available space among the diagrams and axes.
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
QSize minimumSizeHint () const
 [reimplemented]
void mouseDoubleClickEvent (QMouseEvent *event)
void mouseMoveEvent (QMouseEvent *event)
void mousePressEvent (QMouseEvent *event)
void mouseReleaseEvent (QMouseEvent *event)
void paint (QPainter *)
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.
virtual int rightOverlap (bool doNotRecalculate=false) const
 This is called at layout time by KDChart::AutoSpacerLayoutItem::sizeHint().
void setBackgroundAttributes (const BackgroundAttributes &a)
void setFrameAttributes (const FrameAttributes &a)
virtual void setGeometry (const QRect &r)
 pure virtual in QLayoutItem
void setGlobalGridAttributes (const GridAttributes &)
 Set the grid attributes to be used by this coordinate plane.
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.
virtual void setZoomCenter (const QPointF &center)
 Set the point (in value coordinates) to be used as the center point in zoom operations.
virtual void setZoomFactors (double factorX, double factorY)
 Sets both zoom factors in one go.
virtual void setZoomFactorX (double factor)
 Sets the zoom factor in horizontal direction, that is applied to all coordinate transformations.
virtual void setZoomFactorY (double factor)
 Sets the zoom factor in vertical direction, that is applied to all coordinate transformations.
virtual AbstractCoordinatePlanesharedAxisMasterPlane (QPainter *p=0)
virtual QSize sizeHint () const
 pure virtual in QLayoutItem
virtual void sizeHintChanged () const
 Report changed size hint: ask the parent widget to recalculate the layout.
QSizePolicy sizePolicy () const
 [reimplemented]
virtual void takeDiagram (AbstractDiagram *diagram)
 Removes the diagram from the plane, without deleting it.
 TernaryCoordinatePlane (Chart *parent=0)
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.
virtual QPointF zoomCenter () const
 
Returns:
The center point (in value coordinates) of the coordinate plane, that is used for zoom operations.

virtual double zoomFactorX () const
 
Returns:
The zoom factor in horizontal direction, that is applied to all coordinate transformations.

virtual double zoomFactorY () const
 
Returns:
The zoom factor in vertical direction, that is applied to all coordinate transformations.

 ~TernaryCoordinatePlane ()

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 Member Functions

virtual QRect areaGeometry () const
QRect innerRect () const
virtual void positionHasChanged ()

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

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

Definition at line 52 of file KDChartTernaryCoordinatePlane.cpp.

00053     : AbstractCoordinatePlane( new Private(), parent )
00054 {
00055 }

TernaryCoordinatePlane::~TernaryCoordinatePlane (  ) 

Definition at line 57 of file KDChartTernaryCoordinatePlane.cpp.

00058 {
00059 }


Member Function Documentation

void TernaryCoordinatePlane::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 65 of file KDChartTernaryCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::addDiagram().

00066 {
00067     Q_ASSERT_X ( dynamic_cast<AbstractTernaryDiagram*>( diagram ),
00068                  "TernaryCoordinatePlane::addDiagram", "Only ternary "
00069                  "diagrams can be added to a ternary coordinate plane!" );
00070     AbstractCoordinatePlane::addDiagram ( diagram );
00071 //     connect ( diagram,  SIGNAL ( layoutChanged ( AbstractDiagram* ) ),
00072 //               SLOT ( slotLayoutChanged ( AbstractDiagram* ) ) );
00073 //     connect( diagram, SIGNAL( propertiesChanged() ),this, SIGNAL( propertiesChanged() ) );
00074 }

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

Definition at line 91 of file KDChartAbstractAreaBase.cpp.

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

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

Implements KDChart::AbstractAreaBase.

Definition at line 150 of file KDChartAbstractArea.cpp.

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

00151 {
00152     return geometry();
00153 }

BackgroundAttributes AbstractAreaBase::backgroundAttributes (  )  const [inherited]

Definition at line 121 of file KDChartAbstractAreaBase.cpp.

References d.

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

00122 {
00123     return d->backgroundAttributes;
00124 }

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

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

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

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

Definition at line 101 of file KDChartAbstractArea.cpp.

References d.

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

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

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

Returns true if both areas have the same settings.

Definition at line 76 of file KDChartAbstractAreaBase.cpp.

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

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

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

Emitted when this coordinate plane is destroyed.

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

AbstractDiagram * AbstractCoordinatePlane::diagram (  )  [inherited]

Returns:
The first diagram associated with this coordinate plane.

Definition at line 125 of file KDChartAbstractCoordinatePlane.cpp.

References d.

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

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

ConstAbstractDiagramList AbstractCoordinatePlane::diagrams (  )  const [inherited]

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

Definition at line 140 of file KDChartAbstractCoordinatePlane.cpp.

References d.

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

AbstractDiagramList AbstractCoordinatePlane::diagrams (  )  [inherited]

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

Definition at line 135 of file KDChartAbstractCoordinatePlane.cpp.

References d.

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

00136 {
00137     return d->diagrams;
00138 }

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

pure virtual in QLayoutItem

Definition at line 219 of file KDChartAbstractCoordinatePlane.cpp.

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

FrameAttributes AbstractAreaBase::frameAttributes (  )  const [inherited]

Definition at line 107 of file KDChartAbstractAreaBase.cpp.

References d.

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

00108 {
00109     return d->frameAttributes;
00110 }

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

pure virtual in QLayoutItem

Definition at line 259 of file KDChartAbstractCoordinatePlane.cpp.

References d.

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

00261 {
00262     return d->geometry;

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

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

and control has returned to the event loop.

Parameters are the the old geometry, the new geometry.

DataDimensionsList TernaryCoordinatePlane::getDataDimensionsList (  )  const [virtual]

Implements KDChart::AbstractCoordinatePlane.

Definition at line 200 of file KDChartTernaryCoordinatePlane.cpp.

00201 {   // not needed
00202     return DataDimensionsList();
00203 }

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

Definition at line 213 of file KDChartAbstractAreaBase.cpp.

References d.

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

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

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

Returns:
The grid attributes used by this coordinate plane.

See also:
setGlobalGridAttributes

CartesianCoordinatePlane::gridAttributes

Definition at line 168 of file KDChartAbstractCoordinatePlane.cpp.

References d.

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

00170 {
00171     return d->gridAttributes;

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

Returns the dimensions used for drawing the grid lines.

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

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

Definition at line 173 of file KDChartAbstractCoordinatePlane.cpp.

References d.

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

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

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

Definition at line 229 of file KDChartAbstractAreaBase.cpp.

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

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

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

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

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

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

pure virtual in QLayoutItem

Definition at line 212 of file KDChartAbstractCoordinatePlane.cpp.

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

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

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

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

Definition at line 293 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00295 {
00296     return d->enableRubberBandZooming;

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

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

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

Definition at line 421 of file KDChartAbstractCoordinatePlane.cpp.

References d.

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

void TernaryCoordinatePlane::layoutDiagrams (  )  [virtual]

Distribute the available space among the diagrams and axes.

Implements KDChart::AbstractCoordinatePlane.

Definition at line 76 of file KDChartTernaryCoordinatePlane.cpp.

References KDChart::AbstractArea::areaGeometry(), KDChart::AbstractTernaryDiagram::axes(), d, KDChart::AbstractCoordinatePlane::diagram(), KDChart::AbstractCoordinatePlane::diagrams(), KDChart::TernaryAxis::requiredMargins(), TriangleHeight, and TriangleWidth.

00077 {   // this is our "resize event":
00078     // all diagrams always take the same space, nothing to be done here
00079     // the "inner" margin (adjustments to diagram coordinates)
00080     QRectF diagramNativeRectangle ( QPointF( 0.0, 0.0 ),
00081                                     QSizeF( TriangleWidth, TriangleHeight ) );
00082     QPair<QSizeF, QSizeF> margins = grid()->requiredMargins();
00083     d->diagramRect = areaGeometry();
00084     diagramNativeRectangle.adjust
00085         (-margins.first.width(), -margins.first.height(),
00086          margins.second.width(), margins.second.height() );
00087 
00088     // the "outer" margin (distance between diagram contents and area,
00089     // determined by axis label overlap
00090     {
00091         QSizeF topleft( 0.0, 0.0 );
00092         QSizeF bottomRight( 0.0, 0.0 );
00093         Q_FOREACH( AbstractDiagram* abstractDiagram, diagrams() ) {
00094             AbstractTernaryDiagram* diagram =
00095                 qobject_cast<AbstractTernaryDiagram*>( abstractDiagram );
00096             Q_ASSERT( diagram );
00097             Q_FOREACH( TernaryAxis* axis, diagram->axes() ) {
00098                 QPair<QSizeF, QSizeF> margin = axis->requiredMargins();
00099                 topleft = topleft.expandedTo( margin.first );
00100                 bottomRight = bottomRight.expandedTo( margin.second );
00101             }
00102         }
00103         d->diagramRectContainer =
00104             d->diagramRect.adjusted( topleft.width(),
00105                                      topleft.height(),
00106                                      -bottomRight.width(),
00107                                      -bottomRight.height() );
00108     }
00109 
00110     // now calculate isometric projection, x and y widget coordinate
00111     // units, and location of (0.0, 0.0) in diagram coordinates
00112     QPointF zeroZeroPoint = d->diagramRectContainer.bottomLeft();
00113     double w = d->diagramRectContainer.width();
00114     double h = d->diagramRectContainer.height();
00115     double usableWidth;
00116     double usableHeight;
00117 
00118     if ( TriangleHeight * w > h ) {
00119         // shorten width:
00120         usableWidth = h / diagramNativeRectangle.height();
00121         usableHeight = h;
00122         zeroZeroPoint.setX( zeroZeroPoint.x() + ( w - usableWidth ) / 2 );
00123     } else {
00124         // reduce height:
00125         usableWidth = w;
00126         usableHeight = diagramNativeRectangle.height() * w;
00127         zeroZeroPoint.setY( zeroZeroPoint.y() - ( h - usableHeight ) / 2 );
00128     }
00129     // the rectangle has 1 as it's width, and TriangleHeight as it's
00130     // height - so this is how we translate that to widget coordinates:
00131     d->xUnit = usableWidth / diagramNativeRectangle.width(); // only because we normalize the values to [0..1]
00132     d->yUnit = -usableHeight / diagramNativeRectangle.height();
00133 
00134     // now move zeroZeroPoint so that it does not include the tick marks
00135     {
00136         double descent = diagramNativeRectangle.height() - TriangleHeight;
00137         double rightShift = -diagramNativeRectangle.x();
00138         zeroZeroPoint += QPointF( rightShift * d->xUnit, descent * d->yUnit );
00139     }
00140 
00141     d->diagramRect.setBottomLeft( zeroZeroPoint );
00142     d->diagramRect.setTopRight( QPointF( usableWidth, -usableHeight ) + zeroZeroPoint );
00143 }

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

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

Definition at line 276 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::needLayoutPlanes().

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

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

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

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

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

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

Definition at line 77 of file KDChartAbstractArea.cpp.

References d.

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

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

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

pure virtual in QLayoutItem

Definition at line 224 of file KDChartAbstractCoordinatePlane.cpp.

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

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

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

pure virtual in QLayoutItem

Definition at line 231 of file KDChartAbstractCoordinatePlane.cpp.

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

QSize TernaryCoordinatePlane::minimumSizeHint (  )  const [virtual]

[reimplemented]

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 151 of file KDChartTernaryCoordinatePlane.cpp.

00152 {
00153     // FIXME temp
00154     return QSize();
00155 }

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

Definition at line 338 of file KDChartAbstractCoordinatePlane.cpp.

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

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

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

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

Definition at line 402 of file KDChartAbstractCoordinatePlane.cpp.

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

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

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

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

Definition at line 298 of file KDChartAbstractCoordinatePlane.cpp.

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

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

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

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

Definition at line 352 of file KDChartAbstractCoordinatePlane.cpp.

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

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

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

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

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

planes.

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

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

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

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

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

Emitted when plane needs to update its drawings.

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

void TernaryCoordinatePlane::paint ( QPainter *  painter  )  [virtual]

Implements KDChart::AbstractLayoutItem.

Definition at line 163 of file KDChartTernaryCoordinatePlane.cpp.

References KDChart::AbstractArea::areaGeometry(), d, KDChart::AbstractCoordinatePlane::diagrams(), KDChart::PaintContext::setCoordinatePlane(), KDChart::PaintContext::setPainter(), and KDChart::PaintContext::setRectangle().

00164 {
00165     PainterSaver s( painter );
00166     // FIXME: this is not a good location for that:
00167     painter->setRenderHint(QPainter::Antialiasing, true );
00168 
00169 //     painter->setPen( QColor( "gold" ) );
00170 //     painter->setBrush( QColor( "gold" ) );
00171 //     painter->drawRect( d->diagramRectContainer );
00172 
00173     AbstractDiagramList diags = diagrams();
00174     if ( !diags.isEmpty() )
00175     {
00176         PaintContext ctx;
00177         ctx.setPainter ( painter );
00178         ctx.setCoordinatePlane ( this );
00179         const QRectF drawArea( areaGeometry() );
00180         ctx.setRectangle ( drawArea );
00181 
00182         // enabling clipping so that we're not drawing outside
00183 //         QRect clipRect = drawArea.toRect().adjusted( -1, -1, 1, 1 );
00184 //         QRegion clipRegion( clipRect );
00185 //         painter->setClipRegion( clipRegion );
00186 
00187         // paint the coordinate system rulers:
00188         Q_ASSERT( d->grid != 0 );
00189         d->grid->drawGrid( &ctx );
00190 
00191         // paint the diagrams:
00192         for ( int i = 0; i < diags.size(); i++ )
00193         {
00194             PainterSaver diagramPainterSaver( painter );
00195             diags[i]->paint ( &ctx );
00196         }
00197     }
00198 }

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

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

Reimplemented from KDChart::AbstractLayoutItem.

Reimplemented in KDChart::TernaryAxis.

Definition at line 123 of file KDChartAbstractArea.cpp.

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

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

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

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

Definition at line 197 of file KDChartAbstractAreaBase.cpp.

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

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

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

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

Definition at line 128 of file KDChartAbstractAreaBase.cpp.

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

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

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

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

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

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

Definition at line 78 of file KDChartLayoutItems.cpp.

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

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

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

Definition at line 205 of file KDChartAbstractAreaBase.cpp.

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

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

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

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

Definition at line 178 of file KDChartAbstractAreaBase.cpp.

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

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

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

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

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

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

Definition at line 111 of file KDChartAbstractArea.cpp.

References KDChart::AbstractArea::paintAll().

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

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

Definition at line 201 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00203 {
00204     return d->parent;

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

Definition at line 206 of file KDChartAbstractCoordinatePlane.cpp.

References d.

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

00208 {
00209     return d->parent;

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

Definition at line 79 of file KDChartLayoutItems.h.

00080         {
00081             return mParentLayout;
00082         }

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

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

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

Reimplemented from KDChart::AbstractAreaBase.

Definition at line 155 of file KDChartAbstractArea.cpp.

References KDChart::AbstractArea::positionChanged().

00156 {
00157     emit positionChanged( this );
00158 }

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

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

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

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

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

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

Returns:
The reference coordinate plane associated with this one.

Definition at line 191 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00193 {
00194     return d->referenceCoordinatePlane;

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

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

Definition at line 270 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::needRelayout().

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

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

Definition at line 83 of file KDChartLayoutItems.h.

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

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

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

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

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

Definition at line 90 of file KDChartAbstractCoordinatePlane.cpp.

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

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

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

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

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

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

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

Definition at line 85 of file KDChartAbstractArea.cpp.

References d.

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

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

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

Definition at line 112 of file KDChartAbstractAreaBase.cpp.

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

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

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

Definition at line 98 of file KDChartAbstractAreaBase.cpp.

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

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

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

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

pure virtual in QLayoutItem

Note:
Do not call this function directly, unless you know exactly what you are doing. Geometry management is done by KD Chart's internal layouting measures.

Reimplemented in KDChart::CartesianCoordinatePlane.

Definition at line 243 of file KDChartAbstractCoordinatePlane.cpp.

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

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

00245 {
00246 //    qDebug() << "KDChart::AbstractCoordinatePlane::setGeometry(" << r << ") called";
00247     if( d->geometry != r ){
00248         //qDebug() << "entering KDChart::AbstractCoordinatePlane::setGeometry(" << r << ")";
00249         // inform the outside word by Signal geometryChanged()
00250         // via a queued connection to internal_geometryChanged()
00251         emit internal_geometryChanged( d->geometry, r );
00252 
00253         d->geometry = r;
00254         // Note: We do *not* call update() here
00255         //       because it would invoke KDChart::update() recursively.
00256         //qDebug() << "leaving  KDChart::AbstractCoordinatePlane::setGeometry(" << r << ")";
00257     }

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

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

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

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

CartesianCoordinatePlane::setGridAttributes

Definition at line 162 of file KDChartAbstractCoordinatePlane.cpp.

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

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

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

Used by the chart to clear the cached grid data.

Definition at line 181 of file KDChartAbstractCoordinatePlane.cpp.

References d.

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

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

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

Called internally by KDChart::Chart.

Definition at line 196 of file KDChartAbstractCoordinatePlane.cpp.

References d.

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

00198 {
00199     d->parent = parent;

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

Definition at line 75 of file KDChartLayoutItems.h.

00076         {
00077             mParentLayout = lay;
00078         }

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

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

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

Definition at line 65 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::mParent.

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

00066 {
00067     mParent = widget;
00068 }

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

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

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

Definition at line 186 of file KDChartAbstractCoordinatePlane.cpp.

References d.

00188 {
00189     d->referenceCoordinatePlane = plane;

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

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

Definition at line 282 of file KDChartAbstractCoordinatePlane.cpp.

References d.

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

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

Set the point (in value coordinates) to be used as the center point in zoom operations.

Parameters:
center The point to use.

Reimplemented in KDChart::CartesianCoordinatePlane, and KDChart::PolarCoordinatePlane.

Definition at line 188 of file KDChartAbstractCoordinatePlane.h.

Referenced by KDChart::AbstractCoordinatePlane::mousePressEvent(), and KDChart::AbstractCoordinatePlane::mouseReleaseEvent().

00188 { Q_UNUSED( center ); }

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

Sets both zoom factors in one go.

See also:
setZoomFactorX,setZoomFactorY

Reimplemented in KDChart::CartesianCoordinatePlane, and KDChart::PolarCoordinatePlane.

Definition at line 161 of file KDChartAbstractCoordinatePlane.h.

00161 { Q_UNUSED( factorX ); Q_UNUSED( factorY ); }

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

Sets the zoom factor in horizontal direction, that is applied to all coordinate transformations.

Parameters:
factor The new zoom factor

Reimplemented in KDChart::CartesianCoordinatePlane, and KDChart::PolarCoordinatePlane.

Definition at line 168 of file KDChartAbstractCoordinatePlane.h.

Referenced by KDChart::AbstractCoordinatePlane::mousePressEvent(), and KDChart::AbstractCoordinatePlane::mouseReleaseEvent().

00168 { Q_UNUSED( factor ); }

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

Sets the zoom factor in vertical direction, that is applied to all coordinate transformations.

Parameters:
factor The new zoom factor

Reimplemented in KDChart::CartesianCoordinatePlane, and KDChart::PolarCoordinatePlane.

Definition at line 175 of file KDChartAbstractCoordinatePlane.h.

Referenced by KDChart::AbstractCoordinatePlane::mousePressEvent(), and KDChart::AbstractCoordinatePlane::mouseReleaseEvent().

00175 { Q_UNUSED( factor ); }

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

Reimplemented in KDChart::CartesianCoordinatePlane.

Definition at line 426 of file KDChartAbstractCoordinatePlane.cpp.

Referenced by KDChart::Plotter::paint(), KDChart::LineDiagram::paint(), KDChart::LeveyJenningsDiagram::paint(), and KDChart::BarDiagram::paint().

00428 {
00429     Q_UNUSED( p );
00430     return this;

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

pure virtual in QLayoutItem

Definition at line 236 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::maximumSize().

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

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

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

Definition at line 87 of file KDChartLayoutItems.cpp.

References KDChart::AbstractLayoutItem::mParent.

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

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

QSizePolicy TernaryCoordinatePlane::sizePolicy (  )  const [virtual]

[reimplemented]

Reimplemented from KDChart::AbstractCoordinatePlane.

Definition at line 157 of file KDChartTernaryCoordinatePlane.cpp.

00158 {
00159     return QSizePolicy( QSizePolicy::MinimumExpanding,
00160                         QSizePolicy::MinimumExpanding );
00161 }

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

Removes the diagram from the plane, without deleting it.

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

See also:
addDiagram, replaceDiagram

Definition at line 111 of file KDChartAbstractCoordinatePlane.cpp.

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

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

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

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

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

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

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

Definition at line 93 of file KDChartAbstractArea.cpp.

References d.

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

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

const QPointF TernaryCoordinatePlane::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 145 of file KDChartTernaryCoordinatePlane.cpp.

References d.

Referenced by KDChart::TernaryPointDiagram::paint(), KDChart::TernaryLineDiagram::paint(), and KDChart::TernaryAxis::paintCtx().

00146 {
00147     return QPointF( d->diagramRect.bottomLeft().x() + point.x() * d->xUnit,
00148                     d->diagramRect.bottomLeft().y() + point.y() * d->yUnit );
00149 }

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

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

Definition at line 264 of file KDChartAbstractCoordinatePlane.cpp.

References KDChart::AbstractCoordinatePlane::needUpdate().

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

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

virtual QPointF KDChart::AbstractCoordinatePlane::zoomCenter (  )  const [virtual, inherited]

Returns:
The center point (in value coordinates) of the coordinate plane, that is used for zoom operations.

Reimplemented in KDChart::CartesianCoordinatePlane, and KDChart::PolarCoordinatePlane.

Definition at line 181 of file KDChartAbstractCoordinatePlane.h.

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

00181 { return QPointF(0.0, 0.0); }

virtual double KDChart::AbstractCoordinatePlane::zoomFactorX (  )  const [virtual, inherited]

Returns:
The zoom factor in horizontal direction, that is applied to all coordinate transformations.

Reimplemented in KDChart::CartesianCoordinatePlane, and KDChart::PolarCoordinatePlane.

Definition at line 149 of file KDChartAbstractCoordinatePlane.h.

Referenced by KDChart::AbstractCoordinatePlane::mouseReleaseEvent(), KDChart::PolarDiagram::paint(), StockDiagram::resize(), KDChart::LineDiagram::resize(), and KDChart::BarDiagram::resize().

00149 { return 1.0; }

virtual double KDChart::AbstractCoordinatePlane::zoomFactorY (  )  const [virtual, inherited]

Returns:
The zoom factor in vertical direction, that is applied to all coordinate transformations.

Reimplemented in KDChart::CartesianCoordinatePlane, and KDChart::PolarCoordinatePlane.

Definition at line 155 of file KDChartAbstractCoordinatePlane.h.

Referenced by KDChart::AbstractCoordinatePlane::mouseReleaseEvent(), KDChart::PolarDiagram::paint(), StockDiagram::resize(), KDChart::LineDiagram::resize(), and KDChart::BarDiagram::resize().

00155 { return 1.0; }


Member Data Documentation

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

Definition at line 93 of file KDChartLayoutItems.h.

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

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

Definition at line 94 of file KDChartLayoutItems.h.

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


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