Use Dynamic Visibility. Link it to one of the data points in the chart, and make the chart invisible if this data point is empty (before the query) and visible if the data point is not empty (after the query).
So if your chart plots B1:B20, make C1 the dynamic visibility cell with
C1 = IF(B1="",0,1)
Then set the chart's dynamic visibility key to C1 and the value to 1.