I'm not sure about this.<div><br></div><div>There are now two ways that the axis display format is decided:</div><div>  i) through the plot dialog - where the format can be set as the default "[x] Save as Default" in the plot dialog.</div>
<div>  ii) by using the datasource input format.</div><div><br></div><div>I think:</div><div>  - it would be better if the plot dialog default format were used in the data wizard and not the datasource input format. </div>
<div>  - datasources should return isTime() rather than timeFormatString() to let the datawizard know that it is a time axis, so it can use the dialog defaults values.  The datawizard then only needs to plot->xAxis()->setAxisInterpret(true); if ds->isTime().  Then the existing default system already in place will do its work.</div>
<div><br></div><div>To make the dialog system easier to work with/discover, I could create a plot defaults dialog to set them all.</div><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Nov 21, 2012 at 4:05 AM, Peter Kümmel <span dir="ltr"><<a href="mailto:syntheticpp@gmx.net" target="_blank">syntheticpp@gmx.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">SVN commit 1325782 by kuemmel:<br>
<br>
use time format defined in ASCII dialog<br>
<br>
 M  +5 -0      datasources/ascii/asciisource.cpp<br>
 M  +2 -0      datasources/ascii/asciisource.h<br>
 M  +5 -3      datasources/ascii/kst_atof.cpp<br>
 M  +3 -0      libkst/datasource.cpp<br>
 M  +2 -0      libkst/datasource.h<br>
 M  +9 -0      libkstapp/datawizard.cpp<br>
<br>
<br>
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1325781:1325782<br>
@@ -650,6 +650,11 @@<br>
   }<br>
 }<br>
<br>
+//-------------------------------------------------------------------------------------------<br>
+QString AsciiSource::timeFormatString() const<br>
+{<br>
+  return _config._indexTimeFormat;<br>
+}<br>
<br>
 //-------------------------------------------------------------------------------------------<br>
 Kst::ObjectList<Kst::Object> AsciiSource::autoCurves(ObjectStore& objectStore)<br>
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.h #1325781:1325782<br>
@@ -53,6 +53,8 @@<br>
<br>
     int sampleForTime(const QDateTime& time, bool *ok);<br>
<br>
+    QString timeFormatString() const;<br>
+<br>
     virtual void reset();<br>
<br>
     virtual const QString& typeString() const;<br>
--- branches/work/kst/portto4/kst/src/datasources/ascii/kst_atof.cpp #1325781:1325782<br>
@@ -215,9 +215,11 @@<br>
   const QString time = QString::fromLatin1(p, end);<br>
   double sec = Kst::NOPOINT;<br>
   if (_timeWithDate) {<br>
-    const QDateTime t = QDateTime::fromString(time, _timeFormat);<br>
-    if (t.isValid())<br>
-      sec = QDateTime::fromString(time, _timeFormat).toMSecsSinceEpoch() / 1000.0;<br>
+    QDateTime t = QDateTime::fromString(time, _timeFormat);<br>
+    if (t.isValid()) {<br>
+      t.setTimeSpec(Qt::UTC);<br>
+      sec = t.toMSecsSinceEpoch() / 1000.0;<br>
+    }<br>
   } else {<br>
     const QTime t = QTime::fromString(time, _timeFormat);<br>
     if (t.isValid())<br>
--- branches/work/kst/portto4/kst/src/libkst/datasource.cpp #1325781:1325782<br>
@@ -353,6 +353,9 @@<br>
 }<br>
<br>
<br>
+QString DataSource::timeFormatString() const {<br>
+  return QString();<br>
+}<br>
<br>
 double DataSource::relativeTimeForSample(int sample, bool *ok) {<br>
   Q_UNUSED(sample)<br>
--- branches/work/kst/portto4/kst/src/libkst/datasource.h #1325781:1325782<br>
@@ -134,6 +134,8 @@<br>
<br>
     virtual QDateTime timeForSample(int sample, bool *ok = 0L);<br>
<br>
+    virtual QString timeFormatString() const;<br>
+<br>
     // in (ms)<br>
     virtual double relativeTimeForSample(int sample, bool *ok = 0L);<br>
<br>
--- branches/work/kst/portto4/kst/src/libkstapp/datawizard.cpp #1325781:1325782<br>
@@ -866,6 +866,8 @@<br>
     }<br>
   }<br>
<br>
+  QString timeFormatString = ds->timeFormatString();<br>
+<br>
   ds->unlock();<br>
   if (memoryRequested > memoryAvailable) {<br>
     QApplication::restoreOverrideCursor();<br>
@@ -1218,6 +1220,13 @@<br>
       }<br>
     }<br>
     foreach (PlotItem* plot, plotList) {<br>
+      if (!timeFormatString.isEmpty()) {<br>
+        plot->xAxis()->setAxisInterpret(true);<br>
+        plot->xAxis()->setAxisDisplay(AXIS_DISPLAY_QTDATETIME_FORMAT);<br>
+        plot->xAxis()->setAxisDisplayFormatString(timeFormatString);<br>
+        // start axis with first time in data<br>
+        plot->xAxis()->setAxisForceOffsetMin(true);<br>
+      }<br>
       plot->update();<br>
       plot->view()->appendToLayout(layout_type, plot, num_columns);<br>
     }<br>
_______________________________________________<br>
Kst mailing list<br>
<a href="mailto:Kst@kde.org">Kst@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kst" target="_blank">https://mail.kde.org/mailman/listinfo/kst</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse;color:rgb(136,136,136)">C. Barth Netterfield<br>University of Toronto<br>416-845-0946</span><div>
<span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse;color:rgb(136,136,136)"><br></span></div><br>
</div>