further to Sunny T's response you should use the if statement like this:
If(GetSelectedCount(Sensor) > 0,1,0)
This should be used within the calculation condition of the properties of the chart object. This basically will then only return the calculations once the condition in the if statement is met.
If this response is helpful, please mark this as helpful and a correct answer.