Tk Library Source Code

Check-in [30e98ccbd3]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Resolve a number of tickets, some of which were there for a long time.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 30e98ccbd310bd42840dcd80a6a59183a8d8c8f8af82de837e88d55f6f483095
User & Date: markus 2024-06-04 19:10:01.566
Context
2024-06-26
13:11
Ticket [d492c4ceed] DGW text mixins added. Ticket [b6e8764f2d] DGW treeview mixins added. Thank you for the report and patience. check-in: 1dfb1781ad user: aku tags: trunk
2024-06-04
19:10
Resolve a number of tickets, some of which were there for a long time. check-in: 30e98ccbd3 user: markus tags: trunk
2024-06-03
18:47
Ticket [4aa4dc9e44] <B> Fixed installer bug missing icons/ and msgs/ of widgetl module. Thank you for the report and patience. check-in: bf751018a5 user: aku tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to modules/plotchart/ChangeLog.








1
2
3
4
5
6
7








2023-08-13  Arjen Markus  <arjenmarkus@users,sourceforge.net>
        * plotchart.tcl:   Correct the scaling for windrose plots (ticket 8df371ba8e)
        * pkgIndex.tcl:    Increase the version number to 2.6.1

2023-05-29  Arjen Markus  <arjenmarkus@users,sourceforge.net>
        * plotchart.man:   Describe the violin subcommand and dendrogram plots
        * plotchart.tcl:   Add the violin subcommand and the createDendrogram command
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2024-06-03  Arjen Markus  <arjenmarkus@users,sourceforge.net>
        * plotconfig.tcl:  Add missing elements for 3dribbon plots (ticket 3d35a07f665b17987c9773cfa604b07d6d9b0cb7)
        * plotpriv.tcl:    Let the timechart methods return the canvas item IDs (ticket e8bf5556a856e0f56bfd0e12674339f3d09356ab)
        * plotannot.tcl:   Apply patch to long-standing bug regarding shaded vertical bars (ticket 34783217f723eb452634e7af7a1855d3e09b7fac)
        * plotaxis.tcl:    Introduce -locale option for time axis (ticket 55f89cf0be4fcdb002d3f96fc1ca8b351ccd1878)
        * plotchart.man:   Describe the new -locale option
        * pkgIndex.tcl:    Increase the version number to 2.6.2

2023-08-13  Arjen Markus  <arjenmarkus@users,sourceforge.net>
        * plotchart.tcl:   Correct the scaling for windrose plots (ticket 8df371ba8e)
        * pkgIndex.tcl:    Increase the version number to 2.6.1

2023-05-29  Arjen Markus  <arjenmarkus@users,sourceforge.net>
        * plotchart.man:   Describe the violin subcommand and dendrogram plots
        * plotchart.tcl:   Add the violin subcommand and the createDendrogram command
Changes to modules/plotchart/pkgIndex.tcl.
1
2
3
4
5
6
7
if {![package vsatisfies [package provide Tcl] 8.5-]} {
    # PRAGMA: returnok
    return
}
package ifneeded Plotchart 2.6.1 [list source [file join $dir plotchart.tcl]]
package ifneeded xyplot    1.0.1 [list source [file join $dir xyplot.tcl]]
package ifneeded plotanim    0.2 [list source [file join $dir plotanim.tcl]]




|


1
2
3
4
5
6
7
if {![package vsatisfies [package provide Tcl] 8.5-]} {
    # PRAGMA: returnok
    return
}
package ifneeded Plotchart 2.6.2 [list source [file join $dir plotchart.tcl]]
package ifneeded xyplot    1.0.1 [list source [file join $dir xyplot.tcl]]
package ifneeded plotanim    0.2 [list source [file join $dir plotanim.tcl]]
Changes to modules/plotchart/plotannot.tcl.
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
        set x2 $rxmax
    }

    set n 50
    if { $dir == "h" } {
        set nmax [expr {ceil($n*($rxmax-$rxmin)/double($pxmax-$pxmin))}]
    } else {
        set nmax [expr {ceil($n*($rymin-$rymax)/double($pymin-$pymax))}]
    }
    for { set i 0 } { $i < $nmax } { incr i } {
        set factor [expr {($first*$i+$last*($n-$i-1))/double($n)}]
        set gcolour [BrightenColour $colour $intensity $factor]

        if { $dir == "h" } {
            set x1     $x2
            set x2     [expr {$rxmin+($i+1)*$fac}]
            if { $i == $nmax-1 } {
                set x2 $rxmax
            }
        } else {
            set y1     $y2
            set y2     [expr {$rymax+($i+1)*$fac}]
            if { $i == $nmax-1 } {
                set y2 $rymin
            }
        }

        $w create rectangle $x1 $y1 $x2 $y2 -fill $gcolour -outline $gcolour -tag {data background}
    }

    $w lower data







|













|

|







386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
        set x2 $rxmax
    }

    set n 50
    if { $dir == "h" } {
        set nmax [expr {ceil($n*($rxmax-$rxmin)/double($pxmax-$pxmin))}]
    } else {
        set nmax [expr {ceil($n*($rymin-$rymax)/double($pymax-$pymin))}]
    }
    for { set i 0 } { $i < $nmax } { incr i } {
        set factor [expr {($first*$i+$last*($n-$i-1))/double($n)}]
        set gcolour [BrightenColour $colour $intensity $factor]

        if { $dir == "h" } {
            set x1     $x2
            set x2     [expr {$rxmin+($i+1)*$fac}]
            if { $i == $nmax-1 } {
                set x2 $rxmax
            }
        } else {
            set y1     $y2
            set y2     [expr {$rymin+$i*$fac}]
            if { $i == $nmax-1 } {
                set y2 $rymax
            }
        }

        $w create rectangle $x1 $y1 $x2 $y2 -fill $gcolour -outline $gcolour -tag {data background}
    }

    $w lower data
Changes to modules/plotchart/plotaxis.tcl.
493
494
495
496
497
498
499

500
501
502
503
504
505
506
    set scaling($w,xaxis) {}

    set xs      {}
    set xts     {}
    set xbackup {}
    set numeric 1
    set gmt     0


    if { $xdelt eq {} } {
        set numeric 1

        foreach {arg val} $args {
            switch -exact -- $arg {
                -xlabels {







>







493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
    set scaling($w,xaxis) {}

    set xs      {}
    set xts     {}
    set xbackup {}
    set numeric 1
    set gmt     0
    set locale  {}

    if { $xdelt eq {} } {
        set numeric 1

        foreach {arg val} $args {
            switch -exact -- $arg {
                -xlabels {
548
549
550
551
552
553
554



555
556
557
558
559
560
561
                    set numeric    2
                    set timeformat $val
                    set scaling($w,xdelt) $xdelt
                }
                -gmt {
                    set gmt $val
                }



            }
        }
    }

    foreach x $xs xt $xts xb $xbackup {

        if { $numeric > 0 } {







>
>
>







549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
                    set numeric    2
                    set timeformat $val
                    set scaling($w,xdelt) $xdelt
                }
                -gmt {
                    set gmt $val
                }
                -locale {
                    set locale $val
                }
            }
        }
    }

    foreach x $xs xt $xts xb $xbackup {

        if { $numeric > 0 } {
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
            if { [string is double $xt] } {
                if { $numeric == 1 } {
                    set xlabel [format "%.12g" $xt]
                    if { $format != "" } {
                        set xlabel [FormatNumber $format $xt]
                    }
                } else {
                    set xlabel [clock format [expr {int($xt)}] -format $timeformat -gmt $gmt]
                }
            } else {
                set xlabel $xt
            }

            $w create line $xcrd $ycrd2 $xcrd $ycrd -tag [list xaxis $w] -fill $linecolor








|







580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
            if { [string is double $xt] } {
                if { $numeric == 1 } {
                    set xlabel [format "%.12g" $xt]
                    if { $format != "" } {
                        set xlabel [FormatNumber $format $xt]
                    }
                } else {
                    set xlabel [clock format [expr {int($xt)}] -format $timeformat -gmt $gmt -locale $locale]
                }
            } else {
                set xlabel $xt
            }

            $w create line $xcrd $ycrd2 $xcrd $ycrd -tag [list xaxis $w] -fill $linecolor

Changes to modules/plotchart/plotchart.man.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin Plotchart n 2.5.1]
[copyright {2022 Arjen Markus <[email protected]>}]
[moddesc   Plotchart]
[titledesc {Simple plotting and charting package}]
[require Tcl [opt 8.5]]
[require Tk [opt 8.5]]
[require Plotchart [opt 2.5.2]]

[description]
[para]

Plotchart is a Tcl-only package that focuses on the easy creation of
xy-plots, barcharts and other common types of graphical presentations.
The emphasis is on ease of use, rather than flexibility. The procedures

|





|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[comment {-*- tcl -*- doctools manpage}]
[manpage_begin Plotchart n 2.6.2]
[copyright {2022 Arjen Markus <[email protected]>}]
[moddesc   Plotchart]
[titledesc {Simple plotting and charting package}]
[require Tcl [opt 8.5]]
[require Tk [opt 8.5]]
[require Plotchart [opt 2.6.2]]

[description]
[para]

Plotchart is a Tcl-only package that focuses on the easy creation of
xy-plots, barcharts and other common types of graphical presentations.
The emphasis is on ease of use, rather than flexibility. The procedures
4362
4363
4364
4365
4366
4367
4368


4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384



4385
4386
4387
4388
4389
4390
4391

[section "USING DATE/TIME LABELS"]
The options -timeformat and -gmt are used to control the display of date/time
labels along the x-axis for those plot types for which it makes sense. These
options were implemented to take care of date/time labels for stripcharts,
as you can also use custom labels (the option -xlabels) if the axis is "static".
Since this is not the case for stripcharts, this was not an option (Tcllib/Tklib bug 3613718).



The example below illustrates how to use the -timeformat option. The -gmt option
merely suppresses the handling of daylight saving time by the [lb]clock format[rb] command.

[example {
package require Plotchart

pack [canvas .c -width 500 -bg white]

#
# Note that we need to present the x values as clock seconds
#
set start [clock scan  "0:00"]
set stop  [clock scan "10:00"]
set s [Plotchart::createStripchart .c [list $start $stop 7200] {0 10 1} -timeformat "%H:%M"]




foreach {x y} {0 0 2 5 5 2 9 9 12 10} {
    set x [expr {$start + 3600 * $x}] ;# Convert hour to clock seconds
    $s plot a $x $y
}}]

The [emph plot] subcommand simply interprets the x and y data as straightforward
numbers, so that you need to do the conversion from date/time to "clock seconds" yourself.







>
>
















>
>
>







4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396

[section "USING DATE/TIME LABELS"]
The options -timeformat and -gmt are used to control the display of date/time
labels along the x-axis for those plot types for which it makes sense. These
options were implemented to take care of date/time labels for stripcharts,
as you can also use custom labels (the option -xlabels) if the axis is "static".
Since this is not the case for stripcharts, this was not an option (Tcllib/Tklib bug 3613718).

You can also specify the -locale option to get a localised date/time label.

The example below illustrates how to use the -timeformat option. The -gmt option
merely suppresses the handling of daylight saving time by the [lb]clock format[rb] command.

[example {
package require Plotchart

pack [canvas .c -width 500 -bg white]

#
# Note that we need to present the x values as clock seconds
#
set start [clock scan  "0:00"]
set stop  [clock scan "10:00"]
set s [Plotchart::createStripchart .c [list $start $stop 7200] {0 10 1} -timeformat "%H:%M"]

# With a locale like "de":
#set s [Plotchart::createStripchart .c [list $start $stop 7200] {0 10 1} -timeformat "%H:%M" -locale de]

foreach {x y} {0 0 2 5 5 2 9 9 12 10} {
    set x [expr {$start + 3600 * $x}] ;# Convert hour to clock seconds
    $s plot a $x $y
}}]

The [emph plot] subcommand simply interprets the x and y data as straightforward
numbers, so that you need to do the conversion from date/time to "clock seconds" yourself.
Changes to modules/plotchart/plotchart.tcl.
1196
1197
1198
1199
1200
1201
1202

1203
1204
1205
1206
1207
1208
1209

   if { $xdelt eq {} || [lsearch $argv "-timeformat"] >= 0 } {
       set known_args {}
       foreach {arg val} [array get options] {
           switch -exact -- $arg {
               -xlabels    -
               -timeformat -

               -gmt        {
                   lappend known_args $arg $val
               }
               -axesatzero -
               -isometric  -
               -ylabels    -
               -altylabels {







>







1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210

   if { $xdelt eq {} || [lsearch $argv "-timeformat"] >= 0 } {
       set known_args {}
       foreach {arg val} [array get options] {
           switch -exact -- $arg {
               -xlabels    -
               -timeformat -
               -locale     -
               -gmt        {
                   lappend known_args $arg $val
               }
               -axesatzero -
               -isometric  -
               -ylabels    -
               -altylabels {
3474
3475
3476
3477
3478
3479
3480
3481
source [file join [file dirname [info script]] "plotobject.tcl"]
source [file join [file dirname [info script]] "plottable.tcl"]
source [file join [file dirname [info script]] "plotstatustimeline.tcl"]
source [file join [file dirname [info script]] "plotdendrogram.tcl"]

# Announce our presence
#
package provide Plotchart 2.6.1







|
3475
3476
3477
3478
3479
3480
3481
3482
source [file join [file dirname [info script]] "plotobject.tcl"]
source [file join [file dirname [info script]] "plottable.tcl"]
source [file join [file dirname [info script]] "plotstatustimeline.tcl"]
source [file join [file dirname [info script]] "plotdendrogram.tcl"]

# Announce our presence
#
package provide Plotchart 2.6.2
Changes to modules/plotchart/plotconfig.tcl.
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
        timechart     {title subtitle margin text legend leftaxis rightaxis bottomaxis background}
        stripchart    {title subtitle margin text legend leftaxis rightaxis bottomaxis background mask}
        isometric     {title subtitle margin text legend leftaxis rightaxis bottomaxis background mask}
        3dplot        {title subtitle margin text legend xaxis yaxis zaxis             background}
        3dbars        {title subtitle margin text legend leftaxis rightaxis bottomaxis background}
        radialchart   {title subtitle margin text legend leftaxis rightaxis bottomaxis background}
        txplot        {title subtitle margin text legend leftaxis rightaxis bottomaxis background mask}
        3dribbon      {title subtitle margin text legend leftaxis rightaxis bottomaxis background}
        boxplot       {title subtitle margin text legend leftaxis rightaxis bottomaxis background mask bar}
        windrose      {title subtitle margin text legend axis                          background}
        targetdiagram {title subtitle margin text legend leftaxis rightaxis bottomaxis background mask limits}
        performance   {title subtitle margin text legend leftaxis rightaxis bottomaxis background mask limits}
        table         {title subtitle margin background header oddrow evenrow cell frame leftaxis rightaxis bottomaxis}
        ternary       {title subtitle margin text legend axis leftaxis rightaxis bottomaxis background mask}
        distnormal    {title subtitle margin text legend leftaxis rightaxis bottomaxis background mask}







|







156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
        timechart     {title subtitle margin text legend leftaxis rightaxis bottomaxis background}
        stripchart    {title subtitle margin text legend leftaxis rightaxis bottomaxis background mask}
        isometric     {title subtitle margin text legend leftaxis rightaxis bottomaxis background mask}
        3dplot        {title subtitle margin text legend xaxis yaxis zaxis             background}
        3dbars        {title subtitle margin text legend leftaxis rightaxis bottomaxis background}
        radialchart   {title subtitle margin text legend leftaxis rightaxis bottomaxis background}
        txplot        {title subtitle margin text legend leftaxis rightaxis bottomaxis background mask}
        3dribbon      {title subtitle margin text legend xaxis yaxis zaxis leftaxis rightaxis bottomaxis background}
        boxplot       {title subtitle margin text legend leftaxis rightaxis bottomaxis background mask bar}
        windrose      {title subtitle margin text legend axis                          background}
        targetdiagram {title subtitle margin text legend leftaxis rightaxis bottomaxis background mask limits}
        performance   {title subtitle margin text legend leftaxis rightaxis bottomaxis background mask limits}
        table         {title subtitle margin background header oddrow evenrow cell frame leftaxis rightaxis bottomaxis}
        ternary       {title subtitle margin text legend axis leftaxis rightaxis bottomaxis background mask}
        distnormal    {title subtitle margin text legend leftaxis rightaxis bottomaxis background mask}
Changes to modules/plotchart/plotpriv.tcl.
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642


2643
2644
2645
2646
2647
2648
2649
   set xmin  [clock scan $time_begin]
   set xmax  [clock scan $time_end]
   set ybott [expr {$scaling($w,current)+$scaling($w,dy)}]

   foreach {x1 y1} [coordsToPixel $w $xmin $scaling($w,current)] {break}
   foreach {x2 y2} [coordsToPixel $w $xmax $ybott              ] {break}

   $w create rectangle $x1 $y1 $x2 $y2 -fill $colour \
       -tags [list $w vertscroll horizscroll below item_[expr {int($scaling($w,current))}]]

   ReorderChartItems $w

   set scaling($w,current) [expr {$scaling($w,current)-1.0}]

   RescaleChart $w


}

# DrawAdditionalPeriod --
#    Draw an additional period on the same level (no text)
# Arguments:
#    w           Name of the canvas
#    time_begin  Start time







|
|






>
>







2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
   set xmin  [clock scan $time_begin]
   set xmax  [clock scan $time_end]
   set ybott [expr {$scaling($w,current)+$scaling($w,dy)}]

   foreach {x1 y1} [coordsToPixel $w $xmin $scaling($w,current)] {break}
   foreach {x2 y2} [coordsToPixel $w $xmax $ybott              ] {break}

   set items [$w create rectangle $x1 $y1 $x2 $y2 -fill $colour \
                  -tags [list $w vertscroll horizscroll below item_[expr {int($scaling($w,current))}]]]

   ReorderChartItems $w

   set scaling($w,current) [expr {$scaling($w,current)-1.0}]

   RescaleChart $w

   return $items
}

# DrawAdditionalPeriod --
#    Draw an additional period on the same level (no text)
# Arguments:
#    w           Name of the canvas
#    time_begin  Start time
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680


2681
2682
2683
2684
2685
2686
2687
   set xmin  [clock scan $time_begin]
   set xmax  [clock scan $time_end]
   set ybott [expr {$scaling($w,current)+$scaling($w,dy)}]

   foreach {x1 y1} [coordsToPixel $w $xmin $scaling($w,current)] {break}
   foreach {x2 y2} [coordsToPixel $w $xmax $ybott              ] {break}

   $w create rectangle $x1 $y1 $x2 $y2 -fill $colour \
       -tags [list $w vertscroll horizscroll below item_[expr {int($scaling($w,current))}]]

   ReorderChartItems $w

   set scaling($w,current) [expr {$scaling($w,current)-1.0}]

   RescaleChart $w


}

# DrawTimeVertLine --
#    Draw a vertical line with a label
# Arguments:
#    w           Name of the canvas
#    text        Text to identify the line







|
|






>
>







2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
   set xmin  [clock scan $time_begin]
   set xmax  [clock scan $time_end]
   set ybott [expr {$scaling($w,current)+$scaling($w,dy)}]

   foreach {x1 y1} [coordsToPixel $w $xmin $scaling($w,current)] {break}
   foreach {x2 y2} [coordsToPixel $w $xmax $ybott              ] {break}

   set items [$w create rectangle $x1 $y1 $x2 $y2 -fill $colour \
                  -tags [list $w vertscroll horizscroll below item_[expr {int($scaling($w,current))}]]]

   ReorderChartItems $w

   set scaling($w,current) [expr {$scaling($w,current)-1.0}]

   RescaleChart $w

   return $items
}

# DrawTimeVertLine --
#    Draw a vertical line with a label
# Arguments:
#    w           Name of the canvas
#    text        Text to identify the line
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717


2718
2719
2720
2721
2722
2723
2724
   #
   set xtime [clock scan $time]
   #set ytext [expr {$scaling($w,ymax)-0.5*$scaling($w,dy)}]
   set ytext $scaling($w,ymax)
   foreach {x y} [coordsToPixel $w $xtime $ytext] {break}
   set y [expr {$y-5}]

   $w create text $x $y -text $text -anchor sw -tags [list $w horizscroll timeline]

   #
   # Draw the line
   #
   foreach {x1 y1} [coordsToPixel $w $xtime $scaling($w,ymin)] {break}
   foreach {x2 y2} [coordsToPixel $w $xtime $scaling($w,ymax)] {break}

   $w create line $x1 $y1 $x2 $y2 -fill $colour -tags [list $w horizscroll timeline tline]

   $w raise topmask


}

# DrawTimeMilestone --
#    Draw a "milestone"
# Arguments:
#    w           Name of the canvas
#    text        Text to identify the line







|







|


>
>







2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
   #
   set xtime [clock scan $time]
   #set ytext [expr {$scaling($w,ymax)-0.5*$scaling($w,dy)}]
   set ytext $scaling($w,ymax)
   foreach {x y} [coordsToPixel $w $xtime $ytext] {break}
   set y [expr {$y-5}]

   lappend items [$w create text $x $y -text $text -anchor sw -tags [list $w horizscroll timeline]]

   #
   # Draw the line
   #
   foreach {x1 y1} [coordsToPixel $w $xtime $scaling($w,ymin)] {break}
   foreach {x2 y2} [coordsToPixel $w $xtime $scaling($w,ymax)] {break}

   lappend items [$w create line $x1 $y1 $x2 $y2 -fill $colour -tags [list $w horizscroll timeline tline]]

   $w raise topmask

   return $items
}

# DrawTimeMilestone --
#    Draw a "milestone"
# Arguments:
#    w           Name of the canvas
#    text        Text to identify the line
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766


2767
2768
2769
2770
2771
2772
2773

   #
   # Draw the text first
   #
   set ytext [expr {$scaling($w,current)+0.5*$scaling($w,dy)}]
   foreach {x y} [coordsToPixel $w $scaling($w,xmin) $ytext] {break}

   $w create text 5 $y -text $text -anchor w \
       -tags [list vertscroll above item_[expr {int($scaling($w,current))}]]

   #
   # Draw an upside-down triangle to indicate the time
   #
   set xcentre [clock scan $time]
   set ytop    $scaling($w,current)
   set ybott   [expr {$scaling($w,current)+0.8*$scaling($w,dy)}]

   foreach {x1 y1} [coordsToPixel $w $xcentre $ybott] {break}
   foreach {x2 y2} [coordsToPixel $w $xcentre $ytop]  {break}

   set x2 [expr {$x1-0.4*($y1-$y2)}]
   set x3 [expr {$x1+0.4*($y1-$y2)}]
   set y3 $y2

   $w create polygon $x1 $y1 $x2 $y2 $x3 $y3 -fill $colour \
       -tags [list $w vertscroll horizscroll below item_[expr {int($scaling($w,current))}]]

   ReorderChartItems $w

   set scaling($w,current) [expr {$scaling($w,current)-1.0}]

   RescaleChart $w


}

# DrawAdditionalMilestone --
#    Draw an additional "milestone"
# Arguments:
#    w           Name of the canvas
#    time        Time for which the milestone is drawn







|
|















|
|






>
>







2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781

   #
   # Draw the text first
   #
   set ytext [expr {$scaling($w,current)+0.5*$scaling($w,dy)}]
   foreach {x y} [coordsToPixel $w $scaling($w,xmin) $ytext] {break}

   lappend items [$w create text 5 $y -text $text -anchor w \
                      -tags [list vertscroll above item_[expr {int($scaling($w,current))}]]]

   #
   # Draw an upside-down triangle to indicate the time
   #
   set xcentre [clock scan $time]
   set ytop    $scaling($w,current)
   set ybott   [expr {$scaling($w,current)+0.8*$scaling($w,dy)}]

   foreach {x1 y1} [coordsToPixel $w $xcentre $ybott] {break}
   foreach {x2 y2} [coordsToPixel $w $xcentre $ytop]  {break}

   set x2 [expr {$x1-0.4*($y1-$y2)}]
   set x3 [expr {$x1+0.4*($y1-$y2)}]
   set y3 $y2

   lappend items [$w create polygon $x1 $y1 $x2 $y2 $x3 $y3 -fill $colour \
                      -tags [list $w vertscroll horizscroll below item_[expr {int($scaling($w,current))}]]]

   ReorderChartItems $w

   set scaling($w,current) [expr {$scaling($w,current)-1.0}]

   RescaleChart $w

   return $items
}

# DrawAdditionalMilestone --
#    Draw an additional "milestone"
# Arguments:
#    w           Name of the canvas
#    time        Time for which the milestone is drawn
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807


2808
2809
2810
2811
2812
2813
2814
   foreach {x1 y1} [coordsToPixel $w $xcentre $ybott] {break}
   foreach {x2 y2} [coordsToPixel $w $xcentre $ytop]  {break}

   set x2 [expr {$x1-0.4*($y1-$y2)}]
   set x3 [expr {$x1+0.4*($y1-$y2)}]
   set y3 $y2

   $w create polygon $x1 $y1 $x2 $y2 $x3 $y3 -fill $colour \
       -tags [list $w vertscroll horizscroll below item_[expr {int($scaling($w,current))}]]

   ReorderChartItems $w

   set scaling($w,current) [expr {$scaling($w,current)-1.0}]

   RescaleChart $w


}

# ScaleItems --
#    Scale all items by a given factor
# Arguments:
#    w           Name of the canvas
#    xcentre     X-coordinate of centre







|
|






>
>







2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
   foreach {x1 y1} [coordsToPixel $w $xcentre $ybott] {break}
   foreach {x2 y2} [coordsToPixel $w $xcentre $ytop]  {break}

   set x2 [expr {$x1-0.4*($y1-$y2)}]
   set x3 [expr {$x1+0.4*($y1-$y2)}]
   set y3 $y2

   set items [$w create polygon $x1 $y1 $x2 $y2 $x3 $y3 -fill $colour \
                  -tags [list $w vertscroll horizscroll below item_[expr {int($scaling($w,current))}]]]

   ReorderChartItems $w

   set scaling($w,current) [expr {$scaling($w,current)-1.0}]

   RescaleChart $w

   return $items
}

# ScaleItems --
#    Scale all items by a given factor
# Arguments:
#    w           Name of the canvas
#    xcentre     X-coordinate of centre