Re: BLT StripChart + scrollbar



DESheffer@xxxxxxxxx wrote:
I am currently reading real time data into a BLT StripChart that has
both the -autorange and -shiftby options. As is desired, all older
data is automatically moved to the left, out of view. However, I would
also like to scroll backwards in time (x-axis) to view the older data,
with the option to later return to the -shiftby view. Has anyone done
this sort of thing with a StripChart and scrollbar and care to share
some examples?

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
.



Relevant Pages

  • Re: BLT StripChart + scrollbar
    ... The way I solved this is with a hack in the code that handles scrollbar ... set result [eval $graph axis view x $args] ... We also have a scale widget that lets you adjust the scale of the graph, ...
    (comp.lang.tcl)
  • Tracking a graphs scrollbar
    ... position of the x-scrollbar on a graph, in order to set a string ... So when the scrollbar reaches a certain point, ... I have done this a different way before, plotting one direction of the ... graph, storing that history, and then plotting the other direction on ...
    (comp.lang.labview)
  • Re: Horizontal ScrollBar+ PictureBox + Flickering (how to stop flickering?)
    ... I am drawing a graph on the PictureBox. ... Is there anyway I can eliminate the flickering as I move the scrollbar - ... Private Sub Form_Resize ...
    (microsoft.public.vb.general.discussion)
  • Re: looping from a push source
    ... If you want update the scrollbar of GraphEdit, and you want it to go to ... duration from your graph position on every loop. ... The behaviour of the graph when the timestamps exceed the graph ...
    (microsoft.public.win32.programmer.directx.video)
  • Re: Graphics -- Scaling (Addl Issues)
    ... Both your and Mikes posts have given me something to think about regarding ... scale then redrawing my graph points to fit this ... Hence, if I want the graph to be zoomed, I plot lesser ... The "Scale" method appears to be plot the graph and then adjust the ...
    (microsoft.public.vb.general.discussion)