# hbars3

How to download and try this example

    Usage: pl -gif hbars3.htm
    This data is purely fictional!

    // specify data using proc getdata
    #proc getdata
    data:
    // product 		ing.cost 	manuf m/u  ws m/u 	retailer m/u   tax
      "1 can\nsoft drink"     .07		.18	    0.07	.20		0.02
      "1 can\nbeer"		 .09		.20	    0.08	.24		0.12
      "1 can\nchicken soup"   .15		.32	    0.04	.12		0.04
      "1 can\npork & beans"   .18		.30	    0.04	.11		0.03

    // set up plotting area using proc areadef
    // Y scale will be categories, using the labels in field 1 of the data..
    #proc areadef
      title: Grocery costs
      rectangle: 2 2 5.5 4
      xrange: 0.00 1.00
      yscaletype: categories
      ycategories: datafields 1

    // do x and y axis using proc areadef
    #proc xaxis
      stubs: inc .20
      stubformat: %0.2f
      label: cost in dollars

    #proc yaxis
      stubs: usecategories

    // do red bars using proc bars
    #proc bars
      horizontalbars: yes
      lenfield: 2
      color: red
      legendlabel: Cost of raw\ningredients

    // do purple bars using proc bars
    // (they are "stacked" above data field 2)
    #proc bars
      horizontalbars: yes
      lenfield: 3
      color: purple
      stackfields: 2
      legendlabel: Manufacturer's\noverhead\n& profit

    // do yellow bars using proc bars
    // (they are "stacked" above data fields 2 and 3)
    #proc bars
      horizontalbars: yes
      lenfield: 4
      color: yellow
      stackfields: 2 3
      legendlabel: Wholesaler's\nmark-up

    // do green bars using proc bars
    // (they are "stacked" above data fields 2, 3, and 4)
    #proc bars
      horizontalbars: yes
      lenfield: 5
      color: green
      stackfields: 2 3 4
      legendlabel: Retailer's\nmark-up

    // do blue bars using proc bars
    // (they are "stacked" above data fields 2, 3, 4, and 5)
    #proc bars
      horizontalbars: yes
      lenfield: 6
      color: blue
      stackfields: 2 3 4 5
      legendlabel: Tax

    // render legend using labels supplied above (proc legend)
    #proc legend
      location: min-0.6 min-0.5
      textdetails: size=5
      format: singleline
      sep: 0.4