#!/bin/sh ./myblt

source bltDemo.tcl

set graph .htext.graph

bitmap define pattern1 { {4 4} {01 02 04 08} }
bitmap define pattern2 { {4 4} {08 04 02 01} }
bitmap define pattern3 { {2 2} {01 02 } }
bitmap define pattern4 { {4 4} {0f 00 00 00} }
bitmap define pattern5 { {4 4} {01 01 01 01} }
bitmap define pattern6 { {2 2} {01 00 } }
bitmap define pattern7 { {4 4} {0f 01 01 01} }
bitmap define pattern8 { {8 8} {ff 00 ff 00 ff 00 ff 00 } }
bitmap define pattern9 { {4 4} {03 03 0c 0c} }
bitmap define hobbes { {25 25} {
   00 00 00 00 00 00 00 00 00 c0 03 00 78 e0 07 00 fc f8 07 00 cc 07 04 00
   0c f0 0b 00 7c 1c 06 00 38 00 00 00 e0 03 10 00 e0 41 11 00 20 40 11 00
   e0 07 10 00 e0 c1 17 00 10 e0 2f 00 20 e0 6f 00 18 e0 2f 00 20 c6 67 00
   18 84 2b 00 20 08 64 00 70 f0 13 00 80 01 08 00 00 fe 07 00 00 00 00 00
   00 00 00 00 }
}

option add *graph.xTitle "X Axis Label"
option add *graph.yTitle "Y Axis Label"
option add *graph.title "A Simple Barchart"
option add *graph.xFont "Times 10"
option add *graph.elemBackground white
option add *graph.elemRelief raised
option add *graph.MarkerForeground yellow

set visual [winfo screenvisual .] 
if { $visual != "staticgray" && $visual != "grayscale" } {
    option add *print.background yellow
    option add *quit.background red
    option add *graph.background palegreen
}

htext .htext -text \
{   This is an example of the barchart widget.  The barchart has 
    many components; x and y axis, legend, crosshairs, elements, etc.  
    To create a postscript file "bar.ps", press the %%
    set w $htext(widget)
    button $w.print -text {Print} -command {
	$graph postscript output bar.ps -landscape true -maxpect 1
	#-padx 0.5i -pady 2i
    } 
    $w append $w.print

%% button.  
%%

    barchart $graph  -relief raised -bd 2 -barwidth 0.01 -plotbackground black
    $graph xaxis configure -rotate 90 -stepsize 0
    $w append $graph -relcavitywidth 1.0 -fill both -padx 4

%%
    Hit the %%

    button $w.quit -text quit -command exit
    $w append $w.quit 

%% button when you've seen enough.%%

    label $w.logo -bitmap BLT
    $w append $w.logo -padx 20

%% }

set names { One Two Three Four Five Six Seven Eight }
if { $visual == "staticgray" || $visual == "grayscale" } {
    set fgcolors { white white white white white white white white }
    set bgcolors { black black black black black black black black }
} else {
    set fgcolors { yellow orange red magenta purple blue cyan green }
    set bgcolors { yellow4 orange4 red4 magenta4 purple4 blue4 cyan4 green4 }
}

set numColors [llength $names]

for { set i -5000 } { $i <= 5000 } { incr i } {
    set colorIndex [expr $i % $numColors]
    $graph element create d_$i \
	-label {} \
	-data { $i*0.01 sin($i*0.01) } \
	-fg [lindex $fgcolors $colorIndex] \
	-bg [lindex $bgcolors $colorIndex] \
	-stipple pattern[expr $colorIndex+1]  \
	-relief raised \
	-bd 2 
}

table . .htext -fill both
	
wm min . 0 0

Blt_ZoomStack $graph
Blt_Crosshairs $graph
Blt_ActiveLegend $graph
Blt_ClosestPoint $graph
