Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Document the subtext subcommands. Compute the new margins based on the presence or absence of subtexts to the axes. Bumped version to 2.1.0 to reflect the addition of these subcommands and the repair of the pixelToCoords procedure. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | subtitles-and-corrected-tests |
Files: | files | file ages | folders |
SHA1: | b779f23b2edcb64056504ddde41d6b3c83f9925d |
User & Date: | markus 2013-03-10 14:12:58 |
Context
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 | |
14:12 | Document the subtext subcommands. Compute the new margins based on the presence or absence of subtexts to the axes. Bumped version to 2.1.0 to reflect the addition of these subcommands and the repair of the pixelToCoords procedure. check-in: b779f23b2e user: markus tags: subtitles-and-corrected-tests | |
11:49 | Extend the set of tests for the coordinate transformation procedures. This revealed that the procedure pixelToCoords had not been updated for the various transformation options. This has now been corrected. Other changes: explicitly take care of an expected value of 0 and more accurate conversion factor degrees to radians. check-in: 807a93a8bb 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 8 9 10 11 |
if {![package vsatisfies [package provide Tcl] 8.5]} {
# PRAGMA: returnok
return
}
package ifneeded Plotchart 2.0.2 [list source [file join $dir plotchart.tcl]]
if {![package vsatisfies [package provide Tcl] 8.5]} {
# PRAGMA: returnok
return
}
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 8 9 10 11 |
if {![package vsatisfies [package provide Tcl] 8.5]} {
# PRAGMA: returnok
return
}
package ifneeded Plotchart 2.1.0 [list source [file join $dir plotchart.tcl]]
if {![package vsatisfies [package provide Tcl] 8.5]} {
# PRAGMA: returnok
return
}
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/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, subvtextcolor and subvtextfont. (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/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 subvtextfont subvtextcolor usesubtext usesubvtext} 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 _subvtextfont $_font set _subvtextcolor $_color set _usesubtext 0 set _usesubvtext 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 |
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,usesubvtext) } { set char_height [font metrics $config($w,rightaxis,subvtextfont) -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_height [font metrics $config($w,bottomaxis,subtextfont) -linespace] set pymin [expr {$pymin + $char_height}] } if { $config($w,leftaxis,usesubvtext) } { set char_height [font metrics $config($w,bottomaxis,subvtextfont) -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] |