#include <KDChartCartesianCoordinatePlane.h>
Inheritance diagram for KDChart::CartesianCoordinatePlane:
Public Types | |
enum | AxesCalcMode { Linear, Logarithmic } |
Public Member Functions | |
void | addDiagram (AbstractDiagram *diagram) |
Adds a diagram to this coordinate plane. | |
void | adjustHorizontalRangeToData () |
Adjust horizontal 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 | 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. | |
AbstractDiagram * | diagram () |
ConstAbstractDiagramList | diagrams () const |
AbstractDiagramList | diagrams () |
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 |
const GridAttributes | gridAttributes (Qt::Orientation orientation) const |
DataDimensionsList | gridDimensionsList () |
Returns the dimensions used for drawing the grid lines. | |
bool | hasOwnGridAttributes (Qt::Orientation orientation) const |
QPair< qreal, qreal > | horizontalRange () const |
virtual bool | isEmpty () const |
pure virtual in QLayoutItem | |
const bool | isVisiblePoint (const QPointF &point) const |
Tests, if a point is visible on the coordinate plane. | |
void | layoutPlanes () |
Calling layoutPlanes() on the plane triggers the global KDChart::Chart::slotLayoutPlanes(). | |
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 | mousePressEvent (QMouseEvent *event) |
reimp | |
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. | |
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 Chart * | parent () const |
Chart * | parent () |
QLayout * | parentLayout () |
void | propertiesChanged () |
Emitted upon change of a property of the Coordinate Plane or any of its components. | |
AbstractCoordinatePlane * | referenceCoordinatePlane () 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 | relayout () |
Calling relayout() on the plane triggers the global KDChart::Chart::slotRelayout(). | |
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 | 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 | 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 | setGridNeedsRecalculate () |
Used by the chart to clear the cached grid data. | |
void | setHorizontalRange (const QPair< qreal, qreal > &range) |
Set the boundaries of the visible value space displayed in horizontal direction. | |
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 | setVerticalRange (const QPair< qreal, qreal > &range) |
Set the boundaries of the visible value space displayed in vertical direction. | |
virtual void | setZoomCenter (QPointF center) |
virtual void | setZoomFactorX (double factor) |
virtual void | setZoomFactorY (double factor) |
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 |
virtual QPointF | zoomCenter () const |
virtual double | zoomFactorX () const |
virtual double | zoomFactorY () const |
~CartesianCoordinatePlane () | |
Static Public Member Functions | |
void | paintBackgroundAttributes (QPainter &painter, const QRect &rectangle, const KDChart::BackgroundAttributes &attributes) |
void | paintFrameAttributes (QPainter &painter, const QRect &rectangle, const KDChart::FrameAttributes &attributes) |
Public Attributes | |
Q_SIGNALS | __pad0__: void destroyedCoordinatePlane( AbstractCoordinatePlane* ) |
public | Q_SLOTS: void adjustRangesToData() |
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 (QPointF center) |
bool | doneSetZoomFactorX (double factor) |
bool | doneSetZoomFactorY (double factor) |
virtual QRectF | drawingArea () const |
virtual DataDimensionsList | getDataDimensionsList () const |
QRectF | getRawDataBoundingRectFromDiagrams () const |
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 | |
QWidget * | mParent |
QLayout * | mParentLayout |
protected | Q_SLOTS: void slotLayoutChanged( AbstractDiagram* ) |
|
Definition at line 55 of file KDChartAbstractCoordinatePlane.h.
00055 { Linear, Logarithmic }; |
|
Definition at line 67 of file KDChartCartesianCoordinatePlane.cpp.
00068 : AbstractCoordinatePlane ( new Private(), parent ) 00069 { 00070 // this bloc left empty intentionally 00071 } |
|
Definition at line 73 of file KDChartCartesianCoordinatePlane.cpp.
00074 {
00075 // this bloc left empty intentionally
00076 }
|
|
Adds a diagram to this coordinate plane.
Reimplemented from KDChart::AbstractCoordinatePlane. Definition at line 84 of file KDChartCartesianCoordinatePlane.cpp. References KDChart::AbstractCoordinatePlane::addDiagram(), and KDChart::AbstractCoordinatePlane::propertiesChanged().
00085 { 00086 Q_ASSERT_X ( dynamic_cast<AbstractCartesianDiagram*> ( diagram ), 00087 "CartesianCoordinatePlane::addDiagram", "Only cartesian " 00088 "diagrams can be added to a cartesian coordinate plane!" ); 00089 AbstractCoordinatePlane::addDiagram ( diagram ); 00090 connect ( diagram, SIGNAL ( layoutChanged ( AbstractDiagram* ) ), 00091 SLOT ( slotLayoutChanged ( AbstractDiagram* ) ) ); 00092 00093 connect( diagram, SIGNAL( propertiesChanged() ),this, SIGNAL( propertiesChanged() ) ); 00094 } |
|
Definition at line 174 of file KDChartCartesianCoordinatePlane.cpp. Referenced by calculateRawDataBoundingRect().
00176 { 00177 QRectF erg( r ); 00178 if( percentX < 100 || percentX == 1000 ) { 00179 const bool isPositive = (r.left() >= 0); 00180 if( (r.right() >= 0) == isPositive ){ 00181 const qreal innerBound = 00182 isPositive ? qMin(r.left(), r.right()) : qMax(r.left(), r.right()); 00183 const qreal outerBound = 00184 isPositive ? qMax(r.left(), r.right()) : qMin(r.left(), r.right()); 00185 if( innerBound / outerBound * 100 <= percentX ) 00186 { 00187 if( isPositive ) 00188 erg.setLeft( 0.0 ); 00189 else 00190 erg.setRight( 0.0 ); 00191 } 00192 } 00193 } 00194 if( percentY < 100 || percentY == 1000 ) { 00195 const bool isPositive = (r.bottom() >= 0); 00196 if( (r.top() >= 0) == isPositive ){ 00197 const qreal innerBound = 00198 isPositive ? qMin(r.top(), r.bottom()) : qMax(r.top(), r.bottom()); 00199 const qreal outerBound = 00200 isPositive ? qMax(r.top(), r.bottom()) : qMin(r.top(), r.bottom()); 00201 if( innerBound / outerBound * 100 <= percentY ) 00202 { 00203 if( isPositive ) 00204 erg.setBottom( 0.0 ); 00205 else 00206 erg.setTop( 0.0 ); 00207 } 00208 } 00209 } 00210 return erg; 00211 } |
|
Adjust horizontal range settings to the ranges covered by the model's data values.
Definition at line 583 of file KDChartCartesianCoordinatePlane.cpp. References d, getRawDataBoundingRectFromDiagrams(), layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().
00584 { 00585 const QRectF dataBoundingRect( getRawDataBoundingRectFromDiagrams() ); 00586 d->horizontalMin = dataBoundingRect.left(); 00587 d->horizontalMax = dataBoundingRect.right(); 00588 layoutDiagrams(); 00589 emit propertiesChanged(); 00590 } |
|
Adjust vertical range settings to the ranges covered by the model's data values.
Definition at line 592 of file KDChartCartesianCoordinatePlane.cpp. References d, getRawDataBoundingRectFromDiagrams(), layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().
00593 { 00594 const QRectF dataBoundingRect( getRawDataBoundingRectFromDiagrams() ); 00595 d->verticalMin = dataBoundingRect.bottom(); 00596 d->verticalMax = dataBoundingRect.top(); 00597 layoutDiagrams(); 00598 emit propertiesChanged(); 00599 } |
|
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 } |
|
Implements KDChart::AbstractAreaBase. Definition at line 150 of file KDChartAbstractArea.cpp. Referenced by drawingArea(), KDChart::PolarCoordinatePlane::layoutDiagrams(), KDChart::CartesianAxis::paint(), KDChart::AbstractArea::paintAll(), and KDChart::CartesianAxis::paintCtx().
00151 { 00152 return geometry(); 00153 } |
|
Return the status of the built-in grid adjusting feature.
Definition at line 691 of file KDChartCartesianCoordinatePlane.cpp. References d.
00692 { 00693 return d->autoAdjustGridToZoom; 00694 } |
|
Returns the maximal allowed percent of the horizontal space covered by the coordinate plane that may be empty.
Definition at line 619 of file KDChartCartesianCoordinatePlane.cpp. References d.
00620 { 00621 return d->autoAdjustHorizontalRangeToData; 00622 } |
|
Returns the maximal allowed percent of the vertical space covered by the coordinate plane that may be empty.
Definition at line 624 of file KDChartCartesianCoordinatePlane.cpp. References d.
00625 { 00626 return d->autoAdjustVerticalRangeToData; 00627 } |
|
Definition at line 508 of file KDChartCartesianCoordinatePlane.cpp. References d. Referenced by getDataDimensionsList().
00509 { 00510 return d->coordinateTransformation.axesCalcModeX; 00511 } |
|
Definition at line 503 of file KDChartCartesianCoordinatePlane.cpp. References d. Referenced by getDataDimensionsList().
00504 { 00505 return d->coordinateTransformation.axesCalcModeY; 00506 } |
|
Definition at line 112 of file KDChartAbstractAreaBase.cpp. References d. Referenced by updateCommonBrush().
00113 { 00114 return d->backgroundAttributes; 00115 } |
|
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.
Definition at line 101 of file KDChartAbstractArea.cpp. References d. Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().
|
|
Definition at line 214 of file KDChartCartesianCoordinatePlane.cpp. References adjustedToMaxEmptyInnerPercentage(), d, and getRawDataBoundingRectFromDiagrams(). Referenced by getDataDimensionsList().
00215 { 00216 // are manually set ranges to be applied? 00217 const bool bAutoAdjustHorizontalRange = (d->autoAdjustHorizontalRangeToData < 100); 00218 const bool bAutoAdjustVerticalRange = (d->autoAdjustVerticalRangeToData < 100); 00219 00220 const bool bHardHorizontalRange = (d->horizontalMin != d->horizontalMax) && ! bAutoAdjustHorizontalRange; 00221 const bool bHardVerticalRange = (d->verticalMin != d->verticalMax) && ! bAutoAdjustVerticalRange; 00222 QRectF dataBoundingRect; 00223 00224 // if custom boundaries are set on the plane, use them 00225 if ( bHardHorizontalRange && bHardVerticalRange ) { 00226 dataBoundingRect.setLeft( d->horizontalMin ); 00227 dataBoundingRect.setRight( d->horizontalMax ); 00228 dataBoundingRect.setBottom( d->verticalMin ); 00229 dataBoundingRect.setTop( d->verticalMax ); 00230 }else{ 00231 // determine unit of the rectangles of all involved diagrams: 00232 dataBoundingRect = getRawDataBoundingRectFromDiagrams(); 00233 if ( bHardHorizontalRange ) { 00234 dataBoundingRect.setLeft( d->horizontalMin ); 00235 dataBoundingRect.setRight( d->horizontalMax ); 00236 } 00237 if ( bHardVerticalRange ) { 00238 dataBoundingRect.setBottom( d->verticalMin ); 00239 dataBoundingRect.setTop( d->verticalMax ); 00240 } 00241 } 00242 // recalculate the bounds, if automatic adjusting of ranges is desired AND 00243 // both bounds are at the same side of the zero line 00244 dataBoundingRect = adjustedToMaxEmptyInnerPercentage( 00245 dataBoundingRect, d->autoAdjustHorizontalRangeToData, d->autoAdjustVerticalRangeToData ); 00246 if( bAutoAdjustHorizontalRange ){ 00247 const_cast<CartesianCoordinatePlane::Private *>(d)->horizontalMin = dataBoundingRect.left(); 00248 const_cast<CartesianCoordinatePlane::Private *>(d)->horizontalMax = dataBoundingRect.right(); 00249 } 00250 if( bAutoAdjustVerticalRange ){ 00251 const_cast<CartesianCoordinatePlane*>(this)->d->verticalMin = dataBoundingRect.bottom(); 00252 const_cast<CartesianCoordinatePlane*>(this)->d->verticalMax = dataBoundingRect.top(); 00253 } 00254 //qDebug() << "CartesianCoordinatePlane::calculateRawDataBoundingRect()\nreturns data boundaries: " << dataBoundingRect; 00255 return dataBoundingRect; 00256 } |
|
Returns true if both areas have the same settings.
Definition at line 75 of file KDChartAbstractAreaBase.cpp.
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 } |
|
Definition at line 113 of file KDChartAbstractCoordinatePlane.cpp. References d. Referenced by KDChart::Widget::diagram(), KDChart::Chart::mousePressEvent(), and KDChart::PolarCoordinatePlane::setStartPosition().
|
|
Definition at line 128 of file KDChartAbstractCoordinatePlane.cpp. References KDChart::ConstAbstractDiagramList, and d.
00129 { 00130 ConstAbstractDiagramList list; 00131 #ifndef QT_NO_STL 00132 qCopy( d->diagrams.begin(), d->diagrams.end(), std::back_inserter( list ) ); 00133 #else 00134 Q_FOREACH( AbstractDiagram * a, d->diagrams ) 00135 list.push_back( a ); 00136 #endif 00137 return list; 00138 } |
|
Definition at line 123 of file KDChartAbstractCoordinatePlane.cpp. References KDChart::AbstractDiagramList, and d. Referenced by getDataDimensionsList(), getRawDataBoundingRectFromDiagrams(), KDChart::PolarCoordinatePlane::layoutDiagrams(), layoutDiagrams(), KDChart::Chart::mousePressEvent(), KDChart::PolarCoordinatePlane::paint(), and paint().
00124 { 00125 return d->diagrams; 00126 } |
|
Definition at line 428 of file KDChartCartesianCoordinatePlane.cpp. References d.
00429 { 00430 return d->isometricScaling; 00431 } |
|
Definition at line 455 of file KDChartCartesianCoordinatePlane.cpp. References d. Referenced by setZoomCenter().
|
|
Definition at line 433 of file KDChartCartesianCoordinatePlane.cpp. References d. Referenced by setZoomFactorX().
|
|
Definition at line 444 of file KDChartCartesianCoordinatePlane.cpp. References d. Referenced by setZoomFactorY().
|
|
Definition at line 309 of file KDChartCartesianCoordinatePlane.cpp. References KDChart::AbstractArea::areaGeometry(). Referenced by layoutDiagrams(), and paint().
00310 { 00311 const QRect rect( areaGeometry() ); 00312 return QRectF ( rect.left()+1, rect.top()+1, rect.width() - 3, rect.height() - 3 ); 00313 } |
|
pure virtual in QLayoutItem
Definition at line 208 of file KDChartAbstractCoordinatePlane.cpp.
00209 {
00210 return Qt::Vertical | Qt::Horizontal;
00211 }
|
|
Definition at line 102 of file KDChartAbstractAreaBase.cpp. References d. Referenced by KDChart::Legend::clone(), and updateCommonBrush().
00103 { 00104 return d->frameAttributes; 00105 } |
|
pure virtual in QLayoutItem
Definition at line 242 of file KDChartAbstractCoordinatePlane.cpp. References d. Referenced by KDChart::Chart::mousePressEvent(), and KDChart::PolarCoordinatePlane::paint().
00243 { 00244 return d->geometry; 00245 } |
|
Implements KDChart::AbstractCoordinatePlane. Definition at line 259 of file KDChartCartesianCoordinatePlane.cpp. References axesCalcModeX(), axesCalcModeY(), calculateRawDataBoundingRect(), KDChart::DataDimensionsList, KDChart::AbstractDiagram::datasetDimension(), KDChart::AbstractCoordinatePlane::diagrams(), gridAttributes(), KDChart::GridAttributes::gridGranularitySequence(), KDChart::GridAttributes::gridStepWidth(), KDChart::GridAttributes::gridSubStepWidth(), and KDChart::AbstractDiagram::percentMode().
00260 { 00261 00262 DataDimensionsList l; 00263 const AbstractCartesianDiagram* dgr 00264 = diagrams().isEmpty() ? 0 : dynamic_cast<const AbstractCartesianDiagram*> (diagrams().first() ); 00265 00266 if( dgr ){ 00267 const QRectF r( calculateRawDataBoundingRect() ); 00268 // note: 00269 // We do *not* access d->gridAttributesHorizontal here, but 00270 // we use the getter function, to get the global attrs, if no 00271 // special ones have been set for the respective orientation. 00272 const GridAttributes gaH( gridAttributes( Qt::Horizontal ) ); 00273 const GridAttributes gaV( gridAttributes( Qt::Vertical ) ); 00274 // append the first dimension: for Abscissa axes 00275 l.append( 00276 DataDimension( 00277 r.left(), r.right(), 00278 dgr->datasetDimension() > 1, 00279 axesCalcModeX(), 00280 gaH.gridGranularitySequence(), 00281 gaH.gridStepWidth(), 00282 gaH.gridSubStepWidth() ) ); 00283 // append the second dimension: for Ordinate axes 00284 if( dgr->percentMode() ) 00285 l.append( 00286 DataDimension( 00287 // always return 0-100 when in percentMode 00288 0.0, 100.0, 00289 true, 00290 axesCalcModeY(), 00291 KDChartEnums::GranularitySequence_10_20, 00292 10.0 ) ); 00293 else 00294 l.append( 00295 DataDimension( 00296 r.bottom(), r.top(), 00297 true, 00298 axesCalcModeY(), 00299 gaV.gridGranularitySequence(), 00300 gaV.gridStepWidth(), 00301 gaV.gridSubStepWidth() ) ); 00302 }else{ 00303 l.append( DataDimension() ); // This gets us the default 1..0 / 1..0 grid 00304 l.append( DataDimension() ); // shown, if there is no diagram on this plane. 00305 } 00306 return l; 00307 } |
|
Definition at line 204 of file KDChartAbstractAreaBase.cpp. References d. Referenced by KDChart::AbstractAreaBase::innerRect(), and KDChart::AbstractAreaWidget::paintAll().
00205 { 00206 if( d && d->frameAttributes.isVisible() ){ 00207 const int padding = qMax( d->frameAttributes.padding(), 0 ); 00208 left = padding; 00209 top = padding; 00210 right = padding; 00211 bottom = padding; 00212 }else{ 00213 left = 0; 00214 top = 0; 00215 right = 0; 00216 bottom = 0; 00217 } 00218 } |
|
Definition at line 151 of file KDChartCartesianCoordinatePlane.cpp. References KDChart::AbstractDiagram::dataBoundaries(), and KDChart::AbstractCoordinatePlane::diagrams(). Referenced by adjustHorizontalRangeToData(), adjustVerticalRangeToData(), and calculateRawDataBoundingRect().
00152 { 00153 // determine unit of the rectangles of all involved diagrams: 00154 qreal minX, maxX, minY, maxY; 00155 bool bStarting = true; 00156 Q_FOREACH( const AbstractDiagram* diagram, diagrams() ) 00157 { 00158 QPair<QPointF, QPointF> dataBoundariesPair = diagram->dataBoundaries(); 00159 //qDebug() << "CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams()\ngets diagram->dataBoundaries: " << dataBoundariesPair.first << dataBoundariesPair.second; 00160 if ( bStarting || dataBoundariesPair.first.x() < minX ) minX = dataBoundariesPair.first.x(); 00161 if ( bStarting || dataBoundariesPair.first.y() < minY ) minY = dataBoundariesPair.first.y(); 00162 if ( bStarting || dataBoundariesPair.second.x() > maxX ) maxX = dataBoundariesPair.second.x(); 00163 if ( bStarting || dataBoundariesPair.second.y() > maxY ) maxY = dataBoundariesPair.second.y(); 00164 bStarting = false; 00165 } 00166 //qDebug() << "CartesianCoordinatePlane::getRawDataBoundingRectFromDiagrams()\nreturns data boundaries: " << QRectF( QPointF(minX, minY), QSizeF(maxX - minX, maxY - minY) ); 00167 QRectF dataBoundingRect; 00168 dataBoundingRect.setBottomLeft( QPointF(minX, minY) ); 00169 dataBoundingRect.setTopRight( QPointF(maxX, maxY) ); 00170 return dataBoundingRect; 00171 } |
|
Definition at line 157 of file KDChartAbstractCoordinatePlane.cpp. References d. Referenced by KDChart::PolarCoordinatePlane::gridAttributes(), and gridAttributes().
00158 { 00159 return d->gridAttributes; 00160 } |
|
Definition at line 650 of file KDChartCartesianCoordinatePlane.cpp. References d, KDChart::AbstractCoordinatePlane::globalGridAttributes(), and hasOwnGridAttributes(). Referenced by getDataDimensionsList().
00652 { 00653 if( hasOwnGridAttributes( orientation ) ){ 00654 if( orientation == Qt::Horizontal ) 00655 return d->gridAttributesHorizontal; 00656 else 00657 return d->gridAttributesVertical; 00658 }else{ 00659 return globalGridAttributes(); 00660 } 00661 } |
|
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.
Definition at line 162 of file KDChartAbstractCoordinatePlane.cpp. References d, and KDChart::DataDimensionsList. Referenced by layoutDiagrams(), KDChart::CartesianAxis::maximumSize(), and KDChart::CartesianAxis::paintCtx().
00163 { 00164 //KDChart::DataDimensionsList l( d->grid->updateData( this ) ); 00165 //qDebug() << "AbstractCoordinatePlane::gridDimensionsList() Y-range:" << l.last().end - l.last().start << " step width:" << l.last().stepWidth; 00166 //qDebug() << "AbstractCoordinatePlane::gridDimensionsList() X-range:" << l.first().end - l.first().start << " step width:" << l.first().stepWidth; 00167 return d->grid->updateData( this ); 00168 } |
|
Definition at line 673 of file KDChartCartesianCoordinatePlane.cpp. References d. Referenced by gridAttributes().
|
|
Definition at line 562 of file KDChartCartesianCoordinatePlane.cpp. References d.
|
|
Definition at line 220 of file KDChartAbstractAreaBase.cpp. References KDChart::AbstractAreaBase::areaGeometry(), and KDChart::AbstractAreaBase::getFrameLeadings(). Referenced by KDChart::TextArea::paintAll(), and KDChart::AbstractArea::paintAll().
00221 { 00222 int left; 00223 int top; 00224 int right; 00225 int bottom; 00226 getFrameLeadings( left, top, right, bottom ); 00227 return 00228 QRect( QPoint(0,0), areaGeometry().size() ) 00229 .adjusted( left, top, -right, -bottom ); 00230 } |
|
pure virtual in QLayoutItem
Definition at line 201 of file KDChartAbstractCoordinatePlane.cpp.
00202 { 00203 return false; // never empty! 00204 // coordinate planes with no associated diagrams 00205 // are showing a default grid of ()1..10, 1..10) stepWidth 1 00206 } |
|
Tests, if a point is visible on the coordinate plane.
Definition at line 275 of file KDChartAbstractCoordinatePlane.cpp. References d.
00276 { 00277 return d->isVisiblePoint( this, point ); 00278 } |
|
Distribute the available space among the diagrams and axes.
Implements KDChart::AbstractCoordinatePlane. Definition at line 316 of file KDChartCartesianCoordinatePlane.cpp. References d, KDChart::DataDimensionsList, KDChart::AbstractCoordinatePlane::diagrams(), KDChart::DataDimension::distance(), drawingArea(), KDChart::DataDimension::end, KDChart::AbstractCoordinatePlane::gridDimensionsList(), and KDChart::DataDimension::start. Referenced by adjustHorizontalRangeToData(), adjustVerticalRangeToData(), setAutoAdjustHorizontalRangeToData(), setAutoAdjustVerticalRangeToData(), setHorizontalRange(), setIsometricScaling(), and setVerticalRange().
00317 { 00318 //qDebug("KDChart::CartesianCoordinatePlane::layoutDiagrams() called"); 00319 if ( diagrams().isEmpty() ) 00320 { // FIXME evaluate what can still be prepared 00321 // FIXME decide default dimension if no diagrams are present (to make empty planes useable) 00322 } 00323 // the rectangle the diagrams cover in the *plane*: 00324 // (Why -3? We save 1px on each side for the antialiased drawing, and 00325 // respect the way QPainter calculates the width of a painted rect (the 00326 // size is the rectangle size plus the pen width). This way, most clipping 00327 // for regular pens should be avoided. When pens with a penWidth or larger 00328 // than 1 are used, this may not be sufficient. 00329 const QRectF drawArea( drawingArea() ); 00330 //qDebug() << "drawingArea() returns" << drawArea; 00331 00332 const DataDimensionsList dimensions( gridDimensionsList() ); 00333 // test for programming errors: critical 00334 Q_ASSERT_X ( dimensions.count() == 2, "CartesianCoordinatePlane::layoutDiagrams", 00335 "Error: gridDimensionsList() did not return exactly two dimensions." ); 00336 const DataDimension dimX = dimensions.first(); 00337 const DataDimension dimY = dimensions.last(); 00338 const qreal distX = dimX.distance(); 00339 const qreal distY = dimY.distance(); 00340 //qDebug() << distX << distY; 00341 const QPointF pt(qMin(dimX.start, dimX.end), qMax(dimY.start, dimY.end)); 00342 const QSizeF siz( qAbs(distX), -qAbs(distY) ); 00343 const QRectF dataBoundingRect( pt, siz ); 00344 //qDebug() << "dataBoundingRect" << dataBoundingRect; 00345 00346 // calculate the remaining rectangle, and use it as the diagram area: 00347 QRectF diagramArea = drawArea; 00348 diagramArea.setTopLeft ( QPointF ( drawArea.left(), drawArea.top() ) ); 00349 diagramArea.setBottomRight ( QPointF ( drawArea.right(), drawArea.bottom() ) ); 00350 00351 // determine coordinate transformation: 00352 QPointF diagramTopLeft = dataBoundingRect.topLeft(); 00353 double diagramWidth = dataBoundingRect.width(); 00354 double diagramHeight = dataBoundingRect.height(); 00355 double planeWidth = diagramArea.width(); 00356 double planeHeight = diagramArea.height(); 00357 double scaleX; 00358 double scaleY; 00359 00360 double diagramXUnitInCoordinatePlane; 00361 double diagramYUnitInCoordinatePlane; 00362 00363 diagramXUnitInCoordinatePlane = diagramWidth != 0 ? planeWidth / diagramWidth : 1; 00364 diagramYUnitInCoordinatePlane = diagramHeight != 0 ? planeHeight / diagramHeight : 1; 00365 // calculate isometric scaling factor to maxscale the diagram into 00366 // the coordinate system: 00367 if ( d->isometricScaling ) 00368 { 00369 double scale = qMin ( qAbs ( diagramXUnitInCoordinatePlane ), 00370 qAbs ( diagramYUnitInCoordinatePlane ) ); 00371 00372 scaleX = qAbs( scale / diagramXUnitInCoordinatePlane ); 00373 scaleY = qAbs( scale / diagramYUnitInCoordinatePlane ); 00374 } else { 00375 scaleX = 1.0; 00376 scaleY = 1.0; 00377 } 00378 00379 // calculate diagram origin in plane coordinates: 00380 QPointF coordinateOrigin = QPointF ( 00381 diagramTopLeft.x() * -diagramXUnitInCoordinatePlane, 00382 diagramTopLeft.y() * -diagramYUnitInCoordinatePlane ); 00383 coordinateOrigin += diagramArea.topLeft(); 00384 00385 d->coordinateTransformation.originTranslation = coordinateOrigin; 00386 00387 d->coordinateTransformation.diagramRect = dataBoundingRect; 00388 00389 d->coordinateTransformation.unitVectorX = diagramXUnitInCoordinatePlane; 00390 d->coordinateTransformation.unitVectorY = diagramYUnitInCoordinatePlane; 00391 00392 d->coordinateTransformation.isoScaleX = scaleX; 00393 d->coordinateTransformation.isoScaleY = scaleY; 00394 00395 // adapt diagram area to effect of isometric scaling: 00396 diagramArea.setTopLeft( translate ( dataBoundingRect.topLeft() ) ); 00397 diagramArea.setBottomRight ( translate ( dataBoundingRect.bottomRight() ) ); 00398 00399 //qDebug("KDChart::CartesianCoordinatePlane::layoutDiagrams() done,\ncalling update() now:"); 00400 update(); 00401 } |
|
Calling layoutPlanes() on the plane triggers the global KDChart::Chart::slotLayoutPlanes().
Definition at line 259 of file KDChartAbstractCoordinatePlane.cpp. References KDChart::AbstractCoordinatePlane::needLayoutPlanes(). Referenced by KDChart::AbstractCoordinatePlane::addDiagram(), KDChart::CartesianAxis::layoutPlanes(), KDChart::AbstractCartesianDiagram::layoutPlanes(), and KDChart::AbstractCoordinatePlane::replaceDiagram().
00260 { 00261 //qDebug("KDChart::AbstractCoordinatePlane::relayout() called"); 00262 emit needLayoutPlanes(); 00263 } |
|
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.
Definition at line 77 of file KDChartAbstractArea.cpp. References d. Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().
|
|
pure virtual in QLayoutItem
Definition at line 213 of file KDChartAbstractCoordinatePlane.cpp. Referenced by KDChart::AbstractCoordinatePlane::sizeHint().
00214 { 00215 // No maximum size set. Especially not parent()->size(), we are not layouting 00216 // to the parent widget's size when using Chart::paint()! 00217 return QSize(QLAYOUTSIZE_MAX, QLAYOUTSIZE_MAX); 00218 } |
|
pure virtual in QLayoutItem
Definition at line 220 of file KDChartAbstractCoordinatePlane.cpp.
00221 { 00222 return QSize(60, 60); // this default can be overwritten by derived classes 00223 } |
|
[reimplemented]
Definition at line 140 of file KDChartAbstractCoordinatePlane.cpp.
00141 {
00142 return QSize( 200, 200 );
00143 }
|
|
reimp
Definition at line 266 of file KDChartAbstractCoordinatePlane.cpp. References d. Referenced by KDChart::Chart::mousePressEvent().
00267 { 00268 KDAB_FOREACH( AbstractDiagram * a, d->diagrams ) 00269 { 00270 a->mousePressEvent( event ); 00271 } 00272 } |
|
Emitted when plane needs to trigger the Chart's layouting of the coord. planes. Referenced by KDChart::AbstractCoordinatePlane::layoutPlanes(). |
|
Emitted when plane needs to trigger the Chart's layouting.
Referenced by KDChart::AbstractCoordinatePlane::relayout(). |
|
Emitted when plane needs to update its drawings.
|
|
reimpl
Implements KDChart::AbstractLayoutItem. Definition at line 97 of file KDChartCartesianCoordinatePlane.cpp. References KDChart::AbstractDiagramList, d, KDChart::AbstractCoordinatePlane::diagrams(), drawingArea(), KDChart::PaintContext::setCoordinatePlane(), KDChart::PaintContext::setPainter(), and KDChart::PaintContext::setRectangle().
00098 { 00099 // prevent recursive call: 00100 //qDebug("attempt plane::paint()"); 00101 if( d->bPaintIsRunning ){ 00102 return; 00103 } 00104 d->bPaintIsRunning = true; 00105 00106 //qDebug() << "start plane::paint()"; 00107 00108 AbstractDiagramList diags = diagrams(); 00109 if ( !diags.isEmpty() ) 00110 { 00111 PaintContext ctx; 00112 ctx.setPainter ( painter ); 00113 ctx.setCoordinatePlane ( this ); 00114 const QRectF drawArea( drawingArea() ); 00115 ctx.setRectangle ( drawArea ); 00116 00117 // enabling clipping so that we're not drawing outside 00118 PainterSaver painterSaver( painter ); 00119 QRect clipRect = drawArea.toRect().adjusted( -1, -1, 1, 1 ); 00120 QRegion clipRegion( clipRect ); 00121 painter->setClipRegion( clipRegion ); 00122 00123 // paint the coordinate system rulers: 00124 d->grid->drawGrid( &ctx ); 00125 00126 // paint the diagrams: 00127 for ( int i = 0; i < diags.size(); i++ ) 00128 { 00129 //qDebug(" start diags[i]->paint ( &ctx );"); 00130 PainterSaver diagramPainterSaver( painter ); 00131 diags[i]->paint ( &ctx ); 00132 //qDebug(" done: diags[i]->paint ( &ctx );"); 00133 } 00134 00135 //for debugging: 00136 // painter->drawRect( drawArea.adjusted(4,4,-4,-4) ); 00137 // painter->drawRect( drawArea.adjusted(2,2,-2,-2) ); 00138 // painter->drawRect( drawArea ); 00139 } 00140 d->bPaintIsRunning = false; 00141 //qDebug("done: plane::paint()"); 00142 } |
|
Call paintAll, if you want the background and the frame to be drawn before the normal paint() is invoked automatically.
Reimplemented from KDChart::AbstractLayoutItem. 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 } |
|
Definition at line 188 of file KDChartAbstractAreaBase.cpp. References d, and KDChart::AbstractAreaBase::paintBackgroundAttributes(). Referenced by KDChart::TextArea::paintAll(), KDChart::AbstractAreaWidget::paintAll(), and KDChart::AbstractArea::paintAll().
00189 { 00190 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintBackground()", 00191 "Private class was not initialized!" ); 00192 paintBackgroundAttributes( painter, rect, d->backgroundAttributes ); 00193 } |
|
Definition at line 119 of file KDChartAbstractAreaBase.cpp. References KDChart::BackgroundAttributes::brush(), KDChart::BackgroundAttributes::isVisible(), KDChart::BackgroundAttributes::pixmap(), and KDChart::BackgroundAttributes::pixmapMode(). Referenced by KDChart::AbstractAreaBase::paintBackground().
00121 { 00122 if( !attributes.isVisible() ) return; 00123 00124 /* first draw the brush (may contain a pixmap)*/ 00125 if( Qt::NoBrush != attributes.brush().style() ) { 00126 KDChart::PainterSaver painterSaver( &painter ); 00127 painter.setPen( Qt::NoPen ); 00128 const QPointF newTopLeft( painter.deviceMatrix().map( rect.topLeft() ) ); 00129 painter.setBrushOrigin( newTopLeft ); 00130 painter.setBrush( attributes.brush() ); 00131 painter.drawRect( rect.adjusted( 0, 0, -1, -1 ) ); 00132 } 00133 /* next draw the backPixmap over the brush */ 00134 if( !attributes.pixmap().isNull() && 00135 attributes.pixmapMode() != BackgroundAttributes::BackgroundPixmapModeNone ) { 00136 QPointF ol = rect.topLeft(); 00137 if( BackgroundAttributes::BackgroundPixmapModeCentered == attributes.pixmapMode() ) 00138 { 00139 ol.setX( rect.center().x() - attributes.pixmap().width() / 2 ); 00140 ol.setY( rect.center().y() - attributes.pixmap().height()/ 2 ); 00141 painter.drawPixmap( ol, attributes.pixmap() ); 00142 } else { 00143 QMatrix m; 00144 double zW = (double)rect.width() / (double)attributes.pixmap().width(); 00145 double zH = (double)rect.height() / (double)attributes.pixmap().height(); 00146 switch( attributes.pixmapMode() ) { 00147 case BackgroundAttributes::BackgroundPixmapModeScaled: 00148 { 00149 double z; 00150 z = qMin( zW, zH ); 00151 m.scale( z, z ); 00152 } 00153 break; 00154 case BackgroundAttributes::BackgroundPixmapModeStretched: 00155 m.scale( zW, zH ); 00156 break; 00157 default: 00158 ; // Cannot happen, previously checked 00159 } 00160 QPixmap pm = attributes.pixmap().transformed( m ); 00161 ol.setX( rect.center().x() - pm.width() / 2 ); 00162 ol.setY( rect.center().y() - pm.height()/ 2 ); 00163 painter.drawPixmap( ol, pm ); 00164 } 00165 } 00166 } |
|
Default impl: Paint the complete item using its layouted position and size.
Reimplemented in KDChart::CartesianAxis. 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 } |
|
|
|
Definition at line 196 of file KDChartAbstractAreaBase.cpp. References d, and KDChart::AbstractAreaBase::paintFrameAttributes(). Referenced by KDChart::TextArea::paintAll(), KDChart::AbstractAreaWidget::paintAll(), and KDChart::AbstractArea::paintAll().
00197 { 00198 Q_ASSERT_X ( d != 0, "AbstractAreaBase::paintFrame()", 00199 "Private class was not initialized!" ); 00200 paintFrameAttributes( painter, rect, d->frameAttributes ); 00201 } |
|
Definition at line 169 of file KDChartAbstractAreaBase.cpp. References KDChart::FrameAttributes::isVisible(), and KDChart::FrameAttributes::pen(). Referenced by KDChart::AbstractAreaBase::paintFrame().
00171 { 00172 00173 if( !attributes.isVisible() ) return; 00174 00175 // Note: We set the brush to NoBrush explicitely here. 00176 // Otherwise we might get a filled rectangle, so any 00177 // previously drawn background would be overwritten by that area. 00178 00179 const QPen oldPen( painter.pen() ); 00180 const QBrush oldBrush( painter.brush() ); 00181 painter.setPen( attributes.pen() ); 00182 painter.setBrush( Qt::NoBrush ); 00183 painter.drawRect( rect.adjusted( 0, 0, -1, -1 ) ); 00184 painter.setBrush( oldBrush ); 00185 painter.setPen( oldPen ); 00186 } |
|
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 } |
|
Definition at line 190 of file KDChartAbstractCoordinatePlane.cpp. References d.
00191 { 00192 return d->parent; 00193 } |
|
Definition at line 195 of file KDChartAbstractCoordinatePlane.cpp. References d. Referenced by KDChart::CartesianAxis::maximumSize(), and KDChart::CartesianAxis::paintCtx().
00196 { 00197 return d->parent; 00198 } |
|
Definition at line 74 of file KDChartLayoutItems.h.
00075 { 00076 return mParentLayout; 00077 } |
|
Reimplemented from KDChart::AbstractAreaBase. Definition at line 155 of file KDChartAbstractArea.cpp.
00156 {
00157 emit positionChanged( this );
00158 }
|
|
Emitted upon change of a property of the Coordinate Plane or any of its components.
Referenced by addDiagram(), adjustHorizontalRangeToData(), adjustVerticalRangeToData(), setAutoAdjustGridToZoom(), setAutoAdjustHorizontalRangeToData(), setAutoAdjustVerticalRangeToData(), setAxesCalcModes(), setAxesCalcModeX(), setAxesCalcModeY(), KDChart::PolarCoordinatePlane::setGridAttributes(), setGridAttributes(), setHorizontalRange(), setIsometricScaling(), setVerticalRange(), setZoomCenter(), setZoomFactorX(), and setZoomFactorY(). |
|
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.
Definition at line 180 of file KDChartAbstractCoordinatePlane.cpp. References d.
00181 { 00182 return d->referenceCoordinatePlane; 00183 } |
|
Calling relayout() on the plane triggers the global KDChart::Chart::slotRelayout().
Definition at line 253 of file KDChartAbstractCoordinatePlane.cpp. References KDChart::AbstractCoordinatePlane::needRelayout().
00254 { 00255 //qDebug("KDChart::AbstractCoordinatePlane::relayout() called"); 00256 emit needRelayout(); 00257 } |
|
Definition at line 78 of file KDChartLayoutItems.h. Referenced by KDChart::Chart::takeCoordinatePlane().
00079 { 00080 if( mParentLayout ){ 00081 if( widget() ) 00082 mParentLayout->removeWidget( widget() ); 00083 else 00084 mParentLayout->removeItem( this ); 00085 } 00086 } |
|
Replaces the old diagram, or appends the diagram, it there is none yet.
Definition at line 82 of file KDChartAbstractCoordinatePlane.cpp. References KDChart::AbstractCoordinatePlane::addDiagram(), d, KDChart::AbstractCoordinatePlane::layoutDiagrams(), KDChart::AbstractCoordinatePlane::layoutPlanes(), and KDChart::AbstractCoordinatePlane::takeDiagram().
00083 { 00084 if( diagram && oldDiagram_ != diagram ){ 00085 AbstractDiagram* oldDiagram = oldDiagram_; 00086 if( d->diagrams.count() ){ 00087 if( ! oldDiagram ) 00088 oldDiagram = d->diagrams.first(); 00089 takeDiagram( oldDiagram ); 00090 } 00091 delete oldDiagram; 00092 addDiagram( diagram ); 00093 layoutDiagrams(); 00094 layoutPlanes(); // there might be new axes, etc 00095 update(); 00096 } 00097 } |
|
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.
Definition at line 643 of file KDChartCartesianCoordinatePlane.cpp.
00645 {
00646 setHasOwnGridAttributes( orientation, false );
00647 update();
00648 }
|
|
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.
Definition at line 85 of file KDChartAbstractArea.cpp. References d. Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().
|
|
Disable / re-enable the built-in grid adjusting feature. By default additional lines will be drawn in a Linear grid when zooming in.
Definition at line 682 of file KDChartCartesianCoordinatePlane.cpp. References d, and KDChart::AbstractCoordinatePlane::propertiesChanged().
00683 { 00684 if( d->autoAdjustGridToZoom != autoAdjust ){ 00685 d->autoAdjustGridToZoom = autoAdjust; 00686 d->grid->setNeedRecalculate(); 00687 emit propertiesChanged(); 00688 } 00689 } |
|
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 Set percentEmpty to 100 to disable automatic range adjusting.
Definition at line 601 of file KDChartCartesianCoordinatePlane.cpp. References d, layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().
00602 { 00603 d->autoAdjustHorizontalRangeToData = percentEmpty; 00604 d->horizontalMin = 0.0; 00605 d->horizontalMax = 0.0; 00606 layoutDiagrams(); 00607 emit propertiesChanged(); 00608 } |
|
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 Set percentEmpty to 100 to disable automatic range adjusting.
Definition at line 610 of file KDChartCartesianCoordinatePlane.cpp. References d, layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().
00611 { 00612 d->autoAdjustVerticalRangeToData = percentEmpty; 00613 d->verticalMin = 0.0; 00614 d->verticalMax = 0.0; 00615 layoutDiagrams(); 00616 emit propertiesChanged(); 00617 } |
|
Specifies the calculation modes for all axes.
Definition at line 513 of file KDChartCartesianCoordinatePlane.cpp. References d, and KDChart::AbstractCoordinatePlane::propertiesChanged().
00514 { 00515 if( d->coordinateTransformation.axesCalcModeY != mode || 00516 d->coordinateTransformation.axesCalcModeX != mode ){ 00517 d->coordinateTransformation.axesCalcModeY = mode; 00518 d->coordinateTransformation.axesCalcModeX = mode; 00519 emit propertiesChanged(); 00520 } 00521 } |
|
Specifies the calculation mode for all Abscissa axes.
Definition at line 531 of file KDChartCartesianCoordinatePlane.cpp. References d, and KDChart::AbstractCoordinatePlane::propertiesChanged().
00532 { 00533 if( d->coordinateTransformation.axesCalcModeX != mode ){ 00534 d->coordinateTransformation.axesCalcModeX = mode; 00535 emit propertiesChanged(); 00536 } 00537 } |
|
Specifies the calculation mode for all Ordinate axes.
Definition at line 523 of file KDChartCartesianCoordinatePlane.cpp. References d, and KDChart::AbstractCoordinatePlane::propertiesChanged().
00524 { 00525 if( d->coordinateTransformation.axesCalcModeY != mode ){ 00526 d->coordinateTransformation.axesCalcModeY = mode; 00527 emit propertiesChanged(); 00528 } 00529 } |
|
Definition at line 107 of file KDChartAbstractAreaBase.cpp. References d.
00108 { 00109 d->backgroundAttributes = a; 00110 } |
|
Definition at line 97 of file KDChartAbstractAreaBase.cpp. References d. Referenced by KDChart::Legend::clone().
00098 { 00099 d->frameAttributes = a; 00100 } |
|
pure virtual in QLayoutItem
Definition at line 232 of file KDChartAbstractCoordinatePlane.cpp. References d.
|
|
Set the grid attributes to be used by this coordinate plane. To disable grid painting, for example, your code should like this:
Definition at line 151 of file KDChartAbstractCoordinatePlane.cpp. References d.
00152 { 00153 d->gridAttributes = a; 00154 update(); 00155 } |
|
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:
Definition at line 630 of file KDChartCartesianCoordinatePlane.cpp. References d, and KDChart::AbstractCoordinatePlane::propertiesChanged().
00633 { 00634 if( orientation == Qt::Horizontal ) 00635 d->gridAttributesHorizontal = a; 00636 else 00637 d->gridAttributesVertical = a; 00638 setHasOwnGridAttributes( orientation, true ); 00639 update(); 00640 emit propertiesChanged(); 00641 } |
|
Used by the chart to clear the cached grid data.
Definition at line 170 of file KDChartAbstractCoordinatePlane.cpp. References d. Referenced by KDChart::Chart::resizeEvent().
00171 { 00172 d->grid->setNeedRecalculate(); 00173 } |
|
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 setting both values to the same which constitutes a null range.
Definition at line 539 of file KDChartCartesianCoordinatePlane.cpp. References d, layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().
00540 { 00541 if ( d->horizontalMin != range.first || d->horizontalMax != range.second ) { 00542 d->autoAdjustHorizontalRangeToData = 100; 00543 d->horizontalMin = range.first; 00544 d->horizontalMax = range.second; 00545 layoutDiagrams(); 00546 emit propertiesChanged(); 00547 } 00548 } |
|
Definition at line 418 of file KDChartCartesianCoordinatePlane.cpp. References d, layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().
00419 { 00420 if ( d->isometricScaling != onOff ) 00421 { 00422 d->isometricScaling = onOff; 00423 layoutDiagrams(); 00424 emit propertiesChanged(); 00425 } 00426 } |
|
Called internally by KDChart::Chart.
Definition at line 185 of file KDChartAbstractCoordinatePlane.cpp. References d. Referenced by KDChart::Chart::addCoordinatePlane(), and KDChart::Chart::takeCoordinatePlane().
00186 { 00187 d->parent = parent; 00188 } |
|
Definition at line 70 of file KDChartLayoutItems.h.
00071 { 00072 mParentLayout = lay; 00073 } |
|
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::Legend::buildLegend(), and KDChart::AbstractCartesianDiagram::takeAxis().
00065 { 00066 mParent = widget; 00067 } |
|
Set another coordinate plane to be used as the reference plane for this one.
Definition at line 175 of file KDChartAbstractCoordinatePlane.cpp. References d.
00176 { 00177 d->referenceCoordinatePlane = plane; 00178 } |
|
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.
Definition at line 550 of file KDChartCartesianCoordinatePlane.cpp. References d, layoutDiagrams(), and KDChart::AbstractCoordinatePlane::propertiesChanged().
00551 { 00552 00553 if ( d->verticalMin != range.first || d->verticalMax != range.second ) { 00554 d->autoAdjustVerticalRangeToData = 100; 00555 d->verticalMin = range.first; 00556 d->verticalMax = range.second; 00557 layoutDiagrams(); 00558 emit propertiesChanged(); 00559 } 00560 } |
|
Reimplemented from KDChart::AbstractCoordinatePlane. Definition at line 480 of file KDChartCartesianCoordinatePlane.cpp. References doneSetZoomCenter(), and KDChart::AbstractCoordinatePlane::propertiesChanged().
00481 { 00482 if( doneSetZoomCenter( point ) ){ 00483 emit propertiesChanged(); 00484 } 00485 } |
|
Reimplemented from KDChart::AbstractCoordinatePlane. Definition at line 466 of file KDChartCartesianCoordinatePlane.cpp. References doneSetZoomFactorX(), and KDChart::AbstractCoordinatePlane::propertiesChanged().
00467 { 00468 if( doneSetZoomFactorX( factor ) ){ 00469 emit propertiesChanged(); 00470 } 00471 } |
|
Reimplemented from KDChart::AbstractCoordinatePlane. Definition at line 473 of file KDChartCartesianCoordinatePlane.cpp. References doneSetZoomFactorY(), and KDChart::AbstractCoordinatePlane::propertiesChanged().
00474 { 00475 if( doneSetZoomFactorY( factor ) ){ 00476 emit propertiesChanged(); 00477 } 00478 } |
|
pure virtual in QLayoutItem
Definition at line 225 of file KDChartAbstractCoordinatePlane.cpp. References KDChart::AbstractCoordinatePlane::maximumSize().
00226 { 00227 // we return our maxiumu (which is the full size of the Chart) 00228 // even if we know the plane will be smaller 00229 return maximumSize(); 00230 } |
|
Report changed size hint: ask the parent widget to recalculate the layout.
Definition at line 86 of file KDChartLayoutItems.cpp. 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 } |
|
[reimplemented]
Definition at line 146 of file KDChartAbstractCoordinatePlane.cpp.
00147 {
00148 return QSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
00149 }
|
|
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.
Definition at line 100 of file KDChartAbstractCoordinatePlane.cpp. References d, KDChart::AbstractCoordinatePlane::layoutDiagrams(), and KDChart::AbstractDiagram::setCoordinatePlane(). Referenced by KDChart::AbstractCoordinatePlane::replaceDiagram().
00101 { 00102 const int idx = d->diagrams.indexOf( diagram ); 00103 if( idx != -1 ){ 00104 d->diagrams.removeAt( idx ); 00105 diagram->setParent( 0 ); 00106 diagram->setCoordinatePlane( 0 ); 00107 layoutDiagrams(); 00108 update(); 00109 } 00110 } |
|
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.
Definition at line 93 of file KDChartAbstractArea.cpp. References d. Referenced by KDChart::AutoSpacerLayoutItem::sizeHint().
|
|
Translate the given point in value space coordinates to a position in pixel space.
Implements KDChart::AbstractCoordinatePlane. Definition at line 404 of file KDChartCartesianCoordinatePlane.cpp. References d. Referenced by KDChart::BarDiagram::paint(), and KDChart::CartesianAxis::paintCtx().
00405 { 00406 // Note: We do not test if the point lays inside of the data area, 00407 // but we just apply the transformation calculations to the point. 00408 // This allows for basic calculations done by the user, see e.g. 00409 // the file examples/Lines/BubbleChart/mainwindow.cpp 00410 return d->coordinateTransformation.translate ( diagramPoint ); 00411 } |
|
Definition at line 413 of file KDChartCartesianCoordinatePlane.cpp. References d.
00414 { 00415 return d->coordinateTransformation.translateBack ( screenPoint ); 00416 } |
|
Definition at line 567 of file KDChartCartesianCoordinatePlane.cpp. References d.
|
|
Reimplemented from KDChart::AbstractCoordinatePlane. Definition at line 487 of file KDChartCartesianCoordinatePlane.cpp. References d.
00488 { 00489 return d->coordinateTransformation.zoom.center(); 00490 } |
|
Reimplemented from KDChart::AbstractCoordinatePlane. Definition at line 492 of file KDChartCartesianCoordinatePlane.cpp. References d.
00493 { 00494 return d->coordinateTransformation.zoom.xFactor; 00495 } |
|
Reimplemented from KDChart::AbstractCoordinatePlane. Definition at line 497 of file KDChartCartesianCoordinatePlane.cpp. References d.
00498 { 00499 return d->coordinateTransformation.zoom.yFactor; 00500 } |
|
Reimplemented from KDChart::AbstractArea. Definition at line 297 of file KDChartAbstractCoordinatePlane.h. |
|
Definition at line 88 of file KDChartLayoutItems.h. Referenced by KDChart::AbstractLayoutItem::setParentWidget(). |
|
Definition at line 89 of file KDChartLayoutItems.h. |
|
Reimplemented from KDChart::AbstractCoordinatePlane. Definition at line 374 of file KDChartCartesianCoordinatePlane.h. |
|
Reimplemented from KDChart::AbstractCoordinatePlane. Definition at line 342 of file KDChartCartesianCoordinatePlane.h. |