| 1 | <html><h1>hitcount3</h1><img src="hitcount3.gif"><p> |
| 2 | <a href="gall.using.html">How to download and try this example</a><br> |
| 3 | |
| 4 | <pre><b>Usage: pl -gif hitcount3.htm |
| 5 | |
| 6 | Uses the data file <a href="hitcount.dat">hitcount.dat</a> |
| 7 | |
| 8 | See also <a href="hitcount.htm">hitcount</a>. |
| 9 | |
| 10 | This example illustrates datetime scaling with time windowing. |
| 11 | Only the hours from 8 to 18 (6pm) are shown for each day. |
| 12 | <hr></b> |
| 13 | |
| 14 | |
| 15 | #proc getdata |
| 16 | file: hitcount.dat |
| 17 | // the following filter strips seconds from the time value, |
| 18 | // then builds a ddMmmyyyy date and connects it with the time |
| 19 | // value (separated by a dot) |
| 20 | pf_fieldnames: datetime nbytes |
| 21 | filter: |
| 22 | ##set TIME = @@4 |
| 23 | ##set TIME = $substring(@@TIME,1,5) |
| 24 | @@3@@2@@6.@@TIME @@7 |
| 25 | |
| 26 | // use proc processdata to sum nbytes for each unique time value |
| 27 | #proc processdata |
| 28 | action: count |
| 29 | fields: datetime nbytes |
| 30 | fieldnames: datetime nbytes |
| 31 | |
| 32 | // #proc print |
| 33 | // label: After transform: nrecords=@NRECORDS nfields=@NFIELDS |
| 34 | |
| 35 | // set up plotting area with datetime in X and autorange on the y axis. |
| 36 | // do x axis showing day of week and y axis |
| 37 | #proc areadef |
| 38 | title: Intranet web page hits |
| 39 | rectangle: 1 1 6 2.5 |
| 40 | xscaletype: datetime8-18 ddMmmyyyy.hh:mm |
| 41 | xrange: 26Sep1999.08:00 02Oct1999.18:00 |
| 42 | yautorange: datafield=nbytes nearest=20000 |
| 43 | xaxis.stubs: inc 1 day |
| 44 | xaxis.stubformat: Www |
| 45 | xaxis.stubslide: 0.4 |
| 46 | xaxis.minorticinc: 2 hours |
| 47 | xaxis.grid: width=0.3 color=purple |
| 48 | yaxis.stubs: inc 50 1000 |
| 49 | yaxis.label: kBytes Transferred |
| 50 | yaxis.labeldistance: 0.6 |
| 51 | frame: yes |
| 52 | |
| 53 | // do a 2nd X axis with month and day |
| 54 | #proc xaxis |
| 55 | stubs: inc 1 day |
| 56 | stubformat: Mmmdd |
| 57 | stubslide: 0.4 |
| 58 | stubdetails: adjust=0,-0.14 |
| 59 | |
| 60 | // use proc yaxis again to do grid lines at every 100 kB |
| 61 | //#proc yaxis |
| 62 | //grid: color=orange |
| 63 | //gridskip: min |
| 64 | //ticincrement: 100 1000 |
| 65 | |
| 66 | // make bar graph |
| 67 | #proc bars |
| 68 | locfield: datetime |
| 69 | lenfield: nbytes |
| 70 | thinbarline: color=green |
| 71 |