Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Merged latest plotchart work into the pending release. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | tklib-0-6-rc |
Files: | files | file ages | folders |
SHA1: | c2b933f8dd8396cc8cd1cab07728d250aa1d91d9 |
User & Date: | andreask 2013-03-11 20:08:15 |
Context
2013-03-11
| ||
20:15 | Merged trunk changes (embedded docs) to pending release. check-in: 94958bdd4c user: andreask tags: tklib-0-6-rc | |
20:08 | Merged latest plotchart work into the pending release. check-in: c2b933f8dd user: andreask tags: tklib-0-6-rc | |
20:05 | Merged latest crosshair work to the pending release. check-in: 22070c5233 user: andreask tags: tklib-0-6-rc | |
2013-03-10
| ||
16:08 | Correct the use of options for the vertical subtext. Add missing procedures from previous checkin. check-in: bb8dd0fd80 user: markus tags: subtitles-and-corrected-tests | |
Changes
Changes to modules/plotchart/ChangeLog.
1 2 3 4 5 6 7 |
2013-01-27 Arjen Markus <arjenmarkus@users,sourceforge.net> * plotchart.tcl: Set version to 2.0.2 * pkgIndex.tcl: Set version to 2.0.2 * plotchart.man: Refine description of the first argument for createRightAxis * plotaxis.tcl: Refine raising commands because of legend and right axis 2012-12-30 Arjen Markus <arjenmarkus@users,sourceforge.net> |
> > > > > > > > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
2013-03-10 Arjen Markus <arjenmarkus@users,sourceforge.net> * plotchart.tcl: Basic support for subtexts with axes, accurate factor "torad", pixelToCoords extended * plotchart.test: Extended tests for coordinate transformations * plotaxis.tcl: Support for subtexts * plotconfig.tcl: Support for subtexts * plotspecial.tcl: Removed debug output * pkgIndex.tcl: Bumped version to 2.1 2013-01-27 Arjen Markus <arjenmarkus@users,sourceforge.net> * plotchart.tcl: Set version to 2.0.2 * pkgIndex.tcl: Set version to 2.0.2 * plotchart.man: Refine description of the first argument for createRightAxis * plotaxis.tcl: Refine raising commands because of legend and right axis 2012-12-30 Arjen Markus <arjenmarkus@users,sourceforge.net> |
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.0.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]]
|
| |
1 2 3 4 5 6 7 |
if {![package vsatisfies [package provide Tcl] 8.5]} {
# PRAGMA: returnok
return
}
package ifneeded Plotchart 2.1.0 [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/plotaxis.tcl.
680 681 682 683 684 685 686 687 688 689 690 691 692 693 ... 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 ... 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 |
if {$config($w,bottomaxis,render) eq "simple"} { $w create text $xt $yt -text [lindex $args 0] -fill $textcolor -anchor n -font $textfont -tags [list xtext $w] } elseif {$config($w,bottomaxis,render) eq "text"} { RenderText $w $xt $yt -text $args -anchor n -font $textfont -tags [list xtext $w] \ -fill $textcolor } } # DrawYtext -- # Draw text to the y-axis # Arguments: # w Name of the canvas # text Text to be drawn # Result: ................................................................................ if { [string match "r*" $w] == 0 } { set textcolor $config($w,leftaxis,textcolor) set textfont $config($w,leftaxis,font) set xt $scaling($w,pxmin) set anchor se } else { set textcolor $config($w,rightaxis,textcolor) set textfont $config($w,rightaxis,font) set xt $scaling($w,pxmax) set anchor sw } set yt [expr {$scaling($w,pymin)-$config($w,font,char_height)/2}] $w delete "ytext && $w" $w create text $xt $yt -text $text -fill $textcolor -anchor $anchor -font $textfont -tags [list ytext $w] } # DrawVtext -- # Draw vertical text to the y-axis # Arguments: # w Name of the canvas # text Text to be drawn # Result: ................................................................................ # This requires Tk 8.6 or later # proc ::Plotchart::DrawVtext { w text } { variable scaling variable config if { [package vsatisfies [package present Tk] 8.6] } { set yt [expr {($scaling($w,pymin) + $scaling($w,pymax)) / 2}] if { [string match "r*" $w] } { set anchor n set bbox [$w bbox raxis] set tag "rvtext" set axis "rightaxis" set xt [expr {[lindex $bbox 2] + $config($w,rightaxis,vtextoffset)}] } else { set anchor s set bbox [$w bbox yaxis] set tag "vtext" set axis "leftaxis" set xt [expr {[lindex $bbox 0] - $config($w,leftaxis,vtextoffset)}] } $w delete "$tag && $w" $w create text $xt $yt -text $text -fill black -anchor $anchor -angle 90 -tags [list $tag $w] \ -font $config($w,$axis,font) -fill $config($w,$axis,textcolor) } } # DrawPolarAxes -- # Draw thw two polar axes # Arguments: # w Name of the canvas # rad_max Maximum radius # rad_step Step in radius |
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > |
680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 ... 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 ... 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 |
if {$config($w,bottomaxis,render) eq "simple"} { $w create text $xt $yt -text [lindex $args 0] -fill $textcolor -anchor n -font $textfont -tags [list xtext $w] } elseif {$config($w,bottomaxis,render) eq "text"} { RenderText $w $xt $yt -text $args -anchor n -font $textfont -tags [list xtext $w] \ -fill $textcolor } } # DrawXsubtext -- # Draw subtext to the x-axis # Arguments: # w Name of the canvas # args Text to be drawn (more than one argument if rendering in on) # Result: # None # Side effects: # Text drawn in canvas # proc ::Plotchart::DrawXsubtext { w args } { variable scaling variable config set textcolor $config($w,bottomaxis,subtextcolor) set textfont $config($w,bottomaxis,subtextfont) set char_height [font metrics $textfont -linespace] set xt [expr {($scaling($w,pxmin)+$scaling($w,pxmax))/2}] set yt [expr {$scaling($w,pymax)+2*$char_height+4}] $w delete "xsubtext && $w" if {$config($w,bottomaxis,render) eq "simple"} { $w create text $xt $yt -text [lindex $args 0] -fill $textcolor -anchor n -font $textfont -tags [list xsubtext $w] } elseif {$config($w,bottomaxis,render) eq "text"} { RenderText $w $xt $yt -text $args -anchor n -font $textfont -tags [list xsubtext $w] \ -fill $textcolor } } # DrawYtext -- # Draw text to the y-axis # Arguments: # w Name of the canvas # text Text to be drawn # Result: ................................................................................ if { [string match "r*" $w] == 0 } { set textcolor $config($w,leftaxis,textcolor) set textfont $config($w,leftaxis,font) set xt $scaling($w,pxmin) set anchor se set usesubtext $config($w,leftaxis,usesubtext) } else { set textcolor $config($w,rightaxis,textcolor) set textfont $config($w,rightaxis,font) set xt $scaling($w,pxmax) set anchor sw set usesubtext $config($w,rightaxis,usesubtext) } if { $usesubtext } { set char_height [font metrics $textfont -linespace] set yt [expr {$scaling($w,pymin)-$config($w,font,char_height)/2 - $char_height}] } else { set yt [expr {$scaling($w,pymin)-$config($w,font,char_height)/2}] } $w delete "ytext && $w" $w create text $xt $yt -text $text -fill $textcolor -anchor $anchor -font $textfont -tags [list ytext $w] } # DrawYsubtext -- # Draw subtext to the y-axis # Arguments: # w Name of the canvas # text Text to be drawn # Result: # None # Side effects: # Text drawn in canvas # proc ::Plotchart::DrawYsubtext { w text } { variable scaling variable config if { [string match "r*" $w] == 0 } { set textcolor $config($w,leftaxis,subtextcolor) set textfont $config($w,leftaxis,subtextfont) set xt $scaling($w,pxmin) set anchor se } else { set textcolor $config($w,rightaxis,subtextcolor) set textfont $config($w,rightaxis,subtextfont) set xt $scaling($w,pxmax) set anchor sw } set char_height [font metrics $textfont -linespace] set yt [expr {$scaling($w,pymin)-$char_height/2+4}] $w delete "ysubtext && $w" $w create text $xt $yt -text $text -fill $textcolor -anchor $anchor -font $textfont -tags [list ysubtext $w] } # DrawVtext -- # Draw vertical text to the y-axis # Arguments: # w Name of the canvas # text Text to be drawn # Result: ................................................................................ # This requires Tk 8.6 or later # proc ::Plotchart::DrawVtext { w text } { variable scaling variable config if { [package vsatisfies [package present Tk] 8.6] } { set yt [expr {($scaling($w,pymin) + $scaling($w,pymax)) / 2}] if { [string match "r*" $w] } { set anchor n set bbox [$w bbox "raxis && $w"] set tag "rvtext" set axis "rightaxis" set xt [expr {[lindex $bbox 2] + $config($w,rightaxis,vtextoffset)}] } else { set anchor s set bbox [$w bbox "yaxis && $w"] set tag "vtext" set axis "leftaxis" set xt [expr {[lindex $bbox 0] - $config($w,leftaxis,vtextoffset)}] } if { $config($w,$axis,usevsubtext) } { set char_height [font metrics $config($w,$axis,font) -linespace] set xt [expr {$xt - $char_height - 4}] } $w delete "$tag && $w" $w create text $xt $yt -text $text -fill black -anchor $anchor -angle 90 -tags [list $tag $w] \ -font $config($w,$axis,font) -fill $config($w,$axis,textcolor) } } # DrawVsubtext -- # Draw vertical subtext to the y-axis # Arguments: # w Name of the canvas # text Text to be drawn # Result: # None # Side effects: # Text drawn in canvas # Note: # This requires Tk 8.6 or later # proc ::Plotchart::DrawVsubtext { w text } { variable scaling variable config if { [package vsatisfies [package present Tk] 8.6] } { set yt [expr {($scaling($w,pymin) + $scaling($w,pymax)) / 2}] if { [string match "r*" $w] } { set anchor n set bbox [$w bbox "raxis && $w"] set tag "rvsubtext" set axis "rightaxis" set xt [expr {[lindex $bbox 2] + $config($w,rightaxis,vtextoffset)}] } else { set anchor s set bbox [$w bbox "yaxis && $w"] set tag "vsubtext" set axis "leftaxis" set xt [expr {[lindex $bbox 0] - $config($w,leftaxis,vtextoffset)}] } $w delete "$tag && $w" $w create text $xt $yt -text $text -fill black -anchor $anchor -angle 90 -tags [list $tag $w] \ -font $config($w,$axis,vsubtextfont) -fill $config($w,$axis,vsubtextcolor) } } # DrawPolarAxes -- # Draw thw two polar axes # Arguments: # w Name of the canvas # rad_max Maximum radius # rad_step Step in radius |
Changes to modules/plotchart/plotchart.man.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
...
833
834
835
836
837
838
839
840
841
842
843
844
845
846
|
[comment {-*- tcl -*- doctools manpage}] [manpage_begin Plotchart n 2.0.2] [copyright {2011 Arjen Markus <arjenmarkus@users.sourceforge.net>}] [moddesc Plotchart] [titledesc {Simple plotting and charting package}] [require Tcl [opt 8.5]] [require Tk [opt 8.5]] [require Plotchart [opt 2.0.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 ................................................................................ [arg_def string text in] Text to drawn to the y-axis [list_end] [para] [call [cmd \$anyplot] xconfig [option -option] [arg value] ...] Set one or more configuration parameters for the x-axis. The following options are supported: |
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
...
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
|
[comment {-*- tcl -*- doctools manpage}] [manpage_begin Plotchart n 2.0.2] [copyright {2011 Arjen Markus <arjenmarkus@users.sourceforge.net>}] [moddesc Plotchart] [titledesc {Simple plotting and charting package}] [require Tcl [opt 8.5]] [require Tk [opt 8.5]] [require Plotchart [opt 2.1.0]] [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 ................................................................................ [arg_def string text in] Text to drawn to the y-axis [list_end] [para] [call [cmd \$anyplot] xsubtext [arg text]] Specify the subtext of the (horizontal) x-axis, for those plots that have a straight x-axis. This text is drawn below the primary text. [nl] Since this involves positioning the primary text and setting margins, you need to set the option "usesubtext" for the bottom axis via the plotstyle command. The relevant options are: usesubtext, subtextcolor and subtextfont. [list_begin arguments] [arg_def string text in] The secondary text of the x-axis label to be drawn. [list_end] [para] [call [cmd \$anyplot] ysubtext [arg text]] Specify the subtext of the (vertical) y-axis, for those plots that have a straight y-axis. This text is drawn below the primary text, for both axes on the left and the right. [nl] Since this involves positioning the primary text and setting margins, you need to set the option "usesubtext" for the left or right axis via the plotstyle command. The relevant options are: usesubtext, subtextcolor and subtextfont. [list_begin arguments] [arg_def string text in] The secondary text of the y-axis label to be drawn. [list_end] [para] [call [cmd \$anyplot] vsubtext [arg text]] Specify the subtext of the (vertical) y-axis, for those plots that have a straight y-axis. This text is drawn to the [emph right] of the primary text, for both axes on the left and the right. [nl] Since this involves positioning the primary text and setting margins, you need to set the option "usesubtext" for the left or right axis via the plotstyle command. The relevant options are: usevsubtext, vsubtextcolor and vsubtextfont. (Note the "v" to distinguish this option from the text at the top of a vertical axis that is drawn via [term "\$anyplot ytext"] or [term "\$anyplot ysubtext"].) [list_begin arguments] [arg_def string text in] The secondary (vertical) text of the y-axis label to be drawn. [list_end] [para] [call [cmd \$anyplot] xconfig [option -option] [arg value] ...] Set one or more configuration parameters for the x-axis. The following options are supported: |
Changes to modules/plotchart/plotchart.tcl.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 .. 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 ... 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 ... 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 ... 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 ... 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 ... 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 ... 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 ... 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 ... 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 ... 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 ... 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 ... 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 ... 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 ... 833 834 835 836 837 838 839 840 841 842 843 844 845 846 |
# # Array linking procedures with methods # set methodProc(xyplot,title) DrawTitle set methodProc(xyplot,subtitle) DrawSubtitle set methodProc(xyplot,xtext) DrawXtext set methodProc(xyplot,ytext) DrawYtext set methodProc(xyplot,vtext) DrawVtext set methodProc(xyplot,plot) DrawData set methodProc(xyplot,dot) DrawDot set methodProc(xyplot,dotconfig) DotConfigure set methodProc(xyplot,interval) DrawInterval set methodProc(xyplot,trend) DrawTrendLine set methodProc(xyplot,vector) DrawVector set methodProc(xyplot,vectorconfig) VectorConfigure ................................................................................ set methodProc(xyplot,plotlist) DrawDataList set methodProc(xyplot,plotarea) GetPlotArea set methodProc(xyplot,canvas) GetCanvas set methodProc(xyplot,deletedata) DeleteData set methodProc(xlogyplot,title) DrawTitle set methodProc(xlogyplot,subtitle) DrawSubtitle set methodProc(xlogyplot,xtext) DrawXtext set methodProc(xlogyplot,ytext) DrawYtext set methodProc(xlogyplot,vtext) DrawVtext set methodProc(xlogyplot,plot) DrawData set methodProc(xlogyplot,dot) DrawDot set methodProc(xlogyplot,labeldot) DrawLabelDot set methodProc(xlogyplot,dotconfig) DotConfigure set methodProc(xlogyplot,interval) DrawLogInterval set methodProc(xlogyplot,trend) DrawLogTrendLine set methodProc(xlogyplot,saveplot) SavePlot ................................................................................ set methodProc(xlogyplot,plaintext) DrawPlainText set methodProc(xlogyplot,plaintextconfig) ConfigPlainText set methodProc(xlogyplot,canvas) GetCanvas set methodProc(xlogyplot,deletedata) DeleteData set methodProc(logxyplot,title) DrawTitle set methodProc(logxyplot,subtitle) DrawSubtitle set methodProc(logxyplot,xtext) DrawXtext set methodProc(logxyplot,ytext) DrawYtext set methodProc(logxyplot,vtext) DrawVtext set methodProc(logxyplot,plot) DrawData set methodProc(logxyplot,dot) DrawDot set methodProc(logxyplot,labeldot) DrawLabelDot set methodProc(logxyplot,dotconfig) DotConfigure set methodProc(logxyplot,interval) DrawLogInterval set methodProc(logxyplot,trend) DrawLogTrendLine set methodProc(logxyplot,saveplot) SavePlot ................................................................................ set methodProc(logxyplot,plaintext) DrawPlainText set methodProc(logxyplot,plaintextconfig) ConfigPlainText set methodProc(logxyplot,canvas) GetCanvas set methodProc(logxyplot,deletedata) DeleteData set methodProc(logxlogyplot,title) DrawTitle set methodProc(logxlogyplot,subtitle) DrawSubtitle set methodProc(logxlogyplot,xtext) DrawXtext set methodProc(logxlogyplot,ytext) DrawYtext set methodProc(logxlogyplot,vtext) DrawVtext set methodProc(logxlogyplot,plot) DrawData set methodProc(logxlogyplot,dot) DrawDot set methodProc(logxlogyplot,labeldot) DrawLabelDot set methodProc(logxlogyplot,dotconfig) DotConfigure set methodProc(logxlogyplot,interval) DrawLogInterval set methodProc(logxlogyplot,trend) DrawLogTrendLine set methodProc(logxlogyplot,saveplot) SavePlot ................................................................................ set methodProc(polarplot,plaintextconfig) ConfigPlainText set methodProc(polarplot,labeldot) DrawLabelDot set methodProc(polarplot,canvas) GetCanvas set methodProc(polarplot,deletedata) DeleteData set methodProc(histogram,title) DrawTitle set methodProc(histogram,subtitle) DrawSubtitle set methodProc(histogram,xtext) DrawXtext set methodProc(histogram,ytext) DrawYtext set methodProc(histogram,vtext) DrawVtext set methodProc(histogram,plot) DrawHistogramData set methodProc(histogram,plotcumulative) DrawHistogramCumulative set methodProc(histogram,saveplot) SavePlot set methodProc(histogram,dataconfig) DataConfig set methodProc(histogram,xconfig) XConfig set methodProc(histogram,yconfig) YConfig set methodProc(histogram,yticklines) DrawYTicklines ................................................................................ set methodProc(histogram,plaintextconfig) ConfigPlainText set methodProc(histogram,canvas) GetCanvas set methodProc(histogram,bindlast) BindLastHistogram set methodProc(histogram,deletedata) DeleteData set methodProc(horizbars,title) DrawTitle set methodProc(horizbars,subtitle) DrawSubtitle set methodProc(horizbars,xtext) DrawXtext set methodProc(horizbars,ytext) DrawYtext set methodProc(horizbars,vtext) DrawVtext set methodProc(horizbars,plot) DrawHorizBarData set methodProc(horizbars,xticklines) DrawXTicklines set methodProc(horizbars,background) BackgroundColour set methodProc(horizbars,saveplot) SavePlot set methodProc(horizbars,colours) SetColours set methodProc(horizbars,colors) SetColours set methodProc(horizbars,xconfig) XConfig ................................................................................ set methodProc(horizbars,drawobject) DrawObject set methodProc(horizbars,object) DrawObject set methodProc(horizbars,canvas) GetCanvas set methodProc(horizbars,deletedata) DeleteData set methodProc(vertbars,title) DrawTitle set methodProc(vertbars,subtitle) DrawSubtitle set methodProc(vertbars,xtext) DrawXtext set methodProc(vertbars,ytext) DrawYtext set methodProc(vertbars,vtext) DrawVtext set methodProc(vertbars,plot) DrawVertBarData set methodProc(vertbars,background) BackgroundColour set methodProc(vertbars,yticklines) DrawYTicklines set methodProc(vertbars,saveplot) SavePlot set methodProc(vertbars,colours) SetColours set methodProc(vertbars,colors) SetColours set methodProc(vertbars,yconfig) YConfig ................................................................................ set methodProc(ganttchart,plaintextconfig) ConfigPlainText set methodProc(ganttchart,hscroll) ConnectHorizScrollbar set methodProc(ganttchart,vscroll) ConnectVertScrollbar set methodProc(ganttchart,canvas) GetCanvas set methodProc(stripchart,title) DrawTitle set methodProc(stripchart,subtitle) DrawSubtitle set methodProc(stripchart,xtext) DrawXtext set methodProc(stripchart,ytext) DrawYtext set methodProc(stripchart,vtext) DrawVtext set methodProc(stripchart,plot) DrawStripData set methodProc(stripchart,saveplot) SavePlot set methodProc(stripchart,dataconfig) DataConfig set methodProc(stripchart,xconfig) XConfig set methodProc(stripchart,yconfig) YConfig set methodProc(stripchart,yticklines) DrawYTicklines set methodProc(stripchart,background) BackgroundColour ................................................................................ set methodProc(stripchart,drawobject) DrawObject set methodProc(stripchart,object) DrawObject set methodProc(stripchart,canvas) GetCanvas set methodProc(stripchart,deletedata) DeleteData set methodProc(isometric,title) DrawTitle set methodProc(isometric,subtitle) DrawSubtitle set methodProc(isometric,xtext) DrawXtext set methodProc(isometric,ytext) DrawYtext set methodProc(isometric,vtext) DrawVtext set methodProc(isometric,plot) DrawIsometricData set methodProc(isometric,saveplot) SavePlot set methodProc(isometric,background) BackgroundColour set methodProc(isometric,balloon) DrawBalloon set methodProc(isometric,balloonconfig) ConfigBalloon set methodProc(isometric,plaintext) DrawPlainText set methodProc(isometric,plaintextconfig) ConfigPlainText ................................................................................ set methodProc(radialchart,plaintext) DrawPlainText set methodProc(radialchart,plaintextconfig) ConfigPlainText set methodProc(radialchart,canvas) GetCanvas set methodProc(radialchart,deletedata) DeleteData set methodProc(txplot,title) DrawTitle set methodProc(txplot,subtitle) DrawSubtitle set methodProc(txplot,xtext) DrawXtext set methodProc(txplot,ytext) DrawYtext set methodProc(txplot,vtext) DrawVtext set methodProc(txplot,plot) DrawTimeData set methodProc(txplot,interval) DrawInterval set methodProc(txplot,saveplot) SavePlot set methodProc(txplot,dataconfig) DataConfig set methodProc(txplot,xconfig) TConfig set methodProc(txplot,yconfig) YConfig set methodProc(txplot,xticklines) DrawXTicklines ................................................................................ set methodProc(3dribbon,area) Draw3DArea set methodProc(3dribbon,background) BackgroundColour set methodProc(3dribbon,canvas) GetCanvas set methodProc(3dribbon,deletedata) DeleteData set methodProc(boxplot,title) DrawTitle set methodProc(boxplot,subtitle) DrawSubtitle set methodProc(boxplot,xtext) DrawXtext set methodProc(boxplot,ytext) DrawYtext set methodProc(boxplot,vtext) DrawVtext set methodProc(boxplot,plot) DrawBoxData set methodProc(boxplot,saveplot) SavePlot set methodProc(boxplot,dataconfig) DataConfig set methodProc(boxplot,xconfig) XConfig set methodProc(boxplot,yconfig) YConfig set methodProc(boxplot,xticklines) DrawXTicklines set methodProc(boxplot,yticklines) DrawYTicklines ................................................................................ set methodProc(windrose,saveplot) SavePlot set methodProc(windrose,title) DrawTitle set methodProc(windrose,subtitle) DrawSubtitle set methodProc(windrose,canvas) GetCanvas set methodProc(targetdiagram,title) DrawTitle set methodProc(targetdiagram,subtitle) DrawSubtitle set methodProc(targetdiagram,xtext) DrawXtext set methodProc(targetdiagram,ytext) DrawYtext set methodProc(targetdiagram,vtext) DrawVtext set methodProc(targetdiagram,plot) DrawTargetData set methodProc(targetdiagram,saveplot) SavePlot set methodProc(targetdiagram,background) BackgroundColour set methodProc(targetdiagram,legendconfig) LegendConfigure set methodProc(targetdiagram,legend) DrawLegend set methodProc(targetdiagram,removefromlegend) RemoveFromLegend set methodProc(targetdiagram,balloon) DrawBalloon ................................................................................ set methodProc(3dribbonplot,zconfig) ZConfig set methodProc(3dribbonplot,background) BackgroundColour set methodProc(3dribbonplot,canvas) GetCanvas set methodProc(3dribbonplot,deletedata) DeleteData set methodProc(performance,title) DrawTitle set methodProc(performance,subtitle) DrawSubtitle set methodProc(performance,xtext) DrawXtext set methodProc(performance,ytext) DrawYtext set methodProc(performance,vtext) DrawVtext set methodProc(performance,plot) DrawPerformanceData set methodProc(performance,dot) DrawDot set methodProc(performance,saveplot) SavePlot set methodProc(performance,dataconfig) DataConfig set methodProc(performance,xconfig) XConfig set methodProc(performance,yconfig) YConfig set methodProc(performance,xticklines) DrawXTicklines ................................................................................ set methodProc(table,topixels) TableWorldToPixels set methodProc(table,canvas) GetCanvas # # Auxiliary parameters # variable torad set torad [expr {3.1415926/180.0}] variable options variable option_keys variable option_values set options {-colour -color -symbol -type -filled -fillcolour -fillcolor -boxwidth -width -radius \ -whisker -whiskerwidth -mediancolour -mediancolor -medianwidth -style} set option_keys {-colour -colour -symbol -type -filled -fillcolour -fillcolour -boxwidth -width -radius \ ................................................................................ set dy [expr {$scaling($w,ymax)-$scaling($w,ymin)}] set scaling($w,xfactor) [expr {$width/$dx}] set scaling($w,yfactor) [expr {$height/$dy}] } set xcrd [expr {$scaling($w,xmin)+($xpix-$scaling($w,pxmin))/$scaling($w,xfactor)}] set ycrd [expr {$scaling($w,ymax)-($ypix-$scaling($w,pymin))/$scaling($w,yfactor)}] return [list $xcrd $ycrd] } # pixelToIndex -- # Convert pixel coordinates to elements list index # Arguments: # w Name of the canvas |
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > |
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 .. 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 ... 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 ... 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 ... 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 ... 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 ... 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 ... 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 ... 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 ... 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 ... 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 ... 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 ... 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 ... 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 ... 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 |
# # Array linking procedures with methods # set methodProc(xyplot,title) DrawTitle set methodProc(xyplot,subtitle) DrawSubtitle set methodProc(xyplot,xtext) DrawXtext set methodProc(xyplot,xsubtext) DrawXsubtext set methodProc(xyplot,ytext) DrawYtext set methodProc(xyplot,ysubtext) DrawYsubtext set methodProc(xyplot,vtext) DrawVtext set methodProc(xyplot,vsubtext) DrawVsubtext set methodProc(xyplot,plot) DrawData set methodProc(xyplot,dot) DrawDot set methodProc(xyplot,dotconfig) DotConfigure set methodProc(xyplot,interval) DrawInterval set methodProc(xyplot,trend) DrawTrendLine set methodProc(xyplot,vector) DrawVector set methodProc(xyplot,vectorconfig) VectorConfigure ................................................................................ set methodProc(xyplot,plotlist) DrawDataList set methodProc(xyplot,plotarea) GetPlotArea set methodProc(xyplot,canvas) GetCanvas set methodProc(xyplot,deletedata) DeleteData set methodProc(xlogyplot,title) DrawTitle set methodProc(xlogyplot,subtitle) DrawSubtitle set methodProc(xlogyplot,xtext) DrawXtext set methodProc(xlogyplot,xsubtext) DrawXsubtext set methodProc(xlogyplot,ytext) DrawYtext set methodProc(xlogyplot,ysubtext) DrawYsubtext set methodProc(xlogyplot,vtext) DrawVtext set methodProc(xlogyplot,vsubtext) DrawVsubtext set methodProc(xlogyplot,plot) DrawData set methodProc(xlogyplot,dot) DrawDot set methodProc(xlogyplot,labeldot) DrawLabelDot set methodProc(xlogyplot,dotconfig) DotConfigure set methodProc(xlogyplot,interval) DrawLogInterval set methodProc(xlogyplot,trend) DrawLogTrendLine set methodProc(xlogyplot,saveplot) SavePlot ................................................................................ set methodProc(xlogyplot,plaintext) DrawPlainText set methodProc(xlogyplot,plaintextconfig) ConfigPlainText set methodProc(xlogyplot,canvas) GetCanvas set methodProc(xlogyplot,deletedata) DeleteData set methodProc(logxyplot,title) DrawTitle set methodProc(logxyplot,subtitle) DrawSubtitle set methodProc(logxyplot,xtext) DrawXtext set methodProc(logxyplot,xsubtext) DrawXsubtext set methodProc(logxyplot,ytext) DrawYtext set methodProc(logxyplot,ysubtext) DrawYsubtext set methodProc(logxyplot,vtext) DrawVtext set methodProc(logxyplot,vsubtext) DrawVsubtext set methodProc(logxyplot,plot) DrawData set methodProc(logxyplot,dot) DrawDot set methodProc(logxyplot,labeldot) DrawLabelDot set methodProc(logxyplot,dotconfig) DotConfigure set methodProc(logxyplot,interval) DrawLogInterval set methodProc(logxyplot,trend) DrawLogTrendLine set methodProc(logxyplot,saveplot) SavePlot ................................................................................ set methodProc(logxyplot,plaintext) DrawPlainText set methodProc(logxyplot,plaintextconfig) ConfigPlainText set methodProc(logxyplot,canvas) GetCanvas set methodProc(logxyplot,deletedata) DeleteData set methodProc(logxlogyplot,title) DrawTitle set methodProc(logxlogyplot,subtitle) DrawSubtitle set methodProc(logxlogyplot,xtext) DrawXtext set methodProc(logxlogyplot,xsubtext) DrawXsubtext set methodProc(logxlogyplot,ytext) DrawYtext set methodProc(logxlogyplot,ysubtext) DrawYsubtext set methodProc(logxlogyplot,vtext) DrawVtext set methodProc(logxlogyplot,vsubtext) DrawVsubtext set methodProc(logxlogyplot,plot) DrawData set methodProc(logxlogyplot,dot) DrawDot set methodProc(logxlogyplot,labeldot) DrawLabelDot set methodProc(logxlogyplot,dotconfig) DotConfigure set methodProc(logxlogyplot,interval) DrawLogInterval set methodProc(logxlogyplot,trend) DrawLogTrendLine set methodProc(logxlogyplot,saveplot) SavePlot ................................................................................ set methodProc(polarplot,plaintextconfig) ConfigPlainText set methodProc(polarplot,labeldot) DrawLabelDot set methodProc(polarplot,canvas) GetCanvas set methodProc(polarplot,deletedata) DeleteData set methodProc(histogram,title) DrawTitle set methodProc(histogram,subtitle) DrawSubtitle set methodProc(histogram,xtext) DrawXtext set methodProc(histogram,xsubtext) DrawXsubtext set methodProc(histogram,ytext) DrawYtext set methodProc(histogram,ysubtext) DrawYsubtext set methodProc(histogram,vtext) DrawVtext set methodProc(histogram,vsubtext) DrawVsubtext set methodProc(histogram,plot) DrawHistogramData set methodProc(histogram,plotcumulative) DrawHistogramCumulative set methodProc(histogram,saveplot) SavePlot set methodProc(histogram,dataconfig) DataConfig set methodProc(histogram,xconfig) XConfig set methodProc(histogram,yconfig) YConfig set methodProc(histogram,yticklines) DrawYTicklines ................................................................................ set methodProc(histogram,plaintextconfig) ConfigPlainText set methodProc(histogram,canvas) GetCanvas set methodProc(histogram,bindlast) BindLastHistogram set methodProc(histogram,deletedata) DeleteData set methodProc(horizbars,title) DrawTitle set methodProc(horizbars,subtitle) DrawSubtitle set methodProc(horizbars,xtext) DrawXtext set methodProc(horizbars,xsubtext) DrawXsubtext set methodProc(horizbars,ytext) DrawYtext set methodProc(horizbars,ysubtext) DrawYsubtext set methodProc(horizbars,vtext) DrawVtext set methodProc(horizbars,vsubtext) DrawVsubtext set methodProc(horizbars,plot) DrawHorizBarData set methodProc(horizbars,xticklines) DrawXTicklines set methodProc(horizbars,background) BackgroundColour set methodProc(horizbars,saveplot) SavePlot set methodProc(horizbars,colours) SetColours set methodProc(horizbars,colors) SetColours set methodProc(horizbars,xconfig) XConfig ................................................................................ set methodProc(horizbars,drawobject) DrawObject set methodProc(horizbars,object) DrawObject set methodProc(horizbars,canvas) GetCanvas set methodProc(horizbars,deletedata) DeleteData set methodProc(vertbars,title) DrawTitle set methodProc(vertbars,subtitle) DrawSubtitle set methodProc(vertbars,xtext) DrawXtext set methodProc(vertbars,xsubtext) DrawXsubtext set methodProc(vertbars,ytext) DrawYtext set methodProc(vertbars,ysubtext) DrawYsubtext set methodProc(vertbars,vtext) DrawVtext set methodProc(vertbars,vsubtext) DrawVsubtext set methodProc(vertbars,plot) DrawVertBarData set methodProc(vertbars,background) BackgroundColour set methodProc(vertbars,yticklines) DrawYTicklines set methodProc(vertbars,saveplot) SavePlot set methodProc(vertbars,colours) SetColours set methodProc(vertbars,colors) SetColours set methodProc(vertbars,yconfig) YConfig ................................................................................ set methodProc(ganttchart,plaintextconfig) ConfigPlainText set methodProc(ganttchart,hscroll) ConnectHorizScrollbar set methodProc(ganttchart,vscroll) ConnectVertScrollbar set methodProc(ganttchart,canvas) GetCanvas set methodProc(stripchart,title) DrawTitle set methodProc(stripchart,subtitle) DrawSubtitle set methodProc(stripchart,xtext) DrawXtext set methodProc(stripchart,xsubtext) DrawXsubtext set methodProc(stripchart,ytext) DrawYtext set methodProc(stripchart,ysubtext) DrawYsubtext set methodProc(stripchart,vtext) DrawVtext set methodProc(stripchart,vsubtext) DrawVsubtext set methodProc(stripchart,plot) DrawStripData set methodProc(stripchart,saveplot) SavePlot set methodProc(stripchart,dataconfig) DataConfig set methodProc(stripchart,xconfig) XConfig set methodProc(stripchart,yconfig) YConfig set methodProc(stripchart,yticklines) DrawYTicklines set methodProc(stripchart,background) BackgroundColour ................................................................................ set methodProc(stripchart,drawobject) DrawObject set methodProc(stripchart,object) DrawObject set methodProc(stripchart,canvas) GetCanvas set methodProc(stripchart,deletedata) DeleteData set methodProc(isometric,title) DrawTitle set methodProc(isometric,subtitle) DrawSubtitle set methodProc(isometric,xtext) DrawXtext set methodProc(isometric,xsubtext) DrawXsubtext set methodProc(isometric,ytext) DrawYtext set methodProc(isometric,ysubtext) DrawYsubtext set methodProc(isometric,vtext) DrawVtext set methodProc(isometric,vsubtext) DrawVsubtext set methodProc(isometric,plot) DrawIsometricData set methodProc(isometric,saveplot) SavePlot set methodProc(isometric,background) BackgroundColour set methodProc(isometric,balloon) DrawBalloon set methodProc(isometric,balloonconfig) ConfigBalloon set methodProc(isometric,plaintext) DrawPlainText set methodProc(isometric,plaintextconfig) ConfigPlainText ................................................................................ set methodProc(radialchart,plaintext) DrawPlainText set methodProc(radialchart,plaintextconfig) ConfigPlainText set methodProc(radialchart,canvas) GetCanvas set methodProc(radialchart,deletedata) DeleteData set methodProc(txplot,title) DrawTitle set methodProc(txplot,subtitle) DrawSubtitle set methodProc(txplot,xtext) DrawXtext set methodProc(txplot,xsubtext) DrawXsubtext set methodProc(txplot,ytext) DrawYtext set methodProc(txplot,ysubtext) DrawYsubtext set methodProc(txplot,vtext) DrawVtext set methodProc(txplot,vsubtext) DrawVsubtext set methodProc(txplot,plot) DrawTimeData set methodProc(txplot,interval) DrawInterval set methodProc(txplot,saveplot) SavePlot set methodProc(txplot,dataconfig) DataConfig set methodProc(txplot,xconfig) TConfig set methodProc(txplot,yconfig) YConfig set methodProc(txplot,xticklines) DrawXTicklines ................................................................................ set methodProc(3dribbon,area) Draw3DArea set methodProc(3dribbon,background) BackgroundColour set methodProc(3dribbon,canvas) GetCanvas set methodProc(3dribbon,deletedata) DeleteData set methodProc(boxplot,title) DrawTitle set methodProc(boxplot,subtitle) DrawSubtitle set methodProc(boxplot,xtext) DrawXtext set methodProc(boxplot,xsubtext) DrawXsubtext set methodProc(boxplot,ytext) DrawYtext set methodProc(boxplot,ysubtext) DrawYsubtext set methodProc(boxplot,vtext) DrawVtext set methodProc(boxplot,vsubtext) DrawVsubtext set methodProc(boxplot,plot) DrawBoxData set methodProc(boxplot,saveplot) SavePlot set methodProc(boxplot,dataconfig) DataConfig set methodProc(boxplot,xconfig) XConfig set methodProc(boxplot,yconfig) YConfig set methodProc(boxplot,xticklines) DrawXTicklines set methodProc(boxplot,yticklines) DrawYTicklines ................................................................................ set methodProc(windrose,saveplot) SavePlot set methodProc(windrose,title) DrawTitle set methodProc(windrose,subtitle) DrawSubtitle set methodProc(windrose,canvas) GetCanvas set methodProc(targetdiagram,title) DrawTitle set methodProc(targetdiagram,subtitle) DrawSubtitle set methodProc(targetdiagram,xtext) DrawXtext set methodProc(targetdiagram,xsubtext) DrawXsubtext set methodProc(targetdiagram,ytext) DrawYtext set methodProc(targetdiagram,ysubtext) DrawYsubtext set methodProc(targetdiagram,vtext) DrawVtext set methodProc(targetdiagram,vsubtext) DrawVsubtext set methodProc(targetdiagram,plot) DrawTargetData set methodProc(targetdiagram,saveplot) SavePlot set methodProc(targetdiagram,background) BackgroundColour set methodProc(targetdiagram,legendconfig) LegendConfigure set methodProc(targetdiagram,legend) DrawLegend set methodProc(targetdiagram,removefromlegend) RemoveFromLegend set methodProc(targetdiagram,balloon) DrawBalloon ................................................................................ set methodProc(3dribbonplot,zconfig) ZConfig set methodProc(3dribbonplot,background) BackgroundColour set methodProc(3dribbonplot,canvas) GetCanvas set methodProc(3dribbonplot,deletedata) DeleteData set methodProc(performance,title) DrawTitle set methodProc(performance,subtitle) DrawSubtitle set methodProc(performance,xtext) DrawXtext set methodProc(performance,xsubtext) DrawXsubtext set methodProc(performance,ytext) DrawYtext set methodProc(performance,ysubtext) DrawYsubtext set methodProc(performance,vtext) DrawVtext set methodProc(performance,vsubtext) DrawVsubtext set methodProc(performance,plot) DrawPerformanceData set methodProc(performance,dot) DrawDot set methodProc(performance,saveplot) SavePlot set methodProc(performance,dataconfig) DataConfig set methodProc(performance,xconfig) XConfig set methodProc(performance,yconfig) YConfig set methodProc(performance,xticklines) DrawXTicklines ................................................................................ set methodProc(table,topixels) TableWorldToPixels set methodProc(table,canvas) GetCanvas # # Auxiliary parameters # variable torad set torad [expr {acos(-1.0)/180.0}] variable options variable option_keys variable option_values set options {-colour -color -symbol -type -filled -fillcolour -fillcolor -boxwidth -width -radius \ -whisker -whiskerwidth -mediancolour -mediancolor -medianwidth -style} set option_keys {-colour -colour -symbol -type -filled -fillcolour -fillcolour -boxwidth -width -radius \ ................................................................................ set dy [expr {$scaling($w,ymax)-$scaling($w,ymin)}] set scaling($w,xfactor) [expr {$width/$dx}] set scaling($w,yfactor) [expr {$height/$dy}] } set xcrd [expr {$scaling($w,xmin)+($xpix-$scaling($w,pxmin))/$scaling($w,xfactor)}] set ycrd [expr {$scaling($w,ymax)-($ypix-$scaling($w,pymin))/$scaling($w,yfactor)}] if { $scaling($w,coordSystem) != 0 } { switch -- $scaling($w,coordSystem) { 1 { # log X versus Y set xcrd [expr {10.0**$xcrd}] } 2 { # X versus log Y set ycrd [expr {10.0**$ycrd}] } 3 { # log X versus log Y set xcrd [expr {10.0**$xcrd}] set ycrd [expr {10.0**$ycrd}] } 4 { # radius versus angle set rad [expr {hypot($xcrd,$ycrd)}] set phi [expr {atan2($xycrd,$xcrd)/$torad}] set xcrd $rad set ycrd $phi } } } return [list $xcrd $ycrd] } # pixelToIndex -- # Convert pixel coordinates to elements list index # Arguments: # w Name of the canvas |
Changes to modules/plotchart/plotchart.test.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 .. 91 92 93 94 95 96 97 98 99 100 101 102 103 104 ... 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 ... 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 ... 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 ... 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 ... 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 ... 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 ... 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 ... 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 ... 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 ... 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 ... 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 ... 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 ... 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 ... 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 ... 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 ... 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 ... 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 |
# are exact. Test Plotchart-2.12, however, has a slight aberration # in Tcl 8.5: the result is "0.9999999940000001 1.000000006 2e-9" # Hence the small tolerance # proc matchNumbers {expected actual} { set match 1 foreach a $actual e $expected { if { abs($a - $e) > 0.5e-9*(abs($a)+abs($e)) } { set match 0 break } } return $match } proc checkCanvasItems {w tags} { set okay 1 ................................................................................ # To avoid round-off errors, all transforms use "round" values # # Note: # The coordinate system has to be set explicitly, as this is ordinarily # done by the creation procedure # test Plotchart-1.1 {World coordinates to pixel - basic 1} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 0 ::Plotchart::worldCoordinates "window" 0.0 0.0 100.0 1000.0 ::Plotchart::viewPort "window" 0 0 100 100 ::Plotchart::coordsToPixel "window" 0 0 } -result {0 100} ................................................................................ test Plotchart-1.4 {World coordinates to pixel - ordering} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 0 ::Plotchart::viewPort "window" 10 20 110 120 ::Plotchart::worldCoordinates "window" 0.0 0.0 100.0 1000.0 ::Plotchart::coordsToPixel "window" 100 100 } -result {110 110} test Plotchart-2.1 {Pixel to world coordinates - basic 1} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 1 ::Plotchart::viewPort "window" 10 20 110 120 ::Plotchart::worldCoordinates "window" 0.0 0.0 100.0 1000.0 ::Plotchart::pixelToCoords "window" 10 20 } -result {0 1000} test Plotchart-2.2 {Pixel to world coordinates - basic 2} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 1 ::Plotchart::viewPort "window" 10 20 110 120 ::Plotchart::worldCoordinates "window" 0.0 0.0 100.0 1000.0 ::Plotchart::pixelToCoords "window" 110 120 } -result {100 0} test Plotchart-2.3 {Pixel to world coordinates - ordering} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 1 ::Plotchart::worldCoordinates "window" 0.0 0.0 100.0 1000.0 ::Plotchart::viewPort "window" 10 20 110 120 ::Plotchart::pixelToCoords "window" 110 120 } -result {100 0} test Plotchart-2.4 {Nice scale 1} -match numbers -body { ::Plotchart::determineScale 0.1 1.0 } -result {0.0 1.0 0.2} test Plotchart-2.5 {Nice scale 2} -match numbers -body { ::Plotchart::determineScale 0.001 0.01 } -result {0.0 0.01 0.002} test Plotchart-2.6 {Nice scale 3} -match numbers -body { ::Plotchart::determineScale -0.2 0.9 } -result {-0.2 1.0 0.2} test Plotchart-2.7 {Nice scale 4} -match numbers -body { ::Plotchart::determineScale -0.25 0.85 } -result {-0.4 1.0 0.2} test Plotchart-2.8 {Nice scale 5} -match numbers -body { ::Plotchart::determineScale -0.25 0.7999 } -result {-0.4 0.8 0.2} test Plotchart-2.9 {Nice scale 6} -match numbers -body { ::Plotchart::determineScale 10001 10010 } -result {10000 10010 2} test Plotchart-2.10 {Nice scale 7} -match numbers -body { ::Plotchart::determineScale 10001 10015 } -result {10000 10015 5} test Plotchart-2.11 {Nice scale 8} -match numbers -body { ::Plotchart::determineScale -1.7 26.8 } -result {-10.0 30.0 10.0} test Plotchart-2.12 {Nice scale 9} -match numbers -body { ::Plotchart::determineScale 0.99999999999999911 1.0000000000000007 } -result {0.999999994 1.000000006 2e-009} test Plotchart-2.13 {Nice scale from list} -match numbers -body { ::Plotchart::determineScaleFromList {-0.25 -0.1 0.6 0.6 0.85} } -result {-0.4 1.0 0.2} test Plotchart-2.14 {Nice scale from list with missing data} -match numbers -body { ::Plotchart::determineScaleFromList {-0.25 -0.1 0.6 {} {} {} 0.6 0.85} } -result {-0.4 1.0 0.2} test Plotchart-3.1 {XY-plot} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createXYPlot .c {0.0 100.0 10.0} {0.0 100.0 20.0}] set xd 5.0 ................................................................................ set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 ;# {} test Plotchart-3.2 {Piechart} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createPiechart .c] $s plot {"Long names" 10 "Short names" 30 "Average" 40 "Ultra-short names" 5} $s title "Okay - this works" ................................................................................ #checkCanvasItems .c {data} destroy .c set result 1 } -result 1 test Plotchart-3.3 {Polar plot} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createPolarplot .c {3.0 1.0}] for { set angle 0 } { $angle < 360.0 } { set angle [expr {$angle+10.0}] } { ................................................................................ set waited 0 set res [checkCanvasItems .c {data}] destroy .c set res } -result 1 test Plotchart-3.4 {Barchart} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createBarchart .c {A B C D E} {0.0 10.0 2.0} 2] $s plot series1 {1.0 4.0 6.0 1.0 7.0} red ................................................................................ set waited 0 set res [checkCanvasItems .c {data yaxis}] destroy .c set res } -result 1 test Plotchart-3.5 {Barchart (stacked)} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createBarchart .c {A B C D E} {0.0 20.0 5.0} stacked] $s plot series1 {1.0 4.0 6.0 1.0 7.0} red ................................................................................ set waited 0 set res [checkCanvasItems .c {data yaxis}] destroy .c set res } -result 1 test Plotchart-3.6 {Horizontal barchart} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createHorizontalBarchart .c {0.0 10.0 2.0} {A B C D E} 2] $s plot series1 {1.0 4.0 6.0 1.0 7.0} red ................................................................................ set waited 0 set res [checkCanvasItems .c {data xaxis}] destroy .c set res } -result 1 test Plotchart-3.7 {Horizontal barchart (stacked)} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createHorizontalBarchart .c {0.0 20.0 5.0} {A B C D E} stacked] $s plot series1 {1.0 4.0 6.0 1.0 7.0} red ................................................................................ set waited 0 set res [checkCanvasItems .c {data xaxis}] destroy .c set res } -result 1 test Plotchart-3.8 {Timechart} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createTimechart .c "1 january 2004" \ "31 december 2004" 4] ................................................................................ #checkCanvasItems .c {data} destroy .c set result 1 } -result 1 test Plotchart-3.9 {Stripchart} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createStripchart .c {0.0 100.0 10.0} {0.0 100.0 20.0}] proc gendata {s xold xd yold yd} { ................................................................................ set waited 0 set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 test Plotchart-3.10 {Isometric plot} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createIsometricPlot .c {0.0 100.0} {0.0 200.0} noaxes] ::Plotchart::setZoomPan .c $s plot rectangle 10.0 10.0 50.0 50.0 green ................................................................................ set waited 0 #checkCanvasItems .c {data} destroy .c set result 1 } -result 1 test Plotchart-3.11 {Histogram} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createHistogram .c {0.0 100.0 10.0} {0.0 100.0 20.0}] $s dataconfig series1 -colour green ................................................................................ set waited 0 set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 ;# {} test Plotchart-4.1 {XY-plot - balloon} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createXYPlot .c {0.0 100.0 10.0} {0.0 100.0 20.0}] set xd 5.0 ................................................................................ set waited 0 set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 ;# {} test Plotchart-5.1 {Gantt chart} -constraints tk -body { canvas .c -width 600 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createGanttchart .c "1 january 2004" \ "31 december 2004" 4] ................................................................................ set waited 0 #set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 ;# {} test Plotchart-6.1 {3D Bars} -constraints tk -body { canvas .c -width 600 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::create3DBarchart .c {-200.0 900.0 100.0} 7] foreach {bar value} {red 765 green 234 blue 345 yellow 321 ................................................................................ #set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 ;# {} test Plotchart-7.1 {Radial chart} -constraints tk -body { canvas .c -width 600 -height 400 -bg white pack .c -fill both .c delete all set s [::Plotchart::createRadialchart .c {A B LongerName C} 10] $s plot {1 2 3 4} green 2 ................................................................................ #set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 ;# {} test Plotchart-7.2 {Filled radial chart} -constraints tk -body { canvas .c -width 600 -height 400 -bg white pack .c -fill both .c delete all set s [::Plotchart::createRadialchart .c {A B LongerName C} 10 filled] $s plot {1 2 3 4} green 2 ................................................................................ #set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 ;# {} test Plotchart-7.3 {Filled radial chart} -constraints tk -body { canvas .c -width 600 -height 400 -bg white pack .c -fill both .c delete all set s [::Plotchart::createRadialchart .c {A B LongerName C} 10 cumulative] $s plot {1 2 3 4} green 2 |
> | | | > > > > > > > > > | > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | > > | | | | | | | | | | | > > > > | | | | | | |
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 .. 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 ... 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 ... 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 ... 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 ... 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 ... 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 ... 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 ... 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 ... 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 ... 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 ... 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 ... 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 ... 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 ... 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 ... 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 ... 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 ... 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 ... 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 |
# are exact. Test Plotchart-2.12, however, has a slight aberration # in Tcl 8.5: the result is "0.9999999940000001 1.000000006 2e-9" # Hence the small tolerance # proc matchNumbers {expected actual} { set match 1 foreach a $actual e $expected { if { $e != 0.0 } { if { abs($a - $e) > 0.5e-9*(abs($a)+abs($e)) } { set match 0 break } } else { if { abs($a) > 0.5e-9 } { set match 0 break } } } return $match } proc checkCanvasItems {w tags} { set okay 1 ................................................................................ # To avoid round-off errors, all transforms use "round" values # # Note: # The coordinate system has to be set explicitly, as this is ordinarily # done by the creation procedure # # # World coordinates to pixels: Linear scales # test Plotchart-1.1 {World coordinates to pixel - basic 1} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 0 ::Plotchart::worldCoordinates "window" 0.0 0.0 100.0 1000.0 ::Plotchart::viewPort "window" 0 0 100 100 ::Plotchart::coordsToPixel "window" 0 0 } -result {0 100} ................................................................................ test Plotchart-1.4 {World coordinates to pixel - ordering} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 0 ::Plotchart::viewPort "window" 10 20 110 120 ::Plotchart::worldCoordinates "window" 0.0 0.0 100.0 1000.0 ::Plotchart::coordsToPixel "window" 100 100 } -result {110 110} # # World coordinates to pixels: Log scales # test Plotchart-1.5 {World coordinates to pixel - logX-Y} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 1 set xmin [expr {log10(1.0)}] set xmax [expr {log10(100.0)}] ::Plotchart::worldCoordinates "window" $xmin 0.0 $xmax 1000.0 ::Plotchart::viewPort "window" 0 0 100 100 set result [concat \ [::Plotchart::coordsToPixel "window" 1 0] \ [::Plotchart::coordsToPixel "window" 100 1000] \ [::Plotchart::coordsToPixel "window" 10 500] \ ] } -result {0 100 100 0 50 50} test Plotchart-1.6 {World coordinates to pixel - X-logY} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 2 set ymin [expr {log10(1.0)}] set ymax [expr {log10(1000.0)}] ::Plotchart::worldCoordinates "window" 0.0 $ymin 100.0 $ymax ::Plotchart::viewPort "window" 0 0 100 100 set result [concat \ [::Plotchart::coordsToPixel "window" 0 1] \ [::Plotchart::coordsToPixel "window" 100 1000] \ [::Plotchart::coordsToPixel "window" 50 [expr {sqrt(1000)}]] \ ] } -result {0 100 100 0 50 50} test Plotchart-1.7 {World coordinates to pixel - logX-logY} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 3 set xmin [expr {log10(1.0)}] set xmax [expr {log10(100.0)}] set ymin [expr {log10(1.0)}] set ymax [expr {log10(1000.0)}] ::Plotchart::worldCoordinates "window" $xmin $ymin $xmax $ymax ::Plotchart::viewPort "window" 0 0 100 100 set result [concat \ [::Plotchart::coordsToPixel "window" 1 1] \ [::Plotchart::coordsToPixel "window" 100 1000] \ [::Plotchart::coordsToPixel "window" 10 [expr {sqrt(1000)}]] \ ] } -result {0 100 100 0 50 50} test Plotchart-1.8 {World coordinates to pixel - radial coordinates} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 4 ::Plotchart::polarCoordinates "window" 10 ::Plotchart::viewPort "window" 0 0 100 100 set result [concat \ [::Plotchart::coordsToPixel "window" 0 0] \ [::Plotchart::coordsToPixel "window" 10 90] \ [::Plotchart::coordsToPixel "window" 5 180] \ ] } -result {50 50 50 0 25 50} # # Pixels to world coordinates: Linear scales # test Plotchart-2.1 {Pixel to world coordinates - basic 1} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 0 ::Plotchart::viewPort "window" 10 20 110 120 ::Plotchart::worldCoordinates "window" 0.0 0.0 100.0 1000.0 ::Plotchart::pixelToCoords "window" 10 20 } -result {0 1000} test Plotchart-2.2 {Pixel to world coordinates - basic 2} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 0 ::Plotchart::viewPort "window" 10 20 110 120 ::Plotchart::worldCoordinates "window" 0.0 0.0 100.0 1000.0 ::Plotchart::pixelToCoords "window" 110 120 } -result {100 0} test Plotchart-2.3 {Pixel to world coordinates - ordering} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 0 ::Plotchart::worldCoordinates "window" 0.0 0.0 100.0 1000.0 ::Plotchart::viewPort "window" 10 20 110 120 ::Plotchart::pixelToCoords "window" 110 120 } -result {100 0} # # Pixels to world coordinates: Log scales # test Plotchart-2.4 {Pixel to world coordinates - logX-Y} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 1 set xmin [expr {log10(1.0)}] set xmax [expr {log10(100.0)}] ::Plotchart::worldCoordinates "window" $xmin 0.0 $xmax 1000.0 ::Plotchart::viewPort "window" 0 0 100 100 set result [concat \ [::Plotchart::pixelToCoords "window" 0 100] \ [::Plotchart::pixelToCoords "window" 100 0] \ [::Plotchart::pixelToCoords "window" 50 50] \ ] } -result {1 0 100 1000 10 500} test Plotchart-2.5 {Pixel to world coordinates - X-logY} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 2 set ymin [expr {log10(1.0)}] set ymax [expr {log10(1000.0)}] ::Plotchart::worldCoordinates "window" 0.0 $ymin 100.0 $ymax ::Plotchart::viewPort "window" 0 0 100 100 set result [concat \ [::Plotchart::pixelToCoords "window" 0 100] \ [::Plotchart::pixelToCoords "window" 100 0] \ [::Plotchart::pixelToCoords "window" 50 50] \ ] } -result [list 0 1 100 1000 50 [expr {sqrt(1000)}]] test Plotchart-2.6 {Pixel to world coordinates - logX-logY} -match numbers -body { set ::Plotchart::scaling(window,coordSystem) 3 set xmin [expr {log10(1.0)}] set xmax [expr {log10(100.0)}] set ymin [expr {log10(1.0)}] set ymax [expr {log10(1000.0)}] ::Plotchart::worldCoordinates "window" $xmin $ymin $xmax $ymax ::Plotchart::viewPort "window" 0 0 100 100 set result [concat \ [::Plotchart::pixelToCoords "window" 0 100] \ [::Plotchart::pixelToCoords "window" 100 0] \ [::Plotchart::pixelToCoords "window" 50 50] \ ] } -result [list 1 1 100 1000 10 [expr {sqrt(1000)}]] # # Constructing nice scales # test Plotchart-3.1 {Nice scale 1} -match numbers -body { ::Plotchart::determineScale 0.1 1.0 } -result {0.0 1.0 0.2} test Plotchart-3.2 {Nice scale 2} -match numbers -body { ::Plotchart::determineScale 0.001 0.01 } -result {0.0 0.01 0.002} test Plotchart-3.3 {Nice scale 3} -match numbers -body { ::Plotchart::determineScale -0.2 0.9 } -result {-0.2 1.0 0.2} test Plotchart-3.4 {Nice scale 4} -match numbers -body { ::Plotchart::determineScale -0.25 0.85 } -result {-0.4 1.0 0.2} test Plotchart-3.5 {Nice scale 5} -match numbers -body { ::Plotchart::determineScale -0.25 0.7999 } -result {-0.4 0.8 0.2} test Plotchart-3.6 {Nice scale 6} -match numbers -body { ::Plotchart::determineScale 10001 10010 } -result {10000 10010 2} test Plotchart-3.7 {Nice scale 7} -match numbers -body { ::Plotchart::determineScale 10001 10015 } -result {10000 10015 5} test Plotchart-3.8 {Nice scale 8} -match numbers -body { ::Plotchart::determineScale -1.7 26.8 } -result {-10.0 30.0 10.0} test Plotchart-3.9 {Nice scale 9} -match numbers -body { ::Plotchart::determineScale 0.99999999999999911 1.0000000000000007 } -result {0.999999994 1.000000006 2e-009} test Plotchart-3.10 {Nice scale from list} -match numbers -body { ::Plotchart::determineScaleFromList {-0.25 -0.1 0.6 0.6 0.85} } -result {-0.4 1.0 0.2} test Plotchart-3.11 {Nice scale from list with missing data} -match numbers -body { ::Plotchart::determineScaleFromList {-0.25 -0.1 0.6 {} {} {} 0.6 0.85} } -result {-0.4 1.0 0.2} # # Graphical tests: plotting data # test Plotchart-4.1 {XY-plot} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createXYPlot .c {0.0 100.0 10.0} {0.0 100.0 20.0}] set xd 5.0 ................................................................................ set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 ;# {} test Plotchart-4.2 {Piechart} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createPiechart .c] $s plot {"Long names" 10 "Short names" 30 "Average" 40 "Ultra-short names" 5} $s title "Okay - this works" ................................................................................ #checkCanvasItems .c {data} destroy .c set result 1 } -result 1 test Plotchart-4.3 {Polar plot} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createPolarplot .c {3.0 1.0}] for { set angle 0 } { $angle < 360.0 } { set angle [expr {$angle+10.0}] } { ................................................................................ set waited 0 set res [checkCanvasItems .c {data}] destroy .c set res } -result 1 test Plotchart-4.4 {Barchart} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createBarchart .c {A B C D E} {0.0 10.0 2.0} 2] $s plot series1 {1.0 4.0 6.0 1.0 7.0} red ................................................................................ set waited 0 set res [checkCanvasItems .c {data yaxis}] destroy .c set res } -result 1 test Plotchart-4.5 {Barchart (stacked)} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createBarchart .c {A B C D E} {0.0 20.0 5.0} stacked] $s plot series1 {1.0 4.0 6.0 1.0 7.0} red ................................................................................ set waited 0 set res [checkCanvasItems .c {data yaxis}] destroy .c set res } -result 1 test Plotchart-4.6 {Horizontal barchart} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createHorizontalBarchart .c {0.0 10.0 2.0} {A B C D E} 2] $s plot series1 {1.0 4.0 6.0 1.0 7.0} red ................................................................................ set waited 0 set res [checkCanvasItems .c {data xaxis}] destroy .c set res } -result 1 test Plotchart-4.7 {Horizontal barchart (stacked)} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createHorizontalBarchart .c {0.0 20.0 5.0} {A B C D E} stacked] $s plot series1 {1.0 4.0 6.0 1.0 7.0} red ................................................................................ set waited 0 set res [checkCanvasItems .c {data xaxis}] destroy .c set res } -result 1 test Plotchart-4.8 {Timechart} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createTimechart .c "1 january 2004" \ "31 december 2004" 4] ................................................................................ #checkCanvasItems .c {data} destroy .c set result 1 } -result 1 test Plotchart-4.9 {Stripchart} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createStripchart .c {0.0 100.0 10.0} {0.0 100.0 20.0}] proc gendata {s xold xd yold yd} { ................................................................................ set waited 0 set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 test Plotchart-4.10 {Isometric plot} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createIsometricPlot .c {0.0 100.0} {0.0 200.0} noaxes] ::Plotchart::setZoomPan .c $s plot rectangle 10.0 10.0 50.0 50.0 green ................................................................................ set waited 0 #checkCanvasItems .c {data} destroy .c set result 1 } -result 1 test Plotchart-4.11 {Histogram} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createHistogram .c {0.0 100.0 10.0} {0.0 100.0 20.0}] $s dataconfig series1 -colour green ................................................................................ set waited 0 set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 ;# {} # # Graphical tests: annotations and various plot/chart types # test Plotchart-5.1 {XY-plot - balloon} -constraints tk -body { canvas .c -width 300 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createXYPlot .c {0.0 100.0 10.0} {0.0 100.0 20.0}] set xd 5.0 ................................................................................ set waited 0 set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 ;# {} test Plotchart-5.2 {Gantt chart} -constraints tk -body { canvas .c -width 600 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::createGanttchart .c "1 january 2004" \ "31 december 2004" 4] ................................................................................ set waited 0 #set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 ;# {} test Plotchart-5.3 {3D Bars} -constraints tk -body { canvas .c -width 600 -height 200 -bg white pack .c -fill both .c delete all set s [::Plotchart::create3DBarchart .c {-200.0 900.0 100.0} 7] foreach {bar value} {red 765 green 234 blue 345 yellow 321 ................................................................................ #set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 ;# {} test Plotchart-5.4 {Radial chart} -constraints tk -body { canvas .c -width 600 -height 400 -bg white pack .c -fill both .c delete all set s [::Plotchart::createRadialchart .c {A B LongerName C} 10] $s plot {1 2 3 4} green 2 ................................................................................ #set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 ;# {} test Plotchart-5.5 {Filled radial chart} -constraints tk -body { canvas .c -width 600 -height 400 -bg white pack .c -fill both .c delete all set s [::Plotchart::createRadialchart .c {A B LongerName C} 10 filled] $s plot {1 2 3 4} green 2 ................................................................................ #set res [checkCanvasItems .c {data xaxis yaxis}] destroy .c set res } -result 1 ;# {} test Plotchart-5.6 {Filled radial chart} -constraints tk -body { canvas .c -width 600 -height 400 -bg white pack .c -fill both .c delete all set s [::Plotchart::createRadialchart .c {A B LongerName C} 10 cumulative] $s plot {1 2 3 4} green 2 |
Changes to modules/plotchart/plotconfig.tcl.
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
|
} {
set config($type,components) $components
}
# define implemented properties for each component:
# (the '-' means that the component inherits the properties of the previous component on the list)
foreach {component properties} {
leftaxis {color thickness font format ticklength textcolor labeloffset minorticks shownumbers showaxle render vtextoffset}
rightaxis -
axis {color thickness font format ticklength textcolor labeloffset minorticks shownumbers showaxle render justify}
topaxis -
bottomaxis -
xaxis -
yaxis -
zaxis -
margin {left right top bottom}
title {textcolor font anchor background}
................................................................................
set invisibleLabel [.invisibleCanvas create text 0 0 -text "M"]
foreach {char_width char_height} [FontMetrics .invisibleCanvas] {break}
set config(font,char_width) $char_width
set config(font,char_height) $char_height
# values for the 'default' style:
set _color "black"
set _font [.invisibleCanvas itemcget $invisibleLabel -font]
set _thickness 1
set _format ""
set _ticklength 3
set _minorticks 0
set _textcolor "black"
set _anchor n
set _labeloffset 2
set _left [expr {$char_width * 8}]
set _right [expr {$char_width * 4}]
set _top [expr {$char_height * 2}]
set _bottom [expr {$char_height * 2 + 2}]
set _bgcolor "white"
set _outercolor "white"
set _innercolor "white" ;# Not implemented yet: "$w lower data" gets in the way
set _background "white"
set _border "black"
set _position "top-right"
set _barwidth 0.8
set _innermargin 0.2
set _outline black
set _outlinewidth 1
set _vtextoffset 2
set _draw 1
set _shownumbers 1
set _showaxle 1
set _leftspace 5
set _rightspace 5
set _topspace 5
set _height [expr {$char_height + 2*$_topspace}]
set _anchor center
set _outerwidth 2
set _innerwidth 1
set _startangle 0
set _direction +
set _placement out ;# piechart label placement: 'out' or 'in'
set _render simple ;# rendering of text: 'simple' or 'text'
set _sorted 0 ;# piechart and spiral pie
#set _shownumbers 0 ;# piechart and spiral pie - conflict with axes - see below
#set _format "%s (%g)" ;# piechart and spiral pie
set _formatright "" ;# piechart and spiral pie
set _transposecoordinates 0 ;# horizontal barchart
set _justify "left"
destroy .invisibleCanvas
#
# Define the 'default' style
#
|
|
|
|
|
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
|
} { set config($type,components) $components } # define implemented properties for each component: # (the '-' means that the component inherits the properties of the previous component on the list) foreach {component properties} { leftaxis {color thickness font format ticklength textcolor labeloffset minorticks shownumbers showaxle render vtextoffset subtextcolor subtextfont vsubtextfont vsubtextcolor usesubtext usevsubtext} rightaxis - axis {color thickness font format ticklength textcolor labeloffset minorticks shownumbers showaxle render justify subtextcolor subtextfont usesubtext} topaxis - bottomaxis - xaxis - yaxis - zaxis - margin {left right top bottom} title {textcolor font anchor background} ................................................................................ set invisibleLabel [.invisibleCanvas create text 0 0 -text "M"] foreach {char_width char_height} [FontMetrics .invisibleCanvas] {break} set config(font,char_width) $char_width set config(font,char_height) $char_height # values for the 'default' style: set _color "black" set _font [.invisibleCanvas itemcget $invisibleLabel -font] set _subtextfont $_font set _subtextcolor $_color set _vsubtextfont $_font set _vsubtextcolor $_color set _usesubtext 0 set _usevsubtext 0 set _thickness 1 set _format "" set _ticklength 3 set _minorticks 0 set _textcolor "black" set _anchor n set _labeloffset 2 set _left [expr {$char_width * 8}] set _right [expr {$char_width * 4}] set _top [expr {$char_height * 2}] set _bottom [expr {$char_height * 2 + 2}] set _bgcolor "white" set _outercolor "white" set _innercolor "white" ;# Not implemented yet: "$w lower data" gets in the way set _background "white" set _border "black" set _position "top-right" set _barwidth 0.8 set _innermargin 0.2 set _outline black set _outlinewidth 1 set _vtextoffset 2 set _draw 1 set _shownumbers 1 set _showaxle 1 set _leftspace 5 set _rightspace 5 set _topspace 5 set _height [expr {$char_height + 2*$_topspace}] set _anchor center set _outerwidth 2 set _innerwidth 1 set _startangle 0 set _direction + set _placement out ;# piechart label placement: 'out' or 'in' set _render simple ;# rendering of text: 'simple' or 'text' set _sorted 0 ;# piechart and spiral pie #set _shownumbers 0 ;# piechart and spiral pie - conflict with axes - see below #set _format "%s (%g)" ;# piechart and spiral pie set _formatright "" ;# piechart and spiral pie set _transposecoordinates 0 ;# horizontal barchart set _justify "left" destroy .invisibleCanvas # # Define the 'default' style # |
Changes to modules/plotchart/plotpriv.tcl.
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
set config($w,font,char_height) $char_height foreach {char_width char_height} [FontMetrics $w] {break} set margin_right [expr {$char_width * 4}] if { $margin_right < $config($w,margin,right) } { set margin_right $config($w,margin,right) } set margin_bottom [expr {$char_height * 2 + 2}] if { $margin_bottom < $config($w,margin,bottom) } { set margin_bottom $config($w,margin,bottom) } set pxmin [expr {$char_width*$text_width}] if { $pxmin < $config($w,margin,left) } { set pxmin $config($w,margin,left) } set pymin [expr {int($char_height*$notext) + [$w cget -borderwidth]}] if { $pymin < $config($w,margin,top) } { set pymin $config($w,margin,top) } array set options $argv if {[info exists options(-box)]} { foreach {offx offy width height} $options(-box) {break} if { $offy == 0 } { set offy [$w cget -borderwidth] |
> > > > > > > > > > > > > > > > > |
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
set config($w,font,char_height) $char_height foreach {char_width char_height} [FontMetrics $w] {break} set margin_right [expr {$char_width * 4}] if { $margin_right < $config($w,margin,right) } { set margin_right $config($w,margin,right) } if { $config($w,rightaxis,usevsubtext) } { set char_height [font metrics $config($w,rightaxis,vsubtextfont) -linespace] set margin_right [expr {$margin_right + $char_height + 4}] } set margin_bottom [expr {$char_height * 2 + 2}] if { $margin_bottom < $config($w,margin,bottom) } { set margin_bottom $config($w,margin,bottom) } if { $config($w,bottomaxis,usesubtext) } { set char_height [font metrics $config($w,bottomaxis,subtextfont) -linespace] set margin_bottom [expr {$margin_bottom + $char_height}] } set pxmin [expr {$char_width*$text_width}] if { $pxmin < $config($w,margin,left) } { set pxmin $config($w,margin,left) } set pymin [expr {int($char_height*$notext) + [$w cget -borderwidth]}] if { $pymin < $config($w,margin,top) } { set pymin $config($w,margin,top) } if { $config($w,leftaxis,usesubtext) || $config($w,rightaxis,usesubtext) } { set char_height1 [font metrics $config($w,leftaxis,subtextfont) -linespace] set char_height2 [font metrics $config($w,rightaxis,subtextfont) -linespace] set pymin [expr {$pymin + max($char_height1,$char_height2)}] } if { $config($w,leftaxis,usevsubtext) } { set char_height [font metrics $config($w,leftaxis,vsubtextfont) -linespace] set pxmin [expr {$pxmin + $char_height + 4}] } array set options $argv if {[info exists options(-box)]} { foreach {offx offy width height} $options(-box) {break} if { $offy == 0 } { set offy [$w cget -borderwidth] |