Hide and Show Graphs using Interface

Typically: "How do I... ", "How can I... " questions
Post Reply
cleu892
Posts: 14
Joined: 16 May 2022, 13:09

Hide and Show Graphs using Interface

Post by cleu892 »

Hello,

I am wondering if it possible to toggle the visibility of the actual graph (not the little axes and grid that shows up, but the actual graph with the x and y axis and curves) using a function similar to sim.setObjectInt32Param?

To give some context, I have a user interface that asks a user which test room they'd like to start in. Different test rooms require different graph outputs, so I am looking for a way to implement this hiding and showing of specific graphs within a child script.

Cheers!

coppelia
Site Admin
Posts: 10336
Joined: 14 Dec 2012, 00:25

Re: Hide and Show Graphs using Interface

Post by coppelia »

Instead of hiding and showing a specific graph window, it would probably be more elegant to simply use one single graph, and reinitialize it with a different content. You'd first remove all streams/curves with sim.destroyGraphCurve(graphHandle,-1).

If you really want to show/hide the graph windows, then you'll have to modify the source in lua/graph_customization.lua, or better, copy that source into the customization script attached to the graph, and modify it there. But that is more complicated (search for createOrRemovePlotIfNeeded in that code)

Cheers

cleu892
Posts: 14
Joined: 16 May 2022, 13:09

Re: Hide and Show Graphs using Interface

Post by cleu892 »

Oh I see, thank you!

Post Reply