BLT data series in rows or columns

JM 12/14/2018 Say we have readings from 8 sensors taken at 10 different times.

here a simple example on how to process the data if we need to chart the series from rows or columns:

BLT_rows_columns

package require rbc

set data {
{2.718281828        7.389056099        20.08553692        54.59815003        148.4131591        403.4287935        1096.633158        2980.957987}
{102.7182818        107.3890561        120.0855369        154.59815        248.4131591        503.4287935        1196.633158        3080.957987}
{202.7182818        207.3890561        220.0855369        254.59815        348.4131591        603.4287935        1296.633158        3180.957987}
{302.7182818        307.3890561        320.0855369        354.59815        448.4131591        703.4287935        1396.633158        3280.957987}
{402.7182818        407.3890561        420.0855369        454.59815        548.4131591        803.4287935        1496.633158        3380.957987}
{502.7182818        507.3890561        520.0855369        554.59815        648.4131591        903.4287935        1596.633158        3480.957987}
{602.7182818        607.3890561        620.0855369        654.59815        748.4131591        1003.428793        1696.633158        3580.957987}
{702.7182818        707.3890561        720.0855369        754.59815        848.4131591        1103.428793        1796.633158        3680.957987}
{802.7182818        807.3890561        820.0855369        854.59815        948.4131591        1203.428793        1896.633158        3780.957987}
{902.7182818        907.3890561        920.0855369        954.59815        1048.413159        1303.428793        1996.633158        3880.957987}
}


# Series in columns

rbc::vector create vecx
rbc::vector create vecy1
rbc::vector create vecy2

::rbc::graph .g -title "Sensors 1 & 8 over time - Series in columns" -width 600 -height 300
.g element create sensor1 -xdata vecx -ydata vecy1 -symbol none -showvalues y
.g element create sensor8 -xdata vecx -ydata vecy2 -symbol none -showvalues y

set ctr 0
foreach row $data {
                set vecx(++end) [incr ctr]
    set vecy1(++end) [lindex $row 0]
    set vecy2(++end) [lindex $row 7]    
}

# Series in rows

::rbc::graph .g2 -title "8 Sensors profile across time - Series in rows" -width 600 -height 300

set series 1
foreach row $data {
         set vecy3 [rbc::vector create #auto]
         set vecx3 [rbc::vector create #auto]
         
         .g2 element create $series -xdata $vecx3 -ydata $vecy3 -pixels 2
         incr series
         set ctr 0
         foreach field $row {
           set ${vecx3}(++end) [incr ctr]
           set ${vecy3}(++end) $field
   }
}

.g grid configure -hide no
grid .g
grid .g2