Bug 111850

Summary: Data Wizard mungs Axis Labels when no label generation requested
Product: [Applications] kst Reporter: D. V. Wiebe <dvw>
Component: generalAssignee: kst
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.x   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description D. V. Wiebe 2005-08-31 23:55:33 UTC
Version:           1.2.0_devel (using KDE 3.4.2, compiled sources)
Compiler:          gcc version 3.3.6
OS:                Linux (i686) release 2.6.11.11

When using the data wizard to place a new curve in an already existing plot, the data wizard will delete the axis and plot labels if the checkboxes under Label Generation are deselected.

Steps to reproduce:

1) Create a plot (P1).  Make note of the current axis labels.
2) Using the data wizard, specify a new curve.
3) On the Plot Layout page of the wizard, under Curve Placement, choose "All Curves in Plot [P1]"
4) On the same page, under Label Generation, uncheck the boxes "X-Axis labels", "Y-Axis labels", "Title labels".
5) "Finish"

Result:

The old axes labels are deleted.  No new axes labels are created.

Expected Result:

The axes labels are left unchanged.
Comment 1 Nicolas Brisset 2005-09-01 10:33:32 UTC
I find that report subject to debate. If you explicitly ask for the curves to be put in an existing plot AND at the same time explicitly disable axis generation for the plot, then I find the current behavior consistent. Either you want to keep axis labels and leave label generation "on", or you want to suppress labels and turn it "off".
However, there is indeed one thing that can be considered to be a bug in my opinion: axis labels are not updated when curves are added. If you create P1 with curve C1, and subsequently add curve C2 to P1 with the datawizard and leave axis labels on, they are not updated to reflect the new contents.
Comment 2 Netterfield 2005-09-04 00:28:25 UTC
SVN commit 456870 by netterfield:

BUG: 111850

Selecting to update labels updates the labels (adds new curve to the
list)
Selecting to not update labels does nothing to the labels.

There is now no way to add a curve but delete the labels from
the data manager.



 M  +3 -12     datawizard.ui.h  
 M  +7 -4      kst2dplot.cpp  
 M  +1 -1      kst2dplot.h  


--- trunk/extragear/graphics/kst/kst/datawizard.ui.h #456869:456870
@@ -6,6 +6,7 @@
 ** init() function in place of a constructor, and a destroy() function in
 ** place of a destructor.
 *****************************************************************************/
+#include <stdio.h>
 const QString& DataWizard::defaultTag = KGlobal::staticQString("<Auto Name>");
 
 void DataWizard::init()
@@ -741,7 +742,7 @@
 	    KST::dataObjectList.append(KstDataObjectPtr(c));
 	    KST::dataObjectList.lock().writeUnlock();
 	    if (plot) {
-        plot->addCurve(KstBaseCurvePtr(c));
+       plot->addCurve(KstBaseCurvePtr(c));
 	    }
 	    if (!_onePlot->isChecked()) { // change plots if we are not onePlot
 		if (_radioButtonPlotDataPSD->isChecked()) { // if xy and psd
@@ -852,16 +853,7 @@
 	    ++pit;
 	    continue;
 	}
-	pp->GenerateDefaultLabels();
-	if (!xl) {
-	    pp->setXLabel(QString::null);
-	}
-	if (!yl) {
-	    pp->setYLabel(QString::null);
-	}
-	if (!tl) {
-	    pp->setTopLabel(QString::null);
-	}
+	pp->GenerateDefaultLabels(xl, yl, tl);
 	if (_legendsOn->isChecked()) {
 	    pp->Legend->setShowing(true);
 	    pp->Legend->setFront(true);
@@ -873,7 +865,6 @@
 		pp->Legend->setFront(true);
 	    }
 	}
-
 	++pit;
     }
 
--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #456869:456870
@@ -2877,7 +2877,7 @@
 }
 
 
-void Kst2DPlot::GenerateDefaultLabels() {
+void Kst2DPlot::GenerateDefaultLabels(bool xl, bool yl, bool tl) {
   QStringList xlabels, ylabels, toplabels;
   QString label, xlabel, ylabel, toplabel;
   int n_curves, i_curve, i_count;
@@ -2946,9 +2946,12 @@
   EscapeSpecialChars(ylabel);
   EscapeSpecialChars(toplabel);
 
-  setXLabel(xlabel);
-  setYLabel(ylabel);
-  setTopLabel(toplabel);
+  if (xl) 
+    setXLabel(xlabel);
+  if (yl) 
+    setYLabel(ylabel);
+  if (tl) 
+    setTopLabel(toplabel);
 }
 
 
--- trunk/extragear/graphics/kst/kst/kst2dplot.h #456869:456870
@@ -197,7 +197,7 @@
 
   KstBaseCurveList Curves;
 
-  void GenerateDefaultLabels();
+  void GenerateDefaultLabels(bool xl = TRUE, bool yl = TRUE, bool zl = TRUE);
 
   /* kstview tells kstplot where to offset the plot to */
   void setPixRect(const QRect& RelPlotRegion, const QRect& RelWinRegion, const QRect& RelPlotAndAxisRegion);