For the gauge, you will want to return one aggregated value. For example:
SELECT count(value) FROM history WHERE $__timeFilter(InsertDate)