ch_pa_chart

one of the documented procedures in this installation of the ACS
Usage:
ch_pa_chart {-legend "" -headings "" -color_list "" -default_drilldown_url "" -min_left_column_width "1" -bar_height "15" -subcategory_spacing "7" -replace_null_subcategory_with_none_p "f" -cell_width "10" -scale_left "" -scale_right ""} subcategory_category_and_value_list
What it does:
Read http://software.arsdigita.com/www/doc/graphing.html
Defined in: /web/philip/tcl/ch-graphing.tcl

Source code:

arg_parser_for_ch_pa_chart $args


    if { $color_list == "" } {
	set color_list [list white blue dark-green purple red black orange medium-blue]
    }

    set to_return ""

    if { $legend != "" } {
	set legend_counter 0
	append to_return "<table border=1 cellspacing=0 cellpadding=5><tr><td>"
	foreach key $legend {
	    append to_return "<img width=15 height=15 src=\"/graphics/graphing-package/[lindex $color_list [expr round(fmod($legend_counter,[llength $color_list]))]]-dot.gif\"> &nbsp;[gr_font black 3]$key<br clear=all>"
	    incr legend_counter
	}
	append to_return "</td></tr></table><p>"
    }

    append to_return "<table border=0 cellspacing=2 cellpadding=0>"

    if { ![empty_string_p $headings] } {
	append to_return "<tr><td></td><td></td>"
	foreach heading $headings {
	    append to_return "<td>$heading</td>"
	}
	append to_return "</tr>"
    }


    set prev_category "initial_condition"

    set max_data_length 1
    foreach subcategory_category_and_value $subcategory_category_and_value_list {
	set temp_length [llength [lindex $subcategory_category_and_value 2]]
	if { $temp_length > $max_data_length } {
	    set max_data_length $temp_length
	}
    }

    foreach subcategory_category_and_value $subcategory_category_and_value_list {
	set subcategory [lindex $subcategory_category_and_value 0]
	set category [lindex $subcategory_category_and_value 1]
	set values [lindex $subcategory_category_and_value 2]
	set drilldown_url [lindex $subcategory_category_and_value 3]
	# values is a list

	if { $category != $prev_category } {
	    set prev_category $category
	    append to_return "<tr><td><img width=$min_left_column_width height=10 src=\"/graphics/graphing-package/white-dot.gif\"><br clear=all>[gr_font black 4][lindex $subcategory_category_and_value 1]</font></td>"
	    if { ![empty_string_p $scale_left] || ![empty_string_p $scale_right] } {
		append to_return "<td><img width=10 height=15 src=\"/graphics/graphing-package/white-dot.gif\"></td><td colspan=$max_data_length><table width=100%><tr><td align=left>$scale_left</td><td align=right>$scale_right</td></tr></table></td></tr>"
	    } else {
		append to_return "<td><img width=10 height=15 src=\"/graphics/graphing-package/white-dot.gif\"></td><td> </td></tr>"
	    }
	}

	if { $replace_null_subcategory_with_none_p == "t" } {
	    append to_return "<tr><td>[gr_font][gr_none_if_null $subcategory]</font></td><td width=10> </td>"
	} else {
	    append to_return "<tr><td>[gr_font]$subcategory</font></td><td width=10> </td>"
	}


	# value_counter is to determine bar_color
	set value_counter 0
	set bar_color 1
	foreach value $values {
	    set bar_value [lindex $value 0]
	    if { [llength $value] > 1 } {
		set a_pre "<a href=\"[lindex $value 1]\">"
		set a_post "</a>"
	    } else {
		set a_pre ""
		set a_post ""
	    }
	    append to_return "<td>$a_pre<img border=0 width=$cell_width height=$bar_height src=\"/graphics/graphing-package/[ch_value_color_map $bar_value $color_list]-dot.gif\">$a_post</td>"
	} 


	if { [empty_string_p $drilldown_url] } {
	    set drilldown_url [subst $default_drilldown_url]
	}
	if { ![empty_string_p $drilldown_url] } {
	    append to_return " [gr_font [hex_color $bar_color] 1]<a href=\"$drilldown_url\">$value</a></font>"
	}
	
	append to_return "<br clear=all>\n"

	incr value_counter
	
	append to_return "</tr>"



    } ; #  end  foreach subcategory_category_and_value

    append to_return "</table>"
    return $to_return


philg@mit.edu