KDChartCartesianAxis.cpp File Reference

#include <cmath>
#include <QtDebug>
#include <QPainter>
#include <QPen>
#include <QBrush>
#include <QApplication>
#include "KDChartPaintContext.h"
#include "KDChartChart.h"
#include "KDChartCartesianAxis.h"
#include "KDChartCartesianAxis_p.h"
#include "KDChartAbstractCartesianDiagram.h"
#include "KDChartAbstractGrid.h"
#include "KDChartPainterSaver_p.h"
#include "KDChartLayoutItems.h"
#include "KDChartBarDiagram.h"
#include <KDABLibFakes>
#include <limits>

Include dependency graph for KDChartCartesianAxis.cpp:

Go to the source code of this file.

Defines

#define d   (d_func())

Functions

static void calculateNextLabel (qreal &labelValue, qreal step, bool isLogarithmic)
static void calculateOverlap (int i, int first, int last, int measure, bool isBarDiagram, int &firstOverlap, int &lastOverlap)
static bool referenceDiagramIsBarDiagram (const AbstractDiagram *diagram)


Define Documentation

#define d   (d_func())

Definition at line 50 of file KDChartCartesianAxis.cpp.


Function Documentation

static void calculateNextLabel ( qreal &  labelValue,
qreal  step,
bool  isLogarithmic 
) [static]

Definition at line 349 of file KDChartCartesianAxis.cpp.

Referenced by KDChart::CartesianAxis::paintCtx().

00350 {
00351     if ( isLogarithmic ){
00352         labelValue *= 10.0;
00353         if( labelValue == 0.0 )
00354             labelValue = 1.0;//std::numeric_limits< double >::epsilon();
00355     }else{
00356         //qDebug() << "new axis label:" << labelValue << "+" << step << "=" << labelValue+step;
00357         labelValue += step;
00358     }
00359 /*    if( qAbs(labelValue) < 1.0e-15 )
00360         labelValue = 0.0;*/
00361 }

static void calculateOverlap ( int  i,
int  first,
int  last,
int  measure,
bool  isBarDiagram,
int &  firstOverlap,
int &  lastOverlap 
) [static]

Definition at line 1012 of file KDChartCartesianAxis.cpp.

Referenced by KDChart::CartesianAxis::maximumSize().

01016 {
01017     if( i == first ){
01018         if( isBarDiagram ){
01019             //TODO(khz): Calculate the amount of left overlap
01020             //           for bar diagrams.
01021         }else{
01022             firstOverlap = measure / 2;
01023         }
01024     }
01025     // we test both bounds in on go: first and last might be equal
01026     if( i == last ){
01027         if( isBarDiagram ){
01028             //TODO(khz): Calculate the amount of right overlap
01029             //           for bar diagrams.
01030         }else{
01031             lastOverlap = measure / 2;
01032         }
01033     }
01034 }

static bool referenceDiagramIsBarDiagram ( const AbstractDiagram diagram  )  [static]

Definition at line 364 of file KDChartCartesianAxis.cpp.

References KDChart::AbstractCartesianDiagram::referenceDiagram().

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

00365 {
00366     const AbstractCartesianDiagram * dia =
00367             qobject_cast< const AbstractCartesianDiagram * >( diagram );
00368     if( dia && dia->referenceDiagram() )
00369         dia = dia->referenceDiagram();
00370     return qobject_cast< const BarDiagram* >( dia ) != 0;
00371 }


Generated on Mon Sep 17 16:17:10 2007 for KD Chart 2 by  doxygen 1.5.1