Hi,
I suspect that the graph is not updated because ff and gg aren’t persisting updates at every callback execution (they are overwritten by f and g. Besides, when lines like this appears in line plots, it is usually because the data is not sorted by x values (see here), although this does not seem to be the problem in your case (it could be worth checking).
That said, I would encourage to take a look on the extendData parameter in dcc.Graph. In a nutshell, this parameter allow you to append just the new data to the traces, instead of creating an entire new Plotly figure after appending a row to the dataframe. It can be a bit difficult to figure out what you need to return in the callback, but this will make your callback much more efficient and less cluttered.
You can read more about extendData in the component reference. Otherwise, I would be happy to help you with this particular case.