Changeset 2531 for trunk/gui/scripts
- Timestamp:
- Sep 21, 2011, 5:49:37 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/scripts/histogramresult.tcl
r2530 r2531 167 167 itk_component add plot { 168 168 blt::barchart $f.plot \ 169 -highlightthickness 0 -plotpadx 0 -plotpady 4169 -highlightthickness 0 -plotpadx 0 -plotpady 0 170 170 } { 171 171 keep -foreground -cursor -font … … 810 810 itcl::body Rappture::HistogramResult::ResetLimits {} { 811 811 set g $itk_component(plot) 812 813 #814 # HACK ALERT!815 # Use this code to fix up the y-axis limits for the BLT barchart.816 # The auto-limits don't always work well. We want them to be817 # set to a "nice" number slightly above or below the min/max818 # limits.819 #820 812 foreach axis [$g axis names] { 821 if {[info exists _limits(${axis}lin-min)]} { 822 set log [$g axis cget $axis -logscale] 823 if {$log} { 824 set min $_limits(${axis}log-min) 825 if {$min == 0} { set min 1 } 826 set max $_limits(${axis}log-max) 827 if {$max == 0} { set max 1 } 828 829 if {$min == $max} { 830 set logmin [expr {floor(log10(abs(0.9*$min)))}] 831 set logmax [expr {ceil(log10(abs(1.1*$max)))}] 832 } else { 833 set logmin [expr {floor(log10(abs($min)))}] 834 set logmax [expr {ceil(log10(abs($max)))}] 835 if {[string match y* $axis]} { 836 # add a little padding 837 set delta [expr {$logmax-$logmin}] 838 if {$delta == 0} { set delta 1 } 839 set logmin [expr {$logmin-0.05*$delta}] 840 set logmax [expr {$logmax+0.05*$delta}] 841 } 842 } 843 if {$logmin < -300} { 844 set min 1e-300 845 } elseif {$logmin > 300} { 846 set min 1e+300 847 } else { 848 set min [expr {pow(10.0,$logmin)}] 849 } 850 851 if {$logmax < -300} { 852 set max 1e-300 853 } elseif {$logmax > 300} { 854 set max 1e+300 855 } else { 856 set max [expr {pow(10.0,$logmax)}] 857 } 858 } else { 859 set min $_limits(${axis}lin-min) 860 set max $_limits(${axis}lin-max) 861 if {[string match y* $axis]} { 862 # add a little padding 863 set delta [expr {$max-$min}] 864 set min [expr {$min-0.05*$delta}] 865 set max [expr {$max+0.05*$delta}] 866 } 867 } 868 if {$min < $max} { 869 $g axis configure $axis -min $min -max $max 870 } else { 871 $g axis configure $axis -min "" -max "" 872 } 873 } else { 874 $g axis configure $axis -min "" -max "" 875 } 813 $g axis configure $axis -min "" -max "" 876 814 } 877 815 }
Note: See TracChangeset
for help on using the changeset viewer.