With my current setup, it seems that once I use the scrollbar, the -
shiftby option becomes disabled and cannot be re-set. Is there any way
to get this option back so I can toggle back to the original shifted
mode?
Thank you!
Doug
I've done it. I can't share any working examples right now because it's
all buried in lots of proprietary code, but I can give some advice.
> With my current setup, it seems that once I use the scrollbar, the -
> shiftby option becomes disabled and cannot be re-set. Is there any way
> to get this option back so I can toggle back to the original shifted
> mode?
The way I solved this is with a hack in the code that handles scrollbar
requests. What I have is something like this:
scrollbar $graph_h_scrollbar ... -command scrollTheGraph
...
proc scrollTheGraph {args} {
global graph
set result [eval $graph axis view x $args]
update idletasks
set viewx [lindex [$graph axis view x] end]
if {$viewx > .999} {
$graph_w axis configure x -min {} -max {}
}
return $result}
}
I don't know recall why I chose .999 (and is proof why Magic Numbers
aren't a good idea...). The idea is, if the scrollbar is sufficiently to
the right, reset the min and max to null which is what is necessary to
re-enable the autoscrolling.
(yuck! revisiting that code now after so many months, I'm chagrined by
my use of a magic number and a call to update, but I'm hoping I had a
good reason at the time!)
We also have a scale widget that lets you adjust the scale of the graph,
and it has the following comment at the top:
"If min and max are configured the autorange has no effect. So, when the
scale changes we need to re-enable auto scaling by adjusting the max
while keeping the min static"
I hope this helps. It _is_ possible to have autoscrolling and use
scrollbars, it just takes some creative coding. The BLT graph widget is
amazing, but the docs do leave a little bit to be desired. With enough
digging though, just about anything you want to do seems to be possible.
--
Bryan Oakley
http://www.tclscripting.com
It is good to know someone else has had some success doing this. Your
code and description sounds like what I am aiming for, and should
certainly help me. Thank you!