Repainting advice needed for layered components

I have a component that displays a graph. It takes quite a bit of time to repaint.
I have another component that paints a cursor, handles mouse events and is placed directly over the graph component. I do this in order to be able to move the cursor quickly without having to take the time to repaint the graph component.

The problem is, whenever the cursor component is repainted, the graph repaint is also called, which slows the cursor movement.

I added a flag to the graph component to only allow my repaint commands, but it now it goes blank when the cursor is repainted.

How do I prevent the graph component from being repainted, yet still retain it’s bitmap?

Do I need to do something like save the bitmap?

I haven’t used it in juce, but I would try something like Component::setBufferedToImage()

Thanks. This worked, and such a simple solution.