# hitcount

How to download and try this example

    Usage: pl -gif hitcount.htm

    Uses the data file hitcount.dat

    See also hitcount2.

    Thanks to Jim Arnott for suggesting the proc transform count feature,
    the idea of this example, and for the bit of prodding on the datetime
    scale type.

    #proc getdata
    file: hitcount.dat
    // the following filter strips seconds from the time value,
    // then builds a ddMmmyyyy date and connects it with the time
    // value (separated by a dot)
    fieldnames: datetime nbytes
    filter: ##declare TIME
     	##set TIME = @@4
    	##set TIME = $substring(@@TIME,1,5)
    	@@3@@2@@6.@@TIME @@7

    // use proc transform to sum nbytes for each unique time value
    #proc transform
    action: count
    fields: datetime nbytes

    #proc print
    label: After transform: nrecords=@NRECORDS nfields=@NFIELDS

    // set up plotting area with datetime in X and autorange on the y axis.
    // do x axis showing day of week and y axis
    #proc areadef
    title: Intranet web page hits
    rectangle: 1 1 6 2.5
    xscaletype: datetime ddMmmyyyy.hh:mm
    xrange: 26Sep1999.00:00 02Oct1999.23:59
    yautorange: datafield=nbytes nearest=20000 margin=50000 lowfix=0
    xaxis.stubs: inc 1 day
    xaxis.stubformat: Www
    xaxis.stubslide: 0.4
    xaxis.minorticinc: 6 hours
    yaxis.stubs: inc 50 1000
    //yaxis.label: kBytes Transferred
    yaxis.labeldistance: 0.6
    frame: yes

    // do a 2nd X axis with month and day
    #proc xaxis
    stubs: inc 1 day
    stubformat: Mmmdd
    stubslide: 0.4
    stubdetails: adjust=0,-0.14

    // use proc yaxis again to do grid lines at every 100 kB
    #proc yaxis
    grid: color=orange
    gridskip: min
    ticincrement: 100 1000

    // make bar graph
    #proc bars
    locfield: datetime
    lenfield: nbytes
    thinbarline: color=green
    truncate: yes