To get counts for singlestat

I am trying to pull data for a speedometer (basically its has the speed of the vehicle for every timestamp using graphite). I want to show how long the vehicle has been driving over 40kmph(on the singlestat panel). Can anyone please point me in the right direction of how this can be achieved on grafana?

Thanks!

It depends on you time series database and its query features

It just has speed at a particular time(y-axis is speed, x-axis is time). Using graphite for this.

you can look at the Graphite api and it’s functions. Not sure it has a feature to calculate how long a metric has been over a value.