How do I analyze and display "delta" consumption data over varying time buckets (windows)?

My water meter gives me the total consumption to date every 15 minutes.
The ‘Energy’ dashboard allows me to display new consumption in pre-defined, fixed time buckets based on the time range (e.g., hourly, daily, weekly, monthly).

How can I display a bar chart of incremental consumption over an on-the-fly configurable range of time and length of time bucket (window)?

I know I can use a template sensor to calculate and store incremental consumption over an arbitrary time window, but that has 2 disadvantages:

  1. The time window is fixed and must be configured in advance
  2. The data is bucketized and collected going forward – so if I want to look at 30 days, I need to wait 30 days for the data accumulate.

Is there an API I can call to use the data aggregation functionality of the Energy Dashboard to create my own buckets and time ranges for display?

I think both MeasureIt (I’m the author) and utility-meter can do this. Have a look at those: MeasureIt and utility_meter.