How do I dynamically add elements to the Roassal RTGrapher instance?

103 views Asked by At
Object subclass: #MultiData
    instanceVariableNames: 'b'
    classVariableNames: ''
    package: 'CFR-Extensions'

initialize
    b := RTGrapher new.

    b add: (self makeD: #('hello' 1 2 1)).
    b add: (self makeD: #('test' 1 2 11)).

    b

makeD: first
    | d |
    d := RTVerticalMultipleData new.
    d barShape color: Color blue.
    points := OrderedCollection new.
    points add: first.
    d points: points.
    d addMetric: #second.
    d addMetric: #third.
    d addMetric: #fourth.

    "Rotated text"
    d barChartWithBarTitle: #first rotation: -30.
    ^d

The above is essentially the Several metrics per data point example from the Roassal book factored into two methods. Rather than just visualizing a static dataset I've been looking into ways of trying to add data as the program runs. I want to visualize the trace of the parameters for a tabular RL agent.

What happens when I display the graph in the inspector is that only the latest element shows up as a chart. There is some overlaying in the labels though that should not be there.

Originally I wanted to do something like pass an OrderedCollection of points, but the way RTVerticalMultipleData compiles them into Trachel elements makes such a scheme invalid, so I've thought to batch the data instead before adding it as an element.

The fact that the above does not work strikes me as a bug. Apart from fixing this, I am wondering if there is a better way to visualize dynamic data?

1

There are 1 answers

0
Cyril Ferlicot On

I don't know roassal enough to answer to your problem, but for dynamic visualizations, Pharo also has the Telescope project. (https://github.com/TelescopeSt/Telescope)

Currently, Telescope only works with Seaside via web visualization (With the Cytoscape connector: https://github.com/TelescopeSt/TelescopeCytoscape). See a demo at: https://demos.ferlicot.fr/TelescopeDemo

I don't know if web visualizations are fine with you but I share just in case.