[Kst] Re3: Problem with ASCII containing Date/Time

Andrew Walker arwalker at sumusltd.com
Fri Jul 2 21:23:05 CEST 2010

Hi Stijn,

Sadly, my reply indicated only that it was possible to read the entire line, 
not the formatted date and time.

What you will have to do to make sense of the format you're providing is 
something like the following:

// grab the window
var w = Kst.windows[0];
// add a plot to the window
var p = new Plot(w);
// create new (editable) vectors.
// these could also be loaded from files.
//var v1 = new Vector(); var v2 = new Vector(); var v3 = new Vector();
var s = new DataSource("temp_rt_plot_file_0.txt");//specify a data
source file system. See the DataSource Class for details

// ****
s.setConfiguration("columndelimiter"," :/")    // this reads in each of the 
date and time fields as a separate vector
vYear = new DataVector(s,"1");
vMonth = new DataVector(s, "2")
vDay = new DataVector(s, "3")
vHour = new DataVector(s, "4")
vMinute = new DataVector(s, "5")
vSeconds = new DataVector(s, "6")

v1 = new Vector();

// now loop through the values and build up the values in v1
// e.g.
// v1[i] += vYear * ( )...
// v1[i] += vMonth * ( ... )
// v1[i] += vDay * (24.0 * 60.0 * 60.0)
// v1[i] += vHour * ( 60.0 * 60.0 )
// v1[i] += vMinute[i] * 60.0
// v1[i] += vSeconds[i];
// keep in mind that to display the axis information in date/time format 
you'll need to convert to a standard time format,
// which is one of "Standard C Time", "Julian Year", "JD", etc

v2 = new DataVector(s,"7");//construct a new vector v and set its
value from field 1 of the source file
v2.tagName = "vector2"; //give the vector a name in the Data Manager
v3 = new DataVector(s,"8");//construct a new vector v and set its
value from field 1 of the source file
v3.tagName = "vector3"; //give the vector a name in the Data Manager
// ****

c = new Curve(v3,v2); // to construct a new curve using xv and yv
c.tagName = "v3 vs v2"; //define the name for the curve in the data manager
// using the append method in the CurveCollection Class to show the
curve in plot
// label the x-axis of our plot
p.xAxis.label = "Time (s)";
p.xAxis.interpretation.input = 0;
p.xAxis.interpretation.output = 0; // the ?time? vector needs to be shown in
//the format: DD/MM/YY HH:MM:SS.
p.xAxis.interpretation.active = true; //Active the interpretation

Hope that helps,


----- Original Message ----- 
From: "Stijn Ilsen" <stijn.ilsen at googlemail.com>
To: <kst at kde.org>
Sent: Friday, July 02, 2010 4:31 AM
Subject: [Kst] Re3: Problem with ASCII containing Date/Time

Hi all,

Thank you for the replies.

More information about the Kst mailing list