Hi,
The goal of this patch is to take into account for long y labels in an horizontal plotchart.
I have allread discussed that problem on comp.lang.tcl where the solution has been suggested by other Tclers :
http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/ab5ee289991f81f/6821b6d40899d276?lnk=gst&q=plotchart#6821b6d40899d276
The problem is that, when long labels are to be displayed, some are hidden because there is no space left on the canvas.
The patch is fixing the problem by computing the longest y label to display : this allows to set the view accordingly.
The problem is located in the file plotchart.tcl, in the proc "::Plotchart::createHorizontalBarchart".
The following code takes into account for the size of the current default font used in the barchart and is not perfect because Plotchart does not take into account the fonts yet.
label .invisibleLabel
set fontname [.invisibleLabel cget -font]
destroy .invisibleLabel
set xspacemax 0
foreach ylab $ylabels {
set xspace [font measure $fontname $ylab]
if {$xspace> $xspacemax} then {
set xspacemax $xspace
}
}
set text_width [expr {int ( $xspacemax / 10.) + 1}]
foreach {pxmin pymin pxmax pymax} [MarginsRectangle $w $notext $text_width] {break}
Best regards,
Michaël
Modified version with computation of the size of the y labels
Logged In: YES
user_id=400048
Originator: NO
I will incorporate this patch in Plotchart. Unfortunately my connection to the Internet from my development PC (at home) is at this moment unreliable at the best of times and non-existent on average.