File: plotdemos3.tcl

package info (click to toggle)
tklib 0.4.1-20080501-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 3,508 kB
  • ctags: 1,527
  • sloc: tcl: 34,008; sh: 2,318; ansic: 792; makefile: 100; exp: 21; sed: 16
file content (43 lines) | stat: -rwxr-xr-x 986 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#! /bin/sh
# -*- tcl -*- \
exec tclsh "$0" ${1+"$@"}

package require Tcl 8.4
package require Tk

source ../../modules/plotchart/plotchart.tcl
package require Plotchart

#
# Show a Gantt chart
#

canvas .c -width 500 -height 200 -bg white
pack   .c -fill both
.c delete all

set s [::Plotchart::createGanttchart .c "1 january 2004" \
        "31 december 2004" 4]

set from [$s task "Spring" "1 march 2004" "1 june 2004" 30]
set to   [$s task "Summer" "1 june 2004" "1 september 2004" 10]
$s summary "First half" $from $to
$s connect $from $to
$s vertline "1 jan" "1 january 2004"
$s vertline "1 apr" "1 april 2004"
$s vertline "1 jul" "1 july 2004"
$s vertline "1 oct" "1 october 2004"
$s milestone "Longest day" "21 july 2004"
$s title "Seasons (northern hemisphere)"

#
# Copy the thing:
# Should result in this configuration:
#  = =
#  =
toplevel .t
canvas   .t.c -width 700 -height 500
pack .t.c
::Plotchart::plotpack .t.c top $s $s
::Plotchart::plotpack .t.c left $s
console show