[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/plugins/chartshape/kdchart/src
From:       Johannes Simon <johannes.simon () gmail ! com>
Date:       2010-10-21 13:12:30
Message-ID: 20101021131230.D7E64AC89D () svn ! kde ! org
[Download RAW message or body]

SVN commit 1188122 by jsimon:

The abscissa or ordinate orientation isn't fixed in fact, it depends on the diagram \
type. A lying bar diagram has the axes swapped, in any other case the abscissa is the \
horizontal axis and the ordinate the vertical.

 M  +2 -2      KDChartAbstractDiagram.cpp  
 M  +22 -0     KDChartAbstractDiagram_p.h  
 M  +12 -0     KDChartBarDiagram_p.cpp  
 M  +5 -0      KDChartBarDiagram_p.h  


--- trunk/koffice/plugins/chartshape/kdchart/src/KDChartAbstractDiagram.cpp \
#1188121:1188122 @@ -1007,9 +1007,9 @@
         const int rowCount = \
attributesModel()->rowCount(attributesModelRootIndex());  for( int i = 0; i < \
                rowCount; ++i ){
             //qDebug() << "item row label: " << attributesModel()->headerData( i, \
                Qt::Vertical, Qt::DisplayRole ).toString();
-            ret << unitPrefix( i, Qt::Horizontal, true ) +
+            ret << unitPrefix( i, d->abscissaOrientation(), true ) +
                    attributesModel()->headerData( i, Qt::Vertical, Qt::DisplayRole \
                ).toString() +
-                   unitSuffix( i, Qt::Horizontal, true );
+                   unitSuffix( i, d->abscissaOrientation(), true );
         }
     }
     return ret;
--- trunk/koffice/plugins/chartshape/kdchart/src/KDChartAbstractDiagram_p.h \
#1188121:1188122 @@ -487,6 +487,28 @@
             attributesModel->resetHeaderData( column, Qt::Horizontal, role );
         }
 
+        /**
+         * @return the orientation an x-axis of this diagram has to have.
+         *
+         * Note: In most cases, this is Qt::Horizontal though it may be
+         * overridden in certain chart types, like a lying bar diagram, where
+         * the x-axis is vertically aligned.
+         */
+        virtual Qt::Orientation abscissaOrientation() const {
+            return Qt::Horizontal;
+        }
+
+        /**
+         * @return the orientation a y-axis of this diagram has to have.
+         *
+         * Note: In most cases, this is Qt::Vertical though it may be
+         * overridden in certain chart types, like a lying bar diagram, where
+         * the y-axis is horizontally aligned.
+         */
+        virtual Qt::Orientation ordinateOrientation() const {
+            return Qt::Vertical;
+        }
+
     protected:
         void init();
         void init( AbstractCoordinatePlane* plane );
--- trunk/koffice/plugins/chartshape/kdchart/src/KDChartBarDiagram_p.cpp \
#1188121:1188122 @@ -32,6 +32,18 @@
 {
 }
 
+Qt::Orientation BarDiagram::Private::abscissaOrientation() const
+{
+    if ( orientation == Qt::Horizontal )
+        return Qt::Vertical;
+    return Qt::Horizontal;
+}
+
+Qt::Orientation BarDiagram::Private::ordinateOrientation() const
+{
+    return orientation;
+}
+
 void BarDiagram::BarDiagramType::paintBars( PaintContext* ctx, const QModelIndex& \
index, const QRectF& bar, double& maxDepth )  {
     QRectF isoRect;
--- trunk/koffice/plugins/chartshape/kdchart/src/KDChartBarDiagram_p.h \
#1188121:1188122 @@ -88,6 +88,11 @@
     BarDiagramType* stackedLyingDiagram;
     BarDiagramType* percentLyingDiagram;
 
+    // reimplemented from AbstractDiagram::Private
+    Qt::Orientation abscissaOrientation() const;
+    // reimplemented from AbstractDiagram::Private
+    Qt::Orientation ordinateOrientation() const;
+
 /* refactoring */
 /*
     BarType barType;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic