1# plotdemos13.tcl --
2#     Check the performance of xy-plots with large amounts of data
3#
4package require Plotchart
5
6
7#
8# Create the XY plot and fill it with several series of data
9#
10pack [canvas .c -bg white]
11
12set p [::Plotchart::createXYPlot .c {0 100 10} {0 100 10}]
13
14update idletasks
15
16set time0 [clock milliseconds]
17for { set i 0} {$i < 1000 } {incr i} {
18    set x [expr {100*rand()}]
19    set y [expr {100*rand()}]
20
21    $p plot series1 $x $y
22}
23
24set time1 [clock milliseconds]
25
26$p dataconfig series2 -type both -symbol cross -colour red
27for { set i 0} {$i < 1000 } {incr i} {
28    set x [expr {100*rand()}]
29    set y [expr {100*rand()}]
30
31    $p plot series2 $x $y
32}
33
34set time2 [clock milliseconds]
35
36update idletasks
37
38set time3 [clock milliseconds]
39
40$p dataconfig series3 -type both -symbol cross -colour blue
41for { set i 0} {$i < 10000 } {incr i} {
42    set x [expr {100*rand()}]
43    set y [expr {100*rand()}]
44
45    $p plot series3 $x $y
46}
47
48set time4 [clock milliseconds]
49
50catch {
51    console show
52}
53
54puts "Plotting a line with 1000 points: [expr {$time1-$time0}] ms"
55puts "Plotting a line with 1000 symbols (crosses): [expr {$time2-$time1}] ms"
56puts "Time to display: [expr {$time3-$time2}] ms"
57puts "Plotting a line with 10000 symbols (crosses): [expr {$time4-$time3}] ms"
58