File: plotdemos13.tcl

package info (click to toggle)
tklib 0.6%2B20190108-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 15,008 kB
  • sloc: tcl: 75,757; sh: 5,789; ansic: 792; pascal: 359; makefile: 70; sed: 53; exp: 21
file content (62 lines) | stat: -rwxr-xr-x 1,332 bytes parent folder | download | duplicates (3)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env tclsh
## -*- tcl -*-

package require Tk

# plotdemos13.tcl --
#     Check the performance of xy-plots with large amounts of data
#
package require Plotchart


#
# Create the XY plot and fill it with several series of data
#
pack [canvas .c -bg white]

set p [::Plotchart::createXYPlot .c {0 100 10} {0 100 10}]

update idletasks

set time0 [clock milliseconds]
for { set i 0} {$i < 1000 } {incr i} {
    set x [expr {100*rand()}]
    set y [expr {100*rand()}]

    $p plot series1 $x $y
}

set time1 [clock milliseconds]

$p dataconfig series2 -type both -symbol cross -colour red
for { set i 0} {$i < 1000 } {incr i} {
    set x [expr {100*rand()}]
    set y [expr {100*rand()}]

    $p plot series2 $x $y
}

set time2 [clock milliseconds]

update idletasks

set time3 [clock milliseconds]

$p dataconfig series3 -type both -symbol cross -colour blue
for { set i 0} {$i < 10000 } {incr i} {
    set x [expr {100*rand()}]
    set y [expr {100*rand()}]

    $p plot series3 $x $y
}

set time4 [clock milliseconds]

catch {
    console show
}

puts "Plotting a line with 1000 points: [expr {$time1-$time0}] ms"
puts "Plotting a line with 1000 symbols (crosses): [expr {$time2-$time1}] ms"
puts "Time to display: [expr {$time3-$time2}] ms"
puts "Plotting a line with 10000 symbols (crosses): [expr {$time4-$time3}] ms"