Re: kdchart: new and old bugs

Dag Andersen <[email protected]>
Newsgroups gmane.comp.kde.devel.koffice
Message-ID <[email protected]>
Torsdag 04 november 2010 13:19:57 skrev Johannes Simon:
> Hello Dag,
> 
> Thanks for the patches. However I think you attached the same patch twice
> :-)
True, new one attached.
> Please mail me a summary how I can reproduce the bugs you found and I
> will enter it in KDAB's bug tracker.
In short:
Create two coordinate planes (p1 and p2) with diagrams that share an axis (I 
use x-axis). Something like this:
 p1 = new CartesianCoordinatePlane( chart );
 p2 = new CartesianCoordinatePlane( chart );
 p2->setReferenceCoordinatePlane( p1 );

 BarDiagram *b1 = new BarDiagram( chart, p1 );

 CartesianAxis *yaxis1 = new CartesianAxis( b1 );
 yaxis1->setPosition( CartesianAxis::Right );
 b1->addAxis( xaxis );
 p1->addDiagram( b1 );

 BarDiagram *b2 = new BarDiagram( chart, p2 );

 CartesianAxis *yaxis2 = new CartesianAxis( b2 );
 yaxis2->setPosition( CartesianAxis::Left );
 b2->addAxis( yaxis2 );
 p2->addDiagram( b2 );

 CartesianAxis *xaxis  = new CartesianAxis();
 xaxis->setPosition( CartesianAxis::Bottom );
 b1->addAxis( xaxis );
 b2->addAxis( xaxis );

Grid problem:
 Hiding grid in p1 hides grids in both planes.
 Hiding grid in p2 has no effect.
 (Also the p2 grid overpaints the data of p1, but thats a different issue)

Clipping problem:
 The data of p2 is clipped to a small area close to the x-axis.

-- 
Mvh.
Dag Andersen
> 
> In principle every bugfix in 2.3 should also be in 2.4, so it must be a
> regression.
> 
> Thanks.
> Johannes
> 
> Am 04.11.2010 um 12:24 schrieb Dag Andersen:
> > Hi,
> > since 2.4 was introduced charts with planes sharing axis does not work.
> > 
> > New bug: Clipping has been introduced in
> > BarDiagram::paint(PaintContext*ctx). I haven't found exactly where
> > things go wrong, there is a lot transformations in there, so the
> > attached patch is just a work-around.
> > 
> > Old bug: Hiding grid. The wrong plane is checked to see if grid shall be
> > hidden in CartesianGrid::drawGrid(PaintContext*context). This was fixed
> > in 2.3 but somehow didn't make into 2.4. Was that on purpose or just a
> > misstake?
> > 
> > See att pathches.

_______________________________________________
koffice-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/koffice-devel
grid.diff (text/x-patch, 1.5 KB)
Index: KDChartCartesianGrid.cpp
===================================================================
--- KDChartCartesianGrid.cpp	(revision 1184626)
+++ KDChartCartesianGrid.cpp	(working copy)
@@ -68,7 +68,16 @@
     //qDebug() << "KDChart::CartesianGrid::drawGrid( PaintContext* context ) called";
 
     CartesianCoordinatePlane* plane = dynamic_cast<CartesianCoordinatePlane*>(context->coordinatePlane());
-   
+    Q_ASSERT_X ( plane, "CartesianGrid::drawGrid",
+                 "Bad function call: PaintContext::coodinatePlane() NOT a cartesian plane." );
+    const GridAttributes gridAttrsX( plane->gridAttributes( Qt::Horizontal ) );
+    const GridAttributes gridAttrsY( plane->gridAttributes( Qt::Vertical ) );
+
+    //qDebug() << "OK:";
+    if ( !gridAttrsX.isGridVisible() && !gridAttrsY.isGridVisible() ) {
+        return;
+    }
+
     // This plane is used for tranlating the coordinates - not for the data boundaries
     PainterSaver p( context->painter() );
     plane = dynamic_cast< CartesianCoordinatePlane* >( plane->sharedAxisMasterPlane( context->painter() ) );
@@ -77,11 +86,6 @@
                  "Bad function call: PaintContext::coodinatePlane() NOT a cartesian plane." );
 
 
-    const GridAttributes gridAttrsX( plane->gridAttributes( Qt::Horizontal ) );
-    const GridAttributes gridAttrsY( plane->gridAttributes( Qt::Vertical ) );
-
-    //qDebug() << "OK:";
-    if ( !gridAttrsX.isGridVisible() && !gridAttrsY.isGridVisible() ) return;
     //qDebug() << "A";
 
     // important: Need to update the calculated mData,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.