[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:28
Message-ID: 20101021131228.DA4DFAC899 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1188120 by jsimon:

Correctly calculate data boundaries (min/max x/y values) in line diagram with missing values

 M  +19 -1     KDChartNormalLineDiagram_p.cpp  


--- trunk/koffice/plugins/chartshape/kdchart/src/KDChartNormalLineDiagram_p.cpp #1188119:1188120
@@ -61,8 +61,26 @@
         {
             const CartesianDiagramDataCompressor::CachePosition position( row, column );
             const CartesianDiagramDataCompressor::DataPoint point = compressor().data( position );
-            const double value = ISNAN( point.value ) ? 0.0 : point.value;
+            double value = point.value;
 
+            if ( ISNAN( value ) ) {
+                const QModelIndex &index = diagram()->model()->index( row, column );
+                const LineAttributes &attr = diagram()->lineAttributes( index );
+                switch ( attr.missingValuesPolicy() ) {
+                // In these cases the bounds aren't effected at all by this point
+                case LineAttributes::MissingValuesAreBridged:
+                    // same as MissingValuesHideSegments because the value of
+                    // this (missing) value simply does not effect the bounds
+                case LineAttributes::MissingValuesHideSegments:
+                    continue;
+                case LineAttributes::MissingValuesShownAsZero:
+                    value = 0;
+                    break;
+                case LineAttributes::MissingValuesPolicyIgnored:
+                    break;
+                }
+            }
+
             if ( ISNAN( yMin ) ) {
                     yMin = value;
                     yMax = value;
[prev in list] [next in list] [prev in thread] [next in thread] 

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