# stock

How to download and try this example
Download the PostScript equivalent

    Usage: pl -gif stock.htm
    Data source: http://quote.yahoo.com  "Spreadsheet format"

    #proc page
    #if @DEVICE in gif,png
      scale: 0.7
    #endif

    // read data file using proc getdata
    #proc getdata
    file: stock.csv
    delimit: comma
    // showresults: yes

    // reverse the record order, since the data is provided in reverse chronological
    // order, using proc transform
    #proc transform
    action: reverse

    // define top plotting area using proc areadef
    #proc areadef
    title: Trailer Tongue Technologies Corp.
    rectangle: 1 3 5 5
    xscaletype: date dd-mmm-yy
    xrange: 01-Jan-99 01-Jun-99
    yrange: 45 65
    yscaletype: log
    #saveas: A

    // set up X axis using proc xaxis
    #proc xaxis
    stubs: inc 1 month
    stubformat: Mmmyy
    grid: color=skyblue

    // set up Y axis using proc yaxis
    #proc yaxis
    stubs: inc 5
    grid: color=skyblue

    // draw hi low bars using proc bars
    #proc bars
    locfield: 1
    segmentfields: 3 4
    thinbarline: color=gray(0.8)

    // draw closing price curve using proc lineplot
    #proc lineplot
    xfield: 1
    yfield: 5
    linedetails: width=0.3 color=green

    // compute and render moving average curve using proc curvefit
    #proc curvefit
    xfield: 1
    yfield: 5
    order: 50
    legendlabel: 50 day\nmoving avg
    linedetails: color=orange

    // render legend proc legend
    #proc legend
    location: max-2 max

    // do volume

    // define bottom plotting area using proc areadef
    #proc areadef
    #clone: A
    rectangle: 1 1.6 5 2.6
    yrange: 0 30000000
    yscaletype: linear
    title:

    // set up X axis using proc xaxis
    #proc xaxis
    ticincrement: 1 month
    grid: color=skyblue
    label: Volume (1000s)
    labeldetails: adjust=0,0.2 size=8

    // set up Y axis using proc yaxis
    #proc yaxis
    stubs: inc 10000 1000
    grid: color=skyblue

    // render histogram using proc bars
    #proc bars
    barwidth: 0.001
    locfield: 1
    lenfield: 6
    thinbarline: color=green