Attached is the patch to fix the issue mentioned in the subject.
Regarding hiding the color legend when the server is disconnected, I feel it's good to have the legend visible as it says it's a graph. Otherwise, a box with error is ambiguous. Plus, it's not going to change anyway even if graph data is available or not.