Loading ...
Sorry, an error occurred while loading the content.

xrange for a relative date window?

Expand Messages
  • Robin Duggar <rduggar@pobox.com>
    Is it possible to define xrange in proc areadef for either last 7 days or even just 7 days, instead of using specific dates (rather not use even day of week
    Message 1 of 9 , Feb 5, 2003
    • 0 Attachment
      Is it possible to define xrange in proc areadef for either last 7
      days or even just 7 days, instead of using specific dates (rather not
      use even day of week names)? I'm trying to write the script so it
      can be reused on a daily basis without reformulating it.

      Thanks!
      - Robin
    • Stephen C. Grubb
      Robin, This should do it: #call $setdatefmt( mm/dd/yyyy ) [or whatever..] #set xmax = $todaysdate() #set xmin = $dateadd( @xmax, -7 ) #proc areadef
      Message 2 of 9 , Feb 5, 2003
      • 0 Attachment
        Robin,

        This should do it:

        #call $setdatefmt( mm/dd/yyyy ) [or whatever..]
        #set xmax = $todaysdate()
        #set xmin = $dateadd( @xmax, -7 )

        #proc areadef
        xscaletype: date
        xrange: @xmin @xmax
        rectangle: 1 1 7 3
        yrange: 0 10
        xaxis.stubs: inc
        xaxis.stubformat: MMMdd [or whatever..]


        -Steve

        On Wed, 5 Feb 2003, Robin Duggar <rduggar@...> wrote:

        > Is it possible to define xrange in proc areadef for either last 7
        > days or even just 7 days, instead of using specific dates (rather not
        > use even day of week names)? I'm trying to write the script so it
        > can be reused on a daily basis without reformulating it.
        >
        > Thanks!
        > - Robin
        >
        >
        >
        > To unsubscribe from this group, send an email to:
        > ploticus-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        >
        >
        >


        Stephen C. Grubb scg@...
        Scientific Software Engineer, The Jackson Laboratory
        600 Main Street Bar Harbor, Maine 04609 USA
      • Robin Duggar <rduggar@pobox.com>
        Steve, Thanks SO much! - Robin ... not ... it ... http://docs.yahoo.com/info/terms/
        Message 3 of 9 , Feb 5, 2003
        • 0 Attachment
          Steve,

          Thanks SO much!

          - Robin

          --- In ploticus@yahoogroups.com, "Stephen C. Grubb" <scg@j...> wrote:
          > Robin,
          >
          > This should do it:
          >
          > #call $setdatefmt( mm/dd/yyyy ) [or whatever..]
          > #set xmax = $todaysdate()
          > #set xmin = $dateadd( @xmax, -7 )
          >
          > #proc areadef
          > xscaletype: date
          > xrange: @xmin @xmax
          > rectangle: 1 1 7 3
          > yrange: 0 10
          > xaxis.stubs: inc
          > xaxis.stubformat: MMMdd [or whatever..]
          >
          >
          > -Steve
          >
          > On Wed, 5 Feb 2003, Robin Duggar <rduggar@p...> wrote:
          >
          > > Is it possible to define xrange in proc areadef for either last 7
          > > days or even just 7 days, instead of using specific dates (rather
          not
          > > use even day of week names)? I'm trying to write the script so
          it
          > > can be reused on a daily basis without reformulating it.
          > >
          > > Thanks!
          > > - Robin
          > >
          > >
          > >
          > > To unsubscribe from this group, send an email to:
          > > ploticus-unsubscribe@yahoogroups.com
          > >
          > >
          > >
          > > Your use of Yahoo! Groups is subject to
          http://docs.yahoo.com/info/terms/
          > >
          > >
          > >
          >
          >
          > Stephen C. Grubb scg@j...
          > Scientific Software Engineer, The Jackson Laboratory
          > 600 Main Street Bar Harbor, Maine 04609 USA
        • romeyde
          I m trying to use this example but it s just not working for me. I have a dat file that contains about 3 weeks worth of webhits data. The file looks like
          Message 4 of 9 , Mar 19, 2003
          • 0 Attachment
            I'm trying to use this example but it's just not working for me. I
            have a dat file that contains about 3 weeks worth of webhits data.
            The file looks like this:

            02/20/03.20:00 14694
            02/20/03.20:05 52909
            02/20/03.20:10 51928
            02/20/03.20:15 48707
            02/20/03.20:20 46417

            There is a tab between the fields.

            My pol config file looks like this:

            -----------------------------------------------
            #call $setdatefmt( "mm/dd/yy" )
            #set xmax = $todaysdate()
            #set xmin = $dateadd( @xmax, -7 )

            #proc getdata
            file: $FILENAME
            fieldnames: datetime hits
            delim: tab

            #proc areadef
            title: @title
            titledetails: align=L size=16 style=B color=darkblue
            rectangle: 1 1 7.8 2.5
            xscaletype: date
            xrange: @xmin @xmax
            yautorange datafield=hits nearest=100 margin=200 lowfix=0
            xaxis.stubs: inc
            xaxis.stubformat: MMMdd
            yaxis.stubs: inc
            yaxis.labeldistance: .8
            frame: yes

            #proc processdata
            action: count
            fields: datetime hits
            showresults: no

            #proc bars
            locfield: datetime
            lenfield: hits
            truncate: yes
            thinbarline: color=green
            -----------------------------------------------

            I want it to only graph the last 7 days of data but I keep ending up
            just getting everything.

            I am calling pl like this:

            ~/plbin210/bin/pl ~/reports/webhits.pol -o \
            /web/html/dwr/webhitsTEST.gif -gif delim tab \
            title="$SITE Web Gets and Posts `date +%y%m%d`" -maxrows 100000

            BTW, should I still have to use the maxrows flag when I only want to
            graph 7 days worth of data? Sure the dat file is huge but I only want
            pl to process a small part of it.

            Thanks for any assistance,
            Derek



            > > Robin,
            > >
            > > This should do it:
            > >
            > > #call $setdatefmt( mm/dd/yyyy ) [or whatever..]
            > > #set xmax = $todaysdate()
            > > #set xmin = $dateadd( @xmax, -7 )
            > >
            > > #proc areadef
            > > xscaletype: date
            > > xrange: @xmin @xmax
            > > rectangle: 1 1 7 3
            > > yrange: 0 10
            > > xaxis.stubs: inc
            > > xaxis.stubformat: MMMdd [or whatever..]
            > >
            > >
            > > -Steve
            > >
            > > On Wed, 5 Feb 2003, Robin Duggar <rduggar@p...> wrote:
            > >
            > > > Is it possible to define xrange in proc areadef for either last 7
            > > > days or even just 7 days, instead of using specific dates (rather
            > not
            > > > use even day of week names)? I'm trying to write the script so
            > it
            > > > can be reused on a daily basis without reformulating it.
            > > >
            > > > Thanks!
            > > > - Robin
            > > >
            > > >
            > > >
            > > > To unsubscribe from this group, send an email to:
            > > > ploticus-unsubscribe@yahoogroups.com
            > > >
            > > >
            > > >
            > > > Your use of Yahoo! Groups is subject to
            > http://docs.yahoo.com/info/terms/
            > > >
            > > >
            > > >
            > >
            > >
            > > Stephen C. Grubb scg@j...
            > > Scientific Software Engineer, The Jackson Laboratory
            > > 600 Main Street Bar Harbor, Maine 04609 USA
          • Stephen C. Grubb
            Your best bet would be to reject all data records that are outside your day range. You can do this in proc getdata using the $daysdiff() function. I have
            Message 5 of 9 , Mar 19, 2003
            • 0 Attachment
              Your best bet would be to reject all data records that are outside your
              day range. You can do this in proc getdata using the
              $daysdiff() function. I have inserted this into your code below.

              This pares down the data a lot.. you can then forget about -maxrows

              -Steve


              On Wed, 19 Mar 2003, romeyde wrote:

              > I'm trying to use this example but it's just not working for me. I
              > have a dat file that contains about 3 weeks worth of webhits data.
              > The file looks like this:
              >
              > 02/20/03.20:00 14694
              > 02/20/03.20:05 52909
              > 02/20/03.20:10 51928
              > 02/20/03.20:15 48707
              > 02/20/03.20:20 46417
              >
              > There is a tab between the fields.
              >
              > My pol config file looks like this:
              >
              > -----------------------------------------------
              > #call $setdatefmt( "mm/dd/yy" )
              > #set xmax = $todaysdate()
              > #set xmin = $dateadd( @xmax, -7 )
              >
              > #proc getdata
              > file: $FILENAME
              > fieldnames: datetime hits
              > delim: tab

              select: $daysdiff(@@datetime,@xmin) >= 0
              showresults: yes

              >
              > #proc areadef
              > title: @title
              > titledetails: align=L size=16 style=B color=darkblue
              > rectangle: 1 1 7.8 2.5
              > xscaletype: date
              > xrange: @xmin @xmax
              > yautorange datafield=hits nearest=100 margin=200 lowfix=0
              > xaxis.stubs: inc
              > xaxis.stubformat: MMMdd
              > yaxis.stubs: inc
              > yaxis.labeldistance: .8
              > frame: yes
              >
              > #proc processdata
              > action: count
              > fields: datetime hits
              > showresults: no
              >
              > #proc bars
              > locfield: datetime
              > lenfield: hits
              > truncate: yes
              > thinbarline: color=green
              > -----------------------------------------------
              >
              > I want it to only graph the last 7 days of data but I keep ending up
              > just getting everything.
              >
              > I am calling pl like this:
              >
              > ~/plbin210/bin/pl ~/reports/webhits.pol -o \
              > /web/html/dwr/webhitsTEST.gif -gif delim tab \
              > title="$SITE Web Gets and Posts `date +%y%m%d`" -maxrows 100000
              >
              > BTW, should I still have to use the maxrows flag when I only want to
              > graph 7 days worth of data? Sure the dat file is huge but I only want
              > pl to process a small part of it.
              >
              > Thanks for any assistance,
              > Derek
              >
              >
              >
              > > > Robin,
              > > >
              > > > This should do it:
              > > >
              > > > #call $setdatefmt( mm/dd/yyyy ) [or whatever..]
              > > > #set xmax = $todaysdate()
              > > > #set xmin = $dateadd( @xmax, -7 )
              > > >
              > > > #proc areadef
              > > > xscaletype: date
              > > > xrange: @xmin @xmax
              > > > rectangle: 1 1 7 3
              > > > yrange: 0 10
              > > > xaxis.stubs: inc
              > > > xaxis.stubformat: MMMdd [or whatever..]
              > > >
              > > >
              > > > -Steve
              > > >
              > > > On Wed, 5 Feb 2003, Robin Duggar <rduggar@p...> wrote:
              > > >
              > > > > Is it possible to define xrange in proc areadef for either last 7
              > > > > days or even just 7 days, instead of using specific dates (rather
              > > not
              > > > > use even day of week names)? I'm trying to write the script so
              > > it
              > > > > can be reused on a daily basis without reformulating it.
              > > > >
              > > > > Thanks!
              > > > > - Robin
              > > > >
              > > > >
              > > > >
              > > > > To unsubscribe from this group, send an email to:
              > > > > ploticus-unsubscribe@yahoogroups.com
              > > > >
              > > > >
              > > > >
              > > > > Your use of Yahoo! Groups is subject to
              > > http://docs.yahoo.com/info/terms/
              > > > >
              > > > >
              > > > >
              > > >
              > > >
              > > > Stephen C. Grubb scg@j...
              > > > Scientific Software Engineer, The Jackson Laboratory
              > > > 600 Main Street Bar Harbor, Maine 04609 USA
              >
              >
              >
              > To unsubscribe from this group, send an email to:
              > ploticus-unsubscribe@yahoogroups.com
              >
              >
              >
              > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
              >
              >
              >


              Stephen C. Grubb scg@...
              Scientific Software Engineer, The Jackson Laboratory
              600 Main Street Bar Harbor, Maine 04609 USA
            • romeyde
              Thanks, that worked great. One last issue which I can probably figure out with a few more hours of searching. (unless you don t mind :) I now have a graph of
              Message 6 of 9 , Mar 19, 2003
              • 0 Attachment
                Thanks, that worked great. One last issue which I can probably figure
                out with a few more hours of searching. (unless you don't mind :)

                I now have a graph of 7 days but each day is only one little bar with
                the total gets and posts for that day. I'd like to at least show the
                gets and post for each day by hour.

                Hints?

                --- In ploticus@yahoogroups.com, "Stephen C. Grubb" <scg@j...> wrote:
                >
                > Your best bet would be to reject all data records that are outside your
                > day range. You can do this in proc getdata using the
                > $daysdiff() function. I have inserted this into your code below.
                >
                > This pares down the data a lot.. you can then forget about -maxrows
                >
                > -Steve
                >
                >
                > On Wed, 19 Mar 2003, romeyde wrote:
                >
                > > I'm trying to use this example but it's just not working for me. I
                > > have a dat file that contains about 3 weeks worth of webhits data.
                > > The file looks like this:
                > >
                > > 02/20/03.20:00 14694
                > > 02/20/03.20:05 52909
                > > 02/20/03.20:10 51928
                > > 02/20/03.20:15 48707
                > > 02/20/03.20:20 46417
                > >
                > > There is a tab between the fields.
                > >
                > > My pol config file looks like this:
                > >
                > > -----------------------------------------------
                > > #call $setdatefmt( "mm/dd/yy" )
                > > #set xmax = $todaysdate()
                > > #set xmin = $dateadd( @xmax, -7 )
                > >
                > > #proc getdata
                > > file: $FILENAME
                > > fieldnames: datetime hits
                > > delim: tab
                >
                > select: $daysdiff(@@datetime,@xmin) >= 0
                > showresults: yes
                >
                > >
                > > #proc areadef
                > > title: @title
                > > titledetails: align=L size=16 style=B color=darkblue
                > > rectangle: 1 1 7.8 2.5
                > > xscaletype: date
                > > xrange: @xmin @xmax
                > > yautorange datafield=hits nearest=100 margin=200 lowfix=0
                > > xaxis.stubs: inc
                > > xaxis.stubformat: MMMdd
                > > yaxis.stubs: inc
                > > yaxis.labeldistance: .8
                > > frame: yes
                > >
                > > #proc processdata
                > > action: count
                > > fields: datetime hits
                > > showresults: no
                > >
                > > #proc bars
                > > locfield: datetime
                > > lenfield: hits
                > > truncate: yes
                > > thinbarline: color=green
                > > -----------------------------------------------
                > >
              • romeyde
                Woohoo, Managed to answer my own question using the hitcount example. This works like I wanted it to. One last issue. I can t seem to get the omitweekends
                Message 7 of 9 , Mar 19, 2003
                • 0 Attachment
                  Woohoo,

                  Managed to answer my own question using the hitcount example.
                  This works like I wanted it to.

                  One last issue. I can't seem to get the omitweekends function to
                  work. No matter where I put it, the graph continues to display data
                  for Mar 15 and 16th.

                  Any ideas?

                  ------------------------------
                  #call $setdatefmt( "mm/dd/yy.hh:mm" )
                  #set xmax = $todaysdate()
                  #set xmin = $dateadd( @xmax, -7 )


                  #proc getdata
                  file: $FILENAME
                  delim: tab
                  fieldnames: datetime hits
                  select: $daysdiff(@@datetime,@xmin) >= 0

                  #proc processdata
                  action: count
                  fields: datetime hits
                  showresults: no

                  #proc areadef
                  title: @title
                  titledetails: align=L size=16 style=B color=darkblue
                  rectangle: 1 1 7.8 2.5
                  xscaletype: datetime mm/dd/yy.hh:mm
                  xrange: @xmin.00:01 @xmax.00:01
                  yautorange datafield=hits nearest=100 margin=200 lowfix=0
                  xaxis.stubs: inc 1 day
                  xaxis.stubformat: Mmmdd
                  xaxis.stubslide: 0.4
                  xaxis.minorticinc: 6 hours
                  yaxis.stubs: inc
                  yaxis.labeldistance: .8
                  frame: yes

                  #proc bars
                  locfield: datetime
                  lenfield: hits
                  truncate: yes
                  thinbarline: color=green
                • Stephen C. Grubb
                  ... One problem is that you are using xscaletype: date .. this is causing all bars within a date to overlap and appear to be just one bar. Instead you should
                  Message 8 of 9 , Mar 20, 2003
                  • 0 Attachment
                    > I now have a graph of 7 days but each day is only one little bar with
                    > the total gets and posts for that day.

                    One problem is that you are using 'xscaletype: date' .. this is causing
                    all bars within a date to overlap and appear to be just one bar.

                    Instead you should be using 'xscaletype: datetime' .. this will produce
                    one bar for each unique date+time in your data. proc processdata takes
                    care of summing all cases sharing the same date+time.

                    > I'd like to at least show the gets and post for each day by hour.

                    To tabulate by hour, one method is to use a getdata filter to create a
                    data field that is truncated to a round hour value, then use that field
                    instead of the original datetime field.

                    One other issue-- you probably can't use auto scaling for Y because of the
                    summation that proc processdata is performing. Use a fixed Y range
                    instead.

                    The following should do what you seek........

                    #set ymax = 500000
                    #call $setdatefmt( "mm/dd/yy" )
                    #set xmax = $todaysdate()
                    #set xmin = $dateadd( @xmax, -7 )

                    #proc getdata
                    fieldnames: datetime hits
                    file: hourhits.dat
                    select: $daysdiff(@@datetime,@xmin) >= 0
                    showresults: yes
                    pf_fieldnames: datetime hits date_hr
                    filter:
                    ##set DATE_HR = $substring(@@datetime,1,11)
                    @@1 @@2 @@DATE_HR:00:00

                    #proc areadef
                    title: @title
                    titledetails: align=L size=16 style=B color=darkblue
                    rectangle: 1 1 7.8 2.5
                    xscaletype: datetime
                    xrange: @xmin.00:00:00 @xmax.24:00:00
                    // yautorange datafield=hits nearest=100 margin=200 lowfix=0
                    yrange: 0 @ymax
                    xaxis.stubs: inc
                    xaxis.stubformat: MMMdd
                    yaxis.stubs: inc
                    yaxis.labeldistance: .8
                    frame: yes

                    #proc processdata
                    action: count
                    // fields: datetime hits
                    fields: date_hr hits
                    showresults: no
                    fieldnames: date_hr hits

                    #proc bars
                    // locfield: datetime
                    locfield: date_hr
                    lenfield: hits
                    truncate: yes
                    thinbarline: color=green
                  • Stephen C. Grubb
                    ... This example works on my end: #proc getdata data: 03/12/03.02:00 2 03/13/03.03:00 3 03/14/03.01:00 4 03/15/03.05:00 5 03/16/03.04:00 6 03/17/03.02:00
                    Message 9 of 9 , Mar 20, 2003
                    • 0 Attachment
                      > One last issue. I can't seem to get the omitweekends function to
                      > work. No matter where I put it, the graph continues to display data
                      > for Mar 15 and 16th.

                      This example works on my end:

                      #proc getdata
                      data:
                      03/12/03.02:00 2
                      03/13/03.03:00 3
                      03/14/03.01:00 4
                      03/15/03.05:00 5
                      03/16/03.04:00 6
                      03/17/03.02:00 7
                      03/18/03.04:00 8


                      #proc datesettings
                      omitweekends: omit

                      #proc areadef
                      xscaletype: datetime mm/dd/yy.hh:mm
                      xautorange: datafield=1 margin=1
                      yrange 0 10
                      xaxis.stubs: inc 1 day
                      yaxis.stubs: inc 1
                      xaxis.stubformat: MMMdd

                      #proc bars
                      locfield: 1
                      lenfield: 2
                      barwidth: 0.1
                    Your message has been successfully submitted and would be delivered to recipients shortly.