proc Execute {c} {

 global v dvar max min range pcpy number_axes color class_num
 global scaler old_lines plotFont color_var color_sch
 global dx_display dx_display_old axisOrder flag
 global dx_display_possibilities
 
 set old_lines [$c find withtag lineseg]
 set old_class_num $class_num
 set old_maxmins [$c find withtag maxmin]
 for {set i 0} {$i < $number_axes} {incr i} {
  if {$dx_display($i) == "color"} {
   set color_var $i
   break
  }
 }

# ****
# deleting the lines bogs down application more than any other step in here

 for {set j 0} {$j < [llength $old_lines]} {incr j} {
  $c delete [lindex $old_lines $j]
 }

# ****
 for {set j 0} {$j < [llength $old_maxmins]} {incr j} {
  $c delete [lindex $old_maxmins $j]
 }

 for {set i 0} {$i < $number_axes} {incr i} {

  $c create text [expr $i*200+90] 520 \
   -text $min($v($i)) -fill grey70 \
   -font $plotFont -anchor e -tags maxmin
  $c create text [expr $i*200+90] 160 \
   -text $max($v($i)) -fill grey70 \
   -font $plotFont -anchor e -tags maxmin
 }
 if {$color_sch != "FCs"} {
    for {set k 0} {$k < [llength $dvar($v(0))]} {incr k} {
  for {set i 0} {$i < [expr $number_axes-1]} {incr i} {
   set item [$c create line [expr $i*200+100] \
    $pcpy($k,$v($i)) [expr ($i+1)*200+100] \
    $pcpy($k,$v([expr $i+1])) -width 1]
   for {set j 1} {$j <= $class_num} {incr j} {
      if {$j < $class_num} {
    set upper [expr 520 - ($scaler($j)*360)]
        } else {
    set upper 160
        }
 
      if {$pcpy($k,$v($color_var)) >= $upper} {
      $c itemconfig $item -fill $color($j)
    break
      }
   }
   $c addtag p$k withtag $item
   $c addtag lineseg2 withtag $item
   $c addtag lineseg withtag $item
  }
    }
 } else {
    set upperbound [lindex [$c coords [$c find withtag c1]] 3]
    set lowerbound [lindex [$c coords [$c find withtag c2]] 3]
    for {set k 0} {$k < [llength $dvar($v(0))]} {incr k} {
  set cond_1 [expr $pcpy($k,$v($color_var)) > $lowerbound]
  set cond_2 [expr $pcpy($k,$v($color_var)) < $upperbound]
     if {$cond_1 && $cond_2} {
    for {set i 0} {$i < [expr $number_axes-1]} {incr i} {
   set item [$c create line [expr $i*200+100] \
    $pcpy($k,$v($i)) [expr ($i+1)*200+100] \
    $pcpy($k,$v([expr $i+1])) -width 1 \
    -fill yellow]
   $c addtag p$k withtag $item
   $c addtag lineseg2 withtag $item
   $c addtag lineseg withtag $item
    }
  }
    }
 }
 

 for {set i 0} {$i < $number_axes} {incr i} {
  if {$dx_display($i) != "undisplayed" && \
   $dx_display($i) != $dx_display_old($i)} {
     for {set j 0} {$j < $number_axes} {incr j} {
       if {$i != $j && $dx_display($i) == $dx_display($j)} {
         set dx_display($j) "undisplayed"
       }
      }
  }
 }
 set newDxOrder $axisOrder
 for {set i 0} {$i < $number_axes} {incr i} {
  set newDxOrder [lreplace $newDxOrder $i $i $dx_display($i)]
 }
 foreach possibility $dx_display_possibilities {
     if {$possibility != "undisplayed"} {

    set cover_the_bases [lsearch $newDxOrder $possibility]
    if {$cover_the_bases == -1} {

     set undis_pos [lsearch $newDxOrder undisplayed]
   set dx_display($undis_pos) $possibility
    }
  }
 }
 colorUpdate $c $color_var
}

proc ItemEnter {w1} {
 global fill1 rec number_axes pcpy v
 # fill1 is the old color of the fill before it's mouse-overed
 set fill1 [lindex [$w1 itemconfig current -fill] 4]

 #current is the tag of the item currently "active"
 # the following changes the color of the carat or line segment
 # that is current

 $w1 itemconfig current -fill red
 set selected [$w1 gettags current]

 # rec is the tag of the *number* of the observation: you
 # actually are mouse-overing just a segment of the observation
 # line, but these next two lines highlights the entire line.
 set rec [lindex $selected 0]
 $w1 itemconfig $rec -fill red
 set k [string trimleft $rec p]
 set old_lines [$w1 find withtag p$k]

 for {set j 0} {$j < [llength $old_lines]} {incr j} {
    $w1 delete [lindex $old_lines $j]
 }

 for {set i 0} {$i < [expr $number_axes-1]} {incr i} {
  set item [$w1 create line [expr $i*200+100] \
    $pcpy($k,$v($i)) [expr ($i+1)*200+100] \
    $pcpy($k,$v([expr $i+1])) -width 1 -fill #b2fe00]
  $w1 addtag p$k withtag $item
  $w1 addtag lineseg2 withtag $item
 }
 

}

# Item Leave returns the fill of the current item to its original color.

proc ItemLeave {w1} {
 global fill1 rec
 set selected [$w1 gettags current]
 set rec [lindex $selected 0]
 if {[lsearch [$w1 gettags current] area] != 1} {
  $w1 itemconfig $rec -fill $fill1
  $w1 addtag lineseg withtag $rec
 }
 
}

proc ItemMark {c1 x y} {
    global areaX1 areaY1 areaX2 areaY2 recs fillb
    set areaX1 [$c1 canvasx $x]
    set areaY1 [$c1 canvasy $y]
    set areaX2 $areaX1
    set areaY2 $areaY1
    $c1 delete area
    for {set j 0} {$j < [llength $recs]} {incr j} {
 set red_lines [$c1 find withtag [lindex $recs $j]]
 foreach i $red_lines {
     $c1 itemconfig $i -fill $fillb($j)
 }
    }
 
}
proc ItemStroke {c x y} {
    global areaX1 areaY1 areaX2 areaY2
 
    if {[lsearch [$c config -bg] black] != -1} {
 set strokecolor white
    } else {
 set strokecolor black
    }
    set x [$c canvasx $x]
    set y [$c canvasy $y]
    if {($areaX1 != $x) && ($areaY1 != $y)} {
 $c delete area
 $c addtag area withtag [$c create rect $areaX1 $areaY1 $x $y \
  -outline $strokecolor]
 set areaX2 $x
 set areaY2 $y
    }
 
}

proc ItemBrush {c1} {
    global areaX1 areaY1 areaX2 areaY2 recs fillb flag var item web_data_names

    set area [$c1 find withtag area]

    set recs " "
    foreach i [$c1 find overlapping $areaX1 $areaY1 $areaX2 $areaY2] {
 if {[lsearch [$c1 gettags $i] lineseg] == 2} {
   lappend items $i
   lappend recs [lindex [$c1 gettags $i] 0]
 }
    }

    for {set i 0} {$i < [expr [llength $recs]-1]} {incr i} {
       if {[lindex $recs $i] == [lindex $recs [expr $i+1]]} {
 set recs [lreplace $recs $i $i]
       }
    }

    for {set j 0} {$j < [llength $recs]} {incr j} {
 set fillb($j) [lindex [$c1 itemconfig [lindex $recs $j] -fill] 4]

 $c1 itemconfig [lindex $recs $j] -fill #b0fe00
    }

# strips off the "p" from the tags of the brushed lines
 
    for {set k 0} {$k < [llength $recs]} {incr k} {
 set holder [string trimleft [lindex $recs $k] p]
 set flag($holder) 1
    }
#    for {set k 1} {$k < 21} {incr k} {
# puts "$k $flag($k)"
#    }

}
proc selectTab {c y} {
 global scaler
 $c addtag active withtag current
 #$c addtag active withtag \
  #[lindex [$c gettags [$c find withtag active]] 0]
     set activestyle "-fill red"
 eval "$c itemconfig active $activestyle"
 $c raise active
}

# releaseTab will refill the released elements to black.

proc releaseTab {c} {
 if {[$c find withtag active] == {}} {
  return
    }
 set normalStyle "-fill white"
 eval "$c itemconf active $normalStyle"
 $c dtag active
}
proc moveColor {c y} {
 global low_height scaler class_num min
 global plotFont range v color_var
 set pos [lindex [$c coords [$c find withtag current]] 3]
 set carat_number [string trimleft \
  [lindex [$c gettags [$c find withtag current]] 1] c]
 if {[$c find withtag active] == {}} {
  return
 }
 
 set one_higher [expr $carat_number+1]
 set one_lower  [expr $carat_number-1]

 if {$carat_number == [expr $class_num - 1]} {
  set upperbound 160.0
  set lowerbound [lindex [$c \
   coords [$c find withtag c$one_lower]] 3]
 } elseif {$carat_number == 1} {
  set upperbound [lindex [$c \
   coords [$c find withtag c$one_higher]] 3]
  set lowerbound 520.0
 } else {
  set upperbound [lindex [$c \
   coords [$c find withtag c$one_higher]] 3]
  set lowerbound [lindex [$c \
   coords [$c find withtag c$one_lower]] 3]
 }
 set cy [$c canvasy $y]
 if {$cy < $upperbound} {set cy $upperbound}
 if {$cy > $lowerbound} {set cy $lowerbound}
 set delta_y [expr $cy-$pos]
 $c move active 0 $delta_y
 set pos [lindex [$c coords [$c find withtag current]] 3]
 set scaler($carat_number) [expr (360-($pos-160))/360]
 set brkpnt($carat_number) \
  [expr $scaler($carat_number)*$range($v($color_var)) + \
  $min($v($color_var))]
 $c delete [$c find withtag breakpnt$carat_number]
 $c create text [expr $color_var*200+90] $pos \
   -text $brkpnt($carat_number) -fill grey70 \
   -font $plotFont -anchor e -tags breakpnt$carat_number
}
proc Focus { } {
 global focus_state color_sch class_num
 
 if {$focus_state == "on"} {
  set color_sch "FCs"
  set class_num 3
  setUpColor

 } else {
  #.colorchoice.colorfocus configure -bg purple
  setUpColor

 }

 
}
# setUpColor: takes input from the classify... menu and sets the colors
# and breakpoints etc.

proc setUpColor {args} {

global class_num color_sch color scaler old_class_num

# *******
# initializes colors as all black, (7 reds, 7 greens, 7 blues)

for {set i 1} {$i <= 7} {incr i} {
 set color($i) #000000
}

# this gets changed at the end of the proc
# ********

  if {$color_sch == "RdS"} {
 for {set i 1} {$i <= $class_num} {incr i} {
  set green($i)  [expr int(255-($i-1)*(255/($class_num-1)))]
  set blue($i)  [expr int(255-($i-1)*(255/($class_num-1)))]
  set red($i)  255
 }
  } elseif {$color_sch == "GnS"} {
 for {set i 1} {$i <= $class_num} {incr i} {
  set green($i)  [expr int(255-($i-1)*(100/($class_num-1)))]
  set blue($i)  [expr int(255-($i-1)*(255/($class_num-1)))]
  set red($i)  [expr int(255-($i-1)*(255/($class_num-1)))]
 }
  } elseif {$color_sch == "BlS"} {
 for {set i 1} {$i <= $class_num} {incr i} {
  set green($i)  [expr int(255-($i-1)*(255/($class_num-1)))]
  set blue($i)  255
  set red($i)  [expr int(255-($i-1)*(255/($class_num-1)))]
 }
  } elseif {$color_sch == "GyS"} {
 for {set i 1} {$i <= $class_num} {incr i} {
  set green($i)  [expr int(255-($i-1)*(200/($class_num-1)))]
  set blue($i)  [expr int(255-($i-1)*(200/($class_num-1)))]
  set red($i)  [expr int(255-($i-1)*(200/($class_num-1)))]
 }
  } elseif {$color_sch == "GPD"} {
 for {set i 1} {$i <= $class_num} {incr i} {
  set green($i)  132
  set blue($i)  [expr int(255-($i-1)*(255/($class_num-1)))]
  set red($i)  [expr int(255-($i-1)*(255/($class_num-1)))]
 }
  } elseif {$color_sch == "RBD"} {
 for {set i 1} {$i <= $class_num} {incr i} {
  set green($i)  0
  set blue($i)  [expr int(($i-1)*255/($class_num-1))]
  set red($i)  [expr int(255-($i-1)*(255/($class_num-1)))]
 }
  } elseif {$color_sch == "GPH"} {
 if {[expr $class_num%2] == 0} {
  set class_num [expr $class_num+1]
  #tixSetSilent .classify.a $class_num
 }
 for {set i 1} {$i <= [expr ($class_num+1)/2]} {incr i} {
  set green($i) [expr int(($i-1)*(128/(($class_num-1)/2))+127)]
  set red($i) [expr int(($i-1)*(255/(($class_num-1)/2)))]
 }
 for {set i $i} {$i <= $class_num} {incr i} {
  set green($i) [expr int(255-($i-1)*(128/(($class_num-1)/2))+127)]
  set red($i) 255
 }
 for {set i 1} {$i <= $class_num} {incr i} {
  set blue($i) [expr int(($i-1)*255/($class_num-1))]
 }
  } elseif {$color_sch == "RBH"} {
 if {[expr $class_num%2] == 0} {
  set class_num [expr $class_num+1]
  #tixSetSilent .classify.a $class_num
 }
 for {set i 1} {$i <= [expr ($class_num+1)/2]} {incr i} {
  set green($i) [expr int(($i-1)*(255/(($class_num-1)/2)))]
  set red($i) 255
 }
 for {set i $i} {$i <= $class_num} {incr i} {
  set green($i) [expr int(255-($i-1)*(255/(($class_num-1)/2))+255)]
  set red($i) [expr int(255-($i-1)*(255/(($class_num-1)/2))+255)]
 }
 for {set i 1} {$i <= $class_num} {incr i} {
  set blue($i) [expr int(($i-1)*255/($class_num-1))]
 }
  } elseif {$color_sch == "Spc"} {
 set red(1) 255
 set green(1) 0
 set blue(1) 0
 set red($class_num) 0
 set green($class_num) 0
 set blue($class_num) 255
 if {$class_num != 2} {
  set red([expr ($class_num+1)/2]) 255
   set green([expr ($class_num+1)/2]) 255
   set blue([expr ($class_num+1)/2]) 0
  if {$class_num != 3} {
   if {$class_num != 7} {
     set red([expr $class_num-1]) 0
     set green([expr $class_num-1]) 192
      set blue([expr $class_num-1]) 0
   } else {
    set red(6) 0
    set green(6) 192
    set blue(6) 192
    set red(5) 128
    set green(5) 255
    set blue(5) 128
    set red(3) 255
    set green(3) 192
    set blue(3) 0
   }
   if {$class_num != 4} {
    set red(2) 255
    set green(2) 128
    set blue(2) 0
   }
   if {$class_num == 6} {
    set red(4) 128
    set green(4) 255
    set blue(4) 0
   }
  }
 }
  } elseif {$color_sch == "FCs"} {
 set red(1) 0
 set green(1) 0
 set blue(1) 0
 set red(2) 255
 set green(2) 255
 set blue(2) 0
 set red(3) 0
 set green(3) 0
 set blue(3) 0
  }

  for {set i 1} {$i <= $class_num} {incr i} {
   set hexred [format %x $red($i)]
   if {[string length $hexred] == 1} {
 set hexred "0$hexred"
   }
  set hexgreen [format %x $green($i)]
   if {[string length $hexgreen] == 1} {
 set hexgreen "0$hexgreen"
   }
  set hexblue [format %x $blue($i)]
   if {[string length $hexblue] == 1} {
 set hexblue "0$hexblue"
   }

 # the colors (all class_num of them) are set in hexidecimal here.

   set color($i) "#$hexred$hexgreen$hexblue"

  }

 # resets to eq. ints. if the new number of classes selected is
 # greater than the old.
 
  if {$old_class_num < $class_num} {
 for {set i 1} {$i < $class_num} {incr i} {
  set scaler($i) [expr double($i)/double($class_num)]
 }
  }
  set old_class_num $class_num
}
 

proc colorUpdate {c i}  {
 global scaler v color class_num plotFont range min
 # desroys the old carats and bars ***********
 set old_bars [$c find withtag colorbar]
 for {set j 0} {$j < [llength $old_bars]} {incr j} {
  $c delete [lindex $old_bars $j]
 }
 set old_carats [$c find withtag carat]
 for {set j 0} {$j < [llength $old_carats]} {incr j} {
  $c delete [lindex $old_carats $j]
 }
 # *******************************************
 set upper_old 520
 for {set j 0} {$j < 7} {incr j} {
  $c delete [$c find withtag breakpnt$j]
   }

 for {set j 1} {$j <= $class_num} {incr j} {
   if {$j < $class_num} {
  set upper [expr 520 - ($scaler($j)*360)]
   } else {
  set upper 160
   }
   $c create rect [expr $i*200+97] $upper_old [expr $i*200+103] \
  $upper -fill $color($j) -tags "colorbar $j class$j"
   set upper_old $upper
      if {$j < $class_num} {
      set item [$c create polygon [expr $i*200+90] [expr $upper-5] \
    [expr $i*200+96] \
    $upper [expr $i*200+90] [expr $upper+5] \
    -fill white -tags carat]
  $c addtag c$j withtag $item
   set brkpnt($j) \
   [expr $scaler($j)*$range($v($i)) + \
   $min($v($i))]
 
   $c create text [expr $i*200+90] $upper \
   -text $brkpnt($j) -fill grey70 \
   -font $plotFont -anchor e -tags breakpnt$j
   }
        }
}

proc newColor {c} {
 global color
 grab $c
 set initial_color [lindex [$c itemconfigure current -fill] 4]
 $c addtag active withtag current
 set which_bar [lindex [$c gettags [$c find withtag active]] 1]
 set color($which_bar) [tk_chooseColor -title "Choose a color" \
  -parent $c \
  -initialcolor $initial_color]
 if [string compare $color($which_bar) ""] {
  setColor_helper $c $color($which_bar)
     }
 grab release $c
 $c dtag active
}
proc setColor_helper {c color} {
     catch {
  eval "$c itemconfigure active -fill $color"
 }
}

# this is the raw data.

set rawdata(0) {class# prob case# latitude longitude grid_point precipitation humidity-SFC humidity700 sea_level thickness year month day hour sequential_date}
set rawdata(1) {18 0.98 1 22 -102.5 1 5.44 11.14 4.58 0 2705.55 85 11 1 12 31352}
set rawdata(2) {18 0.85 2 22 -100 2 3.4 11.03 5.77 0 2707.73 85 11 1 12 31352}
set rawdata(3) {18 0.78 3 22 -97.5 3 0.49 13.6 5.26 0 2701.14 85 11 1 12 31352}
set rawdata(4) {18 0.99 4 22 -95 4 3.25 18.64 5 0 2695.86 85 11 1 12 31352}
set rawdata(5) {17 0.98 5 24 -102.5 5 1.65 10.9 5.03 0 2690.54 85 11 1 12 31352}
set rawdata(6) {17 0.99 6 24 -100 6 0.04 10.64 7.12 0 2694.3 85 11 1 12 31352}
set rawdata(7) {18 0.51 7 24 -97.5 7 1.33 11.11 8.05 0 2689.09 85 11 1 12 31352}
set rawdata(8) {18 0.98 8 24 -95 8 2.43 15.51 5.3 0 2684.15 85 11 1 12 31352}
set rawdata(9) {25 0.99 9 26 -102.5 9 0 8.89 5.76 0 2672.98 85 11 1 12 31352}
set rawdata(10) {17 0.99 10 26 -100 10 0.06 9.42 8.02 0 2677.65 85 11 1 12 31352}
set rawdata(11) {17 0.94 11 26 -97.5 11 1.6 7.81 6.97 0 2676.95 85 11 1 12 31352}
set rawdata(12) {18 0.89 12 26 -95 12 1.45 11.53 3.56 0 2677.07 85 11 1 12 31352}
set rawdata(13) {25 0.99 13 28 -102.5 13 0 7.9 5.02 0 2653.99 85 11 1 12 31352}
set rawdata(14) {17 0.99 14 28 -100 14 0.5 7.37 7 0 2660.43 85 11 1 12 31352}
set rawdata(15) {17 0.99 15 28 -97.5 15 0.44 6.45 4.07 0 2663.64 85 11 1 12 31352}
set rawdata(16) {25 0.98 16 28 -95 16 0 10.52 1.62 0 2671.16 85 11 1 12 31352}
set rawdata(17) {17 0.99 17 30 -102.5 17 0.94 7.13 4.26 0 2638.08 85 11 1 12 31352}
set rawdata(18) {17 0.99 18 30 -100 18 0.36 6.77 5.14 0 2642 85 11 1 12 31352}
set rawdata(19) {25 0.93 19 30 -97.5 19 0 6.33 3.51 0 2648.39 85 11 1 12 31352}
set rawdata(20) {25 0.95 20 30 -95 20 0 6.32 1.4 0 2660.99 85 11 1 12 31352}
set rawdata(21) {7 0.87 21 22 -102.5 1 4.17 7.08 5.24 2.59 2651.27 85 11 2 12 31353}
set rawdata(22) {7 0.93 22 22 -100 2 0.38 8.05 6.21 2.66 2661.85 85 11 2 12 31353}
set rawdata(23) {6 0.98 23 22 -97.5 3 0.34 13.34 6.62 -0.05 2674.14 85 11 2 12 31353}
set rawdata(24) {12 0.99 24 22 -95 4 4.55 20.02 6.35 -2.73 2690.37 85 11 2 12 31353}
set rawdata(25) {7 0.99 25 24 -102.5 5 3.68 6.4 4.91 5.1 2620.33 85 11 2 12 31353}
set rawdata(26) {7 0.99 26 24 -100 6 1.78 9.25 6.05 4.79 2633.65 85 11 2 12 31353}
set rawdata(27) {6 0.99 27 24 -97.5 7 2.1 12.54 4.64 1.23 2653.35 85 11 2 12 31353}
set rawdata(28) {12 0.99 28 24 -95 8 9.36 18.28 4.1 -1.78 2674.98 85 11 2 12 31353}
set rawdata(29) {7 0.99 29 26 -102.5 9 1.36 7.19 4.2 8.54 2599.83 85 11 2 12 31353}
set rawdata(30) {7 0.99 30 26 -100 10 5.87 9.33 4.85 6.7 2614.01 85 11 2 12 31353}
set rawdata(31) {6 0.93 31 26 -97.5 11 11.69 12.03 3.82 2.69 2634.35 85 11 2 12 31353}
set rawdata(32) {12 0.99 32 26 -95 12 24.67 16.78 3.99 -0.27 2660.06 85 11 2 12 31353}
set rawdata(33) {7 0.96 33 28 -102.5 13 3.56 7.53 4.53 12.85 2594.83 85 11 2 12 31353}
set rawdata(34) {7 0.99 34 28 -100 14 14.45 9.18 4.91 9.05 2605.2 85 11 2 12 31353}
set rawdata(35) {7 0.89 35 28 -97.5 15 15.67 11.3 5.74 4.44 2628.66 85 11 2 12 31353}
set rawdata(36) {6 0.81 36 28 -95 16 10.6 14.91 6.5 2.09 2648.43 85 11 2 12 31353}
set rawdata(37) {16 0.66 37 30 -102.5 17 5.96 5.4 4.49 17.04 2603.11 85 11 2 12 31353}
set rawdata(38) {7 0.97 38 30 -100 18 16.52 6.55 4.82 11.71 2612.85 85 11 2 12 31353}
set rawdata(39) {7 0.99 39 30 -97.5 19 30.64 7.93 5.88 7.17 2636.39 85 11 2 12 31353}
set rawdata(40) {7 0.99 40 30 -95 20 7.12 8.47 7.25 5.25 2646.18 85 11 2 12 31353}
set rawdata(41) {7 0.99 41 22 -102.5 1 3.44 8.24 5.89 5.8 2635.18 85 11 3 12 31354}
set rawdata(42) {7 0.96 42 22 -100 2 3.95 8.02 4.38 10.22 2635.33 85 11 3 12 31354}
set rawdata(43) {0 0.54 43 22 -97.5 3 0 8.14 5.08 12.58 2640.68 85 11 3 12 31354}
set rawdata(44) {28 0.85 44 22 -95 4 0.27 13.76 5.37 10.57 2656.83 85 11 3 12 31354}
set rawdata(45) {7 0.65 45 24 -102.5 5 0.49 4.82 3.46 8.05 2637.63 85 11 3 12 31354}
set rawdata(46) {16 0.59 46 24 -100 6 0.67 5.54 3.76 11.84 2626.87 85 11 3 12 31354}
set rawdata(47) {0 0.94 47 24 -97.5 7 0 6.84 3.3 12.88 2632.59 85 11 3 12 31354}
set rawdata(48) {4 0.42 48 24 -95 8 0.57 12.92 3.12 10.45 2651.56 85 11 3 12 31354}
set rawdata(49) {16 0.95 49 26 -102.5 9 0.18 4.4 1.88 8.77 2642.42 85 11 3 12 31354}
set rawdata(50) {16 0.99 50 26 -100 10 0.15 4.04 2.71 11.66 2628.96 85 11 3 12 31354}
set rawdata(51) {16 0.96 51 26 -97.5 11 0.15 5.94 3.03 11.82 2627.63 85 11 3 12 31354}
set rawdata(52) {4 0.91 52 26 -95 12 2.94 12.19 2.85 9.54 2641.6 85 11 3 12 31354}
set rawdata(53) {16 0.54 53 28 -102.5 13 0.01 3.94 1.64 7.06 2641.28 85 11 3 12 31354}
set rawdata(54) {0 0.99 54 28 -100 14 0 3.8 1.51 9.48 2626.89 85 11 3 12 31354}
set rawdata(55) {16 0.88 55 28 -97.5 15 0.03 5.19 2.44 10.21 2619.27 85 11 3 12 31354}
set rawdata(56) {4 0.51 56 28 -95 16 1.78 10.85 3.4 8.56 2625.11 85 11 3 12 31354}
set rawdata(57) {14 0.91 57 30 -102.5 17 0.02 3.24 1.43 2.94 2632.96 85 11 3 12 31354}
set rawdata(58) {0 0.99 58 30 -100 18 0 3.45 0.65 5.99 2616.25 85 11 3 12 31354}
set rawdata(59) {0 0.99 59 30 -97.5 19 0 3.9 1.06 7.72 2608.57 85 11 3 12 31354}
set rawdata(60) {16 0.73 60 30 -95 20 0.31 4.75 2.85 7.49 2609.29 85 11 3 12 31354}
set rawdata(61) {14 0.99 61 22 -102.5 1 0.1 5.63 3.32 4.38 2682.93 85 11 4 12 31355}
set rawdata(62) {14 1 62 22 -100 2 0.15 5.49 1.63 5.28 2667.25 85 11 4 12 31355}
set rawdata(63) {0 0.43 63 22 -97.5 3 0 6.4 2.42 5.01 2656.45 85 11 4 12 31355}
set rawdata(64) {26 0.84 64 22 -95 4 0 12.06 2.77 5.71 2655.83 85 11 4 12 31355}
set rawdata(65) {14 1 65 24 -102.5 5 0.06 4.72 1.91 4.04 2683.66 85 11 4 12 31355}
set rawdata(66) {14 0.99 66 24 -100 6 0.31 5.38 1.25 4.63 2671.86 85 11 4 12 31355}
set rawdata(67) {0 0.74 67 24 -97.5 7 0 5.88 1.04 4.98 2659.77 85 11 4 12 31355}
set rawdata(68) {14 0.99 68 24 -95 8 0.01 10.5 0.82 6.34 2654.07 85 11 4 12 31355}
set rawdata(69) {14 1 69 26 -102.5 9 0.13 4.76 1.62 3.58 2677.45 85 11 4 12 31355}
set rawdata(70) {0 0.78 70 26 -100 10 0 4.94 1.34 3.75 2666.4 85 11 4 12 31355}
set rawdata(71) {0 0.92 71 26 -97.5 11 0 5.03 1.04 4.81 2663.58 85 11 4 12 31355}
set rawdata(72) {14 0.99 72 26 -95 12 0.03 9 0.76 7.01 2658.24 85 11 4 12 31355}
set rawdata(73) {1 0.71 73 28 -102.5 13 0 5.06 1.91 3.21 2666.47 85 11 4 12 31355}
set rawdata(74) {0 0.59 74 28 -100 14 0 4.98 1.86 3.3 2662.74 85 11 4 12 31355}
set rawdata(75) {0 0.91 75 28 -97.5 15 0 4.64 1.45 4.45 2660.71 85 11 4 12 31355}
set rawdata(76) {24 0.97 76 28 -95 16 0 8.61 1.15 6.73 2654.4 85 11 4 12 31355}
set rawdata(77) {0 0.65 77 30 -102.5 17 0 4.57 2.05 3.52 2658.91 85 11 4 12 31355}
set rawdata(78) {0 0.71 78 30 -100 18 0 5.15 2.02 3.43 2658.74 85 11 4 12 31355}
set rawdata(79) {0 0.92 79 30 -97.5 19 0 4.18 1.69 3.88 2655.62 85 11 4 12 31355}
set rawdata(80) {0 0.98 80 30 -95 20 0 3.73 1.2 5.53 2642.3 85 11 4 12 31355}
set rawdata(81) {1 0.99 81 22 -102.5 1 0 3.95 2.12 1.33 2686.32 85 11 5 12 31356}
set rawdata(82) {1 0.99 82 22 -100 2 0 4.89 1.06 0.12 2682.94 85 11 5 12 31356}
set rawdata(83) {24 0.56 83 22 -97.5 3 0 7.01 1.49 0.51 2681.76 85 11 5 12 31356}
set rawdata(84) {24 0.99 84 22 -95 4 0 10.1 1.02 1.88 2680.07 85 11 5 12 31356}
set rawdata(85) {1 0.99 85 24 -102.5 5 0 3.44 2.21 -0.49 2682.68 85 11 5 12 31356}
set rawdata(86) {1 0.99 86 24 -100 6 0 4.21 1.76 -0.8 2678.64 85 11 5 12 31356}
set rawdata(87) {1 0.89 87 24 -97.5 7 0 5.57 1.44 0.07 2679.74 85 11 5 12 31356}
set rawdata(88) {24 1 88 24 -95 8 0 8.1 0.62 1.57 2677.69 85 11 5 12 31356}
set rawdata(89) {1 0.99 89 26 -102.5 9 0 3.99 2.7 -1.7 2676.24 85 11 5 12 31356}
set rawdata(90) {1 0.99 90 26 -100 10 0 4.64 2.35 -1.03 2672.95 85 11 5 12 31356}
set rawdata(91) {1 0.97 91 26 -97.5 11 0 5.36 1.62 -0.15 2673.82 85 11 5 12 31356}
set rawdata(92) {24 0.99 92 26 -95 12 0 7.54 1.01 1.01 2673.7 85 11 5 12 31356}
set rawdata(93) {1 0.99 93 28 -102.5 13 0 4.73 2.22 -1.67 2669.28 85 11 5 12 31356}
set rawdata(94) {1 0.99 94 28 -100 14 0 5.56 2.07 -0.69 2665.33 85 11 5 12 31356}
set rawdata(95) {1 0.99 95 28 -97.5 15 0 5.64 1.63 -0.09 2663.6 85 11 5 12 31356}
set rawdata(96) {24 0.99 96 28 -95 16 0 8.42 1.27 0.69 2665.38 85 11 5 12 31356}
set rawdata(97) {1 0.99 97 30 -102.5 17 0 5.06 1.75 -1.82 2665.2 85 11 5 12 31356}
set rawdata(98) {1 0.99 98 30 -100 18 0 5.19 1.62 -0.83 2658.39 85 11 5 12 31356}
set rawdata(99) {1 0.99 99 30 -97.5 19 0 5.84 1.39 -0.1 2654.15 85 11 5 12 31356}
set rawdata(100) {1 0.99 100 30 -95 20 0 4.86 1.17 0.6 2656.29 85 11 5 12 31356}
set rawdata(101) {5 0.99 101 22 -102.5 1 0 5.85 1.77 -5.08 2697.89 85 11 6 12 31357}
set rawdata(102) {5 0.81 102 22 -100 2 0 5.86 0.31 -6.56 2699.72 85 11 6 12 31357}
set rawdata(103) {5 0.6 103 22 -97.5 3 0 7.78 1.05 -5.52 2697.36 85 11 6 12 31357}
set rawdata(104) {24 0.99 104 22 -95 4 0 10.78 0.8 -3.69 2695.82 85 11 6 12 31357}
set rawdata(105) {25 0.88 105 24 -102.5 5 0 4.87 2.52 -7.16 2694.28 85 11 6 12 31357}
set rawdata(106) {25 0.99 106 24 -100 6 0 5.36 0.96 -7.71 2696.04 85 11 6 12 31357}
set rawdata(107) {5 0.72 107 24 -97.5 7 0 6.52 1.03 -5.74 2697.64 85 11 6 12 31357}
set rawdata(108) {24 0.99 108 24 -95 8 0 9.86 0.79 -3.97 2697.61 85 11 6 12 31357}
set rawdata(109) {25 0.99 109 26 -102.5 9 0 5.74 3.49 -8.34 2684.2 85 11 6 12 31357}
set rawdata(110) {25 0.99 110 26 -100 10 0 5.7 1.83 -7.91 2684.69 85 11 6 12 31357}
set rawdata(111) {5 0.73 111 26 -97.5 11 0 6.32 1.31 -5.85 2690.08 85 11 6 12 31357}
set rawdata(112) {24 0.99 112 26 -95 12 0 9.96 1.12 -4.25 2694.47 85 11 6 12 31357}
set rawdata(113) {25 0.99 113 28 -102.5 13 0 6.25 3.63 -8.55 2674.72 85 11 6 12 31357}
set rawdata(114) {25 0.99 114 28 -100 14 0 5.97 2.37 -7.85 2673.7 85 11 6 12 31357}
set rawdata(115) {17 0.79 115 28 -97.5 15 0.01 6.23 1.64 -6.11 2678.71 85 11 6 12 31357}
set rawdata(116) {24 0.96 116 28 -95 16 0 9.79 1.26 -4.76 2684.56 85 11 6 12 31357}
set rawdata(117) {25 0.99 117 30 -102.5 17 0 6.02 3.43 -8.59 2663.81 85 11 6 12 31357}
set rawdata(118) {17 1 118 30 -100 18 0.08 6.05 3.17 -8.1 2663.58 85 11 6 12 31357}
set rawdata(119) {17 0.97 119 30 -97.5 19 0.05 5.9 2.05 -6.61 2667.06 85 11 6 12 31357}
set rawdata(120) {13 0.81 120 30 -95 20 0.03 5.55 1.35 -5.4 2671.52 85 11 6 12 31357}
set rawdata(121) {1 1 121 22 -102.5 1 0 5.35 1.56 -1.79 2693.63 85 11 7 12 31358}
set rawdata(122) {1 0.99 122 22 -100 2 0 5.61 1.01 -2.67 2700.48 85 11 7 12 31358}
set rawdata(123) {24 0.98 123 22 -97.5 3 0 9.71 0.65 -2.46 2701.98 85 11 7 12 31358}
set rawdata(124) {24 0.99 124 22 -95 4 0 13.34 0.51 -1.58 2701.69 85 11 7 12 31358}
set rawdata(125) {1 0.99 125 24 -102.5 5 0 4.99 3.89 -0.94 2685.35 85 11 7 12 31358}
set rawdata(126) {1 0.99 126 24 -100 6 0 5.72 2.23 -1.88 2690.49 85 11 7 12 31358}
set rawdata(127) {24 0.98 127 24 -97.5 7 0 8.93 0.79 -2.27 2690.97 85 11 7 12 31358}
set rawdata(128) {24 0.99 128 24 -95 8 0 13.14 0.52 -1.64 2691.46 85 11 7 12 31358}
set rawdata(129) {1 0.99 129 26 -102.5 9 0 5.85 5.41 1.25 2674.59 85 11 7 12 31358}
set rawdata(130) {1 0.99 130 26 -100 10 0 7.07 3.02 0.16 2676.69 85 11 7 12 31358}
set rawdata(131) {19 0.99 131 26 -97.5 11 0.03 9.34 2.21 -1.35 2678.08 85 11 7 12 31358}
set rawdata(132) {26 0.7 132 26 -95 12 0 13.5 1.78 -1.58 2680.59 85 11 7 12 31358}
set rawdata(133) {1 0.99 133 28 -102.5 13 0 6.04 3.26 3.83 2663.45 85 11 7 12 31358}
set rawdata(134) {1 0.99 134 28 -100 14 0 7.76 3.17 2.5 2662.51 85 11 7 12 31358}
set rawdata(135) {1 0.93 135 28 -97.5 15 0 9.21 3.32 -0.03 2663.92 85 11 7 12 31358}
set rawdata(136) {26 0.91 136 28 -95 16 0 14.24 3.27 -1.32 2667.16 85 11 7 12 31358}
set rawdata(137) {14 0.99 137 30 -102.5 17 0.1 4.76 2.23 6.34 2655.18 85 11 7 12 31358}
set rawdata(138) {1 0.98 138 30 -100 18 0 5.51 2.44 5.08 2650.28 85 11 7 12 31358}
set rawdata(139) {14 0.97 139 30 -97.5 19 0.01 7.76 2.67 1.76 2648.5 85 11 7 12 31358}
set rawdata(140) {1 0.94 140 30 -95 20 0 9.19 3.15 -0.84 2649.81 85 11 7 12 31358}
set rawdata(141) {21 0.99 141 22 -102.5 1 0.4 6.31 3.75 0.89 2695.99 85 11 8 12 31359}
set rawdata(142) {10 0.89 142 22 -100 2 0.85 7.13 1.11 3.55 2695.88 85 11 8 12 31359}
set rawdata(143) {28 0.6 143 22 -97.5 3 0.32 9.69 2.54 3.83 2690.1 85 11 8 12 31359}
set rawdata(144) {4 0.96 144 22 -95 4 0.82 14.48 2.29 2.7 2691.98 85 11 8 12 31359}
set rawdata(145) {21 0.98 145 24 -102.5 5 0.03 5.87 3.97 2.13 2681.8 85 11 8 12 31359}
set rawdata(146) {10 0.92 146 24 -100 6 0.73 6.97 1.99 4.63 2682.32 85 11 8 12 31359}
set rawdata(147) {28 0.77 147 24 -97.5 7 0.16 9.95 2.79 4.46 2679.66 85 11 8 12 31359}
set rawdata(148) {28 0.76 148 24 -95 8 0.27 12.77 2.66 3.17 2679.72 85 11 8 12 31359}
set rawdata(149) {21 0.97 149 26 -102.5 9 0.37 6.87 5 1.86 2668.53 85 11 8 12 31359}
set rawdata(150) {10 0.86 150 26 -100 10 0.9 7.12 3 3.99 2671.21 85 11 8 12 31359}
set rawdata(151) {10 0.84 151 26 -97.5 11 0.63 9.2 2.98 4.3 2672.66 85 11 8 12 31359}
set rawdata(152) {28 0.55 152 26 -95 12 0.38 13.07 3.21 3.39 2670.88 85 11 8 12 31359}
set rawdata(153) {21 0.95 153 28 -102.5 13 0.69 6.79 4.28 0.57 2658.38 85 11 8 12 31359}
set rawdata(154) {10 0.83 154 28 -100 14 1.21 6.73 3.17 2.86 2662.39 85 11 8 12 31359}
set rawdata(155) {10 0.91 155 28 -97.5 15 0.87 7.14 3.06 3.94 2664.53 85 11 8 12 31359}
set rawdata(156) {4 0.94 156 28 -95 16 0.87 13.9 3.38 3.74 2663.14 85 11 8 12 31359}
set rawdata(157) {21 0.63 157 30 -102.5 17 0.43 5.67 2.74 -0.82 2654.93 85 11 8 12 31359}
set rawdata(158) {10 0.35 158 30 -100 18 0.65 4.59 2.47 1.46 2655.34 85 11 8 12 31359}
set rawdata(159) {14 0.94 159 30 -97.5 19 0.11 4.62 2.84 3.44 2654.62 85 11 8 12 31359}
set rawdata(160) {14 0.54 160 30 -95 20 0.49 5.7 3.03 4.55 2654.08 85 11 8 12 31359}
set rawdata(161) {21 0.99 161 22 -102.5 1 0.14 7.19 2.22 2.02 2700.65 85 11 9 12 31360}
set rawdata(162) {11 0.68 162 22 -100 2 0.41 8.87 3.62 -0.19 2699.18 85 11 9 12 31360}
set rawdata(163) {20 0.01 163 22 -97.5 3 0.11 11.63 2.99 -0.51 2697.15 85 11 9 12 31360}
set rawdata(164) {26 0.99 164 22 -95 4 0 15.41 2.2 0.32 2692.49 85 11 9 12 31360}
set rawdata(165) {21 0.98 165 24 -102.5 5 0.03 6.23 2.49 -0.32 2691.28 85 11 9 12 31360}
set rawdata(166) {11 0.5 166 24 -100 6 1.12 9.32 3.41 -2.52 2689.2 85 11 9 12 31360}
set rawdata(167) {19 0.93 167 24 -97.5 7 0.13 12.06 2.21 -1.65 2686.45 85 11 9 12 31360}
set rawdata(168) {20 0.76 168 24 -95 8 0.54 15.37 1.41 -0.01 2681.87 85 11 9 12 31360}
set rawdata(169) {9 0.98 169 26 -102.5 9 0.16 7.01 3.75 -3.3 2679.94 85 11 9 12 31360}
set rawdata(170) {18 0.63 170 26 -100 10 2.36 10.34 3.8 -4.68 2676.22 85 11 9 12 31360}
set rawdata(171) {8 0.9 171 26 -97.5 11 2.16 13.07 2.81 -2.64 2671.15 85 11 9 12 31360}
set rawdata(172) {12 0.81 172 26 -95 12 3.88 15.63 1.69 -0.29 2666.08 85 11 9 12 31360}
set rawdata(173) {9 0.96 173 28 -102.5 13 1.76 8.17 4.35 -5.38 2670.08 85 11 9 12 31360}
set rawdata(174) {18 0.95 174 28 -100 14 3.34 10.89 4.83 -6.3 2664.09 85 11 9 12 31360}
set rawdata(175) {8 0.63 175 28 -97.5 15 4.39 12.81 3.79 -3.78 2654.61 85 11 9 12 31360}
set rawdata(176) {12 0.91 176 28 -95 16 6.3 15.6 2.8 -1.04 2647.74 85 11 9 12 31360}
set rawdata(177) {9 0.89 177 30 -102.5 17 0.81 8.06 3.72 -6.57 2662.79 85 11 9 12 31360}
set rawdata(178) {18 0.99 178 30 -100 18 2.7 10.94 4.49 -7.48 2657.13 85 11 9 12 31360}
set rawdata(179) {18 0.97 179 30 -97.5 19 4.06 12.11 3.37 -5.41 2648.59 85 11 9 12 31360}
set rawdata(180) {8 0.81 180 30 -95 20 5.76 12.33 2.72 -2.72 2640.81 85 11 9 12 31360}
set rawdata(181) {11 0.96 181 22 -102.5 1 0.07 8.8 3.71 -0.48 2702.65 85 11 10 12 31361}
set rawdata(182) {11 0.98 182 22 -100 2 0.2 9.53 4.71 -1.58 2702.79 85 11 10 12 31361}
set rawdata(183) {6 0.99 183 22 -97.5 3 1.34 13.78 5.38 -1.81 2702.06 85 11 10 12 31361}
set rawdata(184) {12 0.99 184 22 -95 4 4.11 19.25 4.15 -1.4 2700.28 85 11 10 12 31361}
set rawdata(185) {1 0.89 185 24 -102.5 5 0 5.66 3.87 0.5 2699.81 85 11 10 12 31361}
set rawdata(186) {3 0.92 186 24 -100 6 0 8.6 3.92 -1.52 2699.34 85 11 10 12 31361}
set rawdata(187) {6 0.98 187 24 -97.5 7 0.63 13.04 5.09 -1.91 2697.41 85 11 10 12 31361}
set rawdata(188) {12 0.99 188 24 -95 8 4.02 18.72 4.33 -1.49 2691.88 85 11 10 12 31361}
set rawdata(189) {1 0.99 189 26 -102.5 9 0 5.39 2.01 1.39 2693.91 85 11 10 12 31361}
set rawdata(190) {3 0.66 190 26 -100 10 0 8.26 3.55 -0.86 2694.55 85 11 10 12 31361}
set rawdata(191) {6 0.9 191 26 -97.5 11 0.72 13.19 4.14 -1.77 2693.98 85 11 10 12 31361}
set rawdata(192) {12 0.99 192 26 -95 12 6.79 17.9 4.21 -1.34 2687.59 85 11 10 12 31361}
set rawdata(193) {1 0.99 193 28 -102.5 13 0 5.69 1.45 1.69 2686.16 85 11 10 12 31361}
set rawdata(194) {19 0.96 194 28 -100 14 0.06 8.66 2.93 -0.15 2688.37 85 11 10 12 31361}
set rawdata(195) {19 0.57 195 28 -97.5 15 1.09 13.02 3.15 -1.31 2687.71 85 11 10 12 31361}
set rawdata(196) {12 0.98 196 28 -95 16 5.14 17.12 3.52 -1.03 2681.2 85 11 10 12 31361}
set rawdata(197) {1 0.99 197 30 -102.5 17 0 5.35 1.05 1.78 2675.93 85 11 10 12 31361}
set rawdata(198) {19 0.99 198 30 -100 18 0.2 8.25 2.14 0.35 2676.87 85 11 10 12 31361}
set rawdata(199) {19 0.92 199 30 -97.5 19 1.32 12.71 2.6 -0.53 2676.62 85 11 10 12 31361}
set rawdata(200) {19 0.63 200 30 -95 20 3.32 12.97 2.62 -0.42 2671.45 85 11 10 12 31361}

# this is only for the web version.  I've hard-coded the
# data into the script itself.  Users will be allowed to
# select data files from which pcps will be created in
# the "in-house" version.

set data_names $rawdata(0)
set number_columns [llength $data_names]

# I'm selecting out 7 of the 19 columns for web display.

set web_data_names {class# prob grid_point sea_level precipitation humidity700 sequential_date}

set number_axes [llength $web_data_names]

foreach column $web_data_names {
 set dvar($column) ""
}

# dvar(str) is the raw data

for {set i 1} {$i <= 50} {incr i} {
 for {set k 0} {$k < $number_columns} {incr k} {
  lappend dvar([lindex $data_names $k]) [expr double([lindex $rawdata($i) $k])]
 }
}
foreach item $web_data_names  {
      set l [llength $dvar($item)]
      set min($item) [lindex [lsort -real $dvar($item)] 0]
      set max($item) [lindex [lsort -real $dvar($item)] [expr ($l-1)]]
      set range($item) [expr {$max($item) - $min($item)}]
      if {$range($item) == 0} {set range($item) 1}

}

set littleFont {Times 10}
set plotFont {Times 12}
set bigFont {Times 16}
set reallyBigFont {Times 20}
set recs ""

global color_sch
global class_num

# default color scheme is blue sequential, default number of classes is 4
set color_sch GPD
set class_num 4
set old_class_num $class_num

# this is different for the web version: no toplevel windows... it's all
# embedded in the wish window .

frame .colorchoice -relief sunken -bd 1
pack .colorchoice -side left -anchor n -fill y
label .colorchoice.classlabel -text "# of classes:" -font $plotFont
label .colorchoice.colorlabel -text "color scheme:" -font $plotFont

set color_poss {RdS GnS GPD RBD Spc}
set b 0
foreach item $color_poss {
 radiobutton .colorchoice.color$b -text $item -font $plotFont -variable color_sch -value $item -command "set focus_state off; Focus"
 incr b
}
checkbutton .colorchoice.colorfocus -text "focus" -font $plotFont \
 -variable focus_state -onvalue on -offvalue off -command Focus
set class_poss {3 4 5 6}
set b 0
foreach item $class_poss {
 radiobutton .colorchoice.class$b -text $item -font $plotFont -variable class_num -value $item -command Focus
 incr b
}

button .colorchoice.apply -text "apply" -font $bigFont \
 -bg deepSkyBlue4 -fg white -command "Execute .pcp.c"

label .colorchoice.author -text "1999 Rob Edsall" -font $littleFont

pack .colorchoice.classlabel -side top -anchor w
for {set b 0} {$b < 4} {incr b} {
 pack .colorchoice.class$b -side top \
  -anchor w
 }
pack .colorchoice.colorlabel -side top -anchor w
for {set b 0} {$b < 5} {incr b} {
 pack .colorchoice.color$b -side top \
  -anchor w
}
pack .colorchoice.colorfocus -side top -anchor w -pady 10
pack .colorchoice.apply -side top -fill x -padx 4 -pady 4
pack .colorchoice.author -side bottom -pady 4

set focus_state off

set axisOrder ""
foreach item $web_data_names {
   lappend axisOrder $item
}

# setUpColor $color_sch $class_num

frame .pcp -relief sunken -bd 1
pack .pcp -side left -expand yes -fill both

# scrollbar .pcp.hscroll -orient horiz -command ".pcp.c xview"

set xpcpcanv [expr 200*$number_axes]
set pcpreg {0 0}
lappend pcpreg $xpcpcanv
lappend pcpreg 400

#this goes as a parameter of the canvas below. commented 1-10-98:
#    -width 900 -scrollregion $pcpreg \
#    -xscrollcommand ".pcp.hscroll set"\

canvas .pcp.c -relief sunken -borderwidth 2 -height 780 -width $xpcpcanv\
 -background black
# -scrollregion $pcpreg -background black \
# -xscrollcommand ".pcp.hscroll set"

pack .pcp.c -side top -expand yes -fill both
#pack .pcp.hscroll -side top -fill x

set dx_display_possibilities \
 {"color" "x-axis" "y-axis" "z-axis" "undisplayed"}

for {set i 0} {$i < 4} {incr i} {
  set dx_display($i) [lindex $dx_display_possibilities $i]
}
for {set i $i} {$i <  $number_axes} {incr i} {
  set dx_display($i) "undisplayed"
}
for {set i 0} {$i < $number_axes} {incr i} {
  set dx_display_old($i) $dx_display($i)
}
for {set i 0} {$i < $number_axes} {incr i} {
  set v($i) [lindex $web_data_names $i]
}

set axis_height 360
set i 0
foreach item $web_data_names {
  .pcp.c create line [expr $i*200+100] 160 \
[expr $i*200+100] [expr $axis_height+160] \
  -width 1 -fill grey80
 
 for {set j 0} {$j < $number_axes} {incr j} {
  radiobutton .pcp.c.v$i$j -fg white -bg black \
    -activebackground black -activeforeground white \
    -selectcolor grey20 \
    -text [lindex $web_data_names $j] \
    -font $plotFont -variable v($i) \
    -value [lindex $web_data_names $j]
  .pcp.c create window [expr $i*200+70] \
  [expr $axis_height+180+24*$j] -anchor w \
  -window .pcp.c.v$i$j
 }
 for {set j 0} {$j < 5} {incr j} {
  radiobutton .pcp.c.d$i$j -fg white -bg black \
    -activebackground black -activeforeground white \
    -selectcolor grey20 \
    -text [lindex $dx_display_possibilities $j] \
    -font $plotFont -variable dx_display($i) \
    -value [lindex $dx_display_possibilities $j]
  .pcp.c create window [expr $i*200+70] \
  [expr 20+24*$j] -anchor w \
  -window .pcp.c.d$i$j
 }

 incr i
}

for {set i 1} {$i < 7} {incr i} {
 if {$i < $class_num} {
  set scaler($i) [expr double($i)/double($class_num)]
 } else {
  set scaler($i) 1.0
 }
}

for {set k 0} {$k < [llength $dvar($item)]} {incr k} {
   foreach item $web_data_names {
 set pcpy($k,$item) [expr \
  520 - {int($axis_height*(([lindex $dvar($item) $k] \
  - $min($item))/$range($item)))}]
   }
}
 
 

setUpColor $color_sch $class_num
 

Execute .pcp.c

.pcp.c bind lineseg <Any-Enter> "ItemEnter .pcp.c"
.pcp.c bind lineseg2 <Any-Leave> "ItemLeave .pcp.c"
bind .pcp.c <1> "ItemMark .pcp.c %x %y"
bind .pcp.c <B1-Motion> "ItemStroke .pcp.c %x %y"
bind .pcp.c <ButtonRelease-1> "ItemBrush .pcp.c"
.pcp.c bind carat <3> "selectTab .pcp.c %y"
.pcp.c bind carat <ButtonRelease-3> "releaseTab .pcp.c"
.pcp.c bind carat <B3-Motion> "moveColor .pcp.c %y"
 

#catch {destroy .colorchoice.checker1}
#label .colorchoice.checker1 -text "$focus_state" -font {Times 12}
#pack .colorchoice.checker1 -side top