So here I am looking for a quick & dirty way to display something resembling a scope trace within an existing Ruby GUI framework, which uses Gtk.
There doesn't appear to be a handy way to turn a list of values into a curve on a drawable, but there's this thing called a Curve, which has a function called set_vector; it's apparently meant for editable curves, e.g., color-fudging curves for the GIMP and such, but mayhap it'll suffice for my display-only purposes, at least for now.
Well. My first attempt, for an input dataset with a fixed number of traces worked kinda-sorta OK: I created Curve objects for traces 0..3, added them to the outer container, then, once the user had selected a data source, set their vectors. Worked as well as could be expected, though I was thinking of putting each in its own window so's to have room for a bit more vertical scale.
Next up: handle a dataset from the other model (capability just added)... which can have anything up to 16 traces, and not necessarily with contiguous trace numbers.
So: read the data source first, create Curve objects as needed and add them to the container, setting the vectors along the way.
I get flat lines at Y=0.
Read back the vector: an array of NaN. [A NaN, a NaN, a NaN, a NaN]: Batman!
WtF?
If I feed it another data source (actually, the same one again), Gtk complains bitterly about how I'm trying to re-add existing objects to the container (what with the program having been set up for a single run)... but the Curves get their vectors set properly the second time around.
It looks like, somehow, Curve needs to have been actually on the display for a while before it'll correctly handle having its vector set.
????
Oh, well: Curve doesn't really do what I want anyway. Perhaps I should settle for massaging the data into a format that can be conveniently imported into a graphing utility. And, later, after I migrate to Qt, I can revisit this matter.
Recent Comments