clearWith and Images

Everything related to the development of modules in jamovi
Post Reply
rjwatt42
Posts: 6
Joined: Sun Oct 08, 2023 10:22 am

clearWith and Images

Post by rjwatt42 »

Hi
Can I check the logic of clearWith and images, please?

An example of what I am doing would have two controls boolean xxx and yyy (anything).
What I am wanting is that an image is left unchanged if option xxx is false, but redrawn if x is true or if yyy option changes.
So, I put this into the .a.yaml

Code: Select all

 - name: graphPlot
   type: Image
   renderFun: .plotGraph
   clearWith: 
    - yyy
Inside the R code, I call self$results$graphPlot$setState(imageStuff) to change the image when xxx is true but don't call it if xxx is false. A separate .plotGraph() function then prints the imageStuff.

When I do this, what happens is that the image is redrawn when xxx is true or yyy changes (as I want), but when xxx is set to false or xxx is false and yyy is changed, then the image just disappears.

I hope this makes sense. Is there anything I am not understanding?
Many thanks,
User avatar
jonathon
Posts: 2598
Joined: Fri Jan 27, 2017 10:04 am

Re: clearWith and Images

Post by jonathon »

maybe talk us through what you're trying to do here:

> image is left unchanged if option xxx is false, but redrawn if x is true

if the image depends on x, then it should be redrawn whether it changes to true or false ... i can't think of a situation where an image needs to be redrawn one way, but not the other.

jonathon
rjwatt42
Posts: 6
Joined: Sun Oct 08, 2023 10:22 am

Re: clearWith and Images

Post by rjwatt42 »

Thanks Jonathon. I spent the weekend experimenting with this and now have a good grasp of how the system works. I think my application is a little outside the normal run. I am wanting to generate some simulated data, see it (hence the image), and then have the option to do other things to it like place it in the data spreadsheet. It's no great issue that the image gets redrawn.
Post Reply