How do you measure the area under a line graph?


In my case, I am curious to work out my daily kW/h spend. Week and month totals would be interesting too. How do I achieve that?

Guess best experience on second thought would be to make a range selection and get a total spend for that!


You need to calculate integral. Check used TSDB doc, some TSDB (InfluxDB) supports Integral function out of the box.

1 Like

Your graph is labelled as kWh so is already energy and not power. Your would integrate energy in kW to power in kWh using a simple integral function in InfluxDB/Grafana.
I have a meter providing kW and run :

FROM default PLC1 WHERE Instrument_ID = 301176
SELECT field (Value) integral () math ( / 3600)
GROUP BY time (1s)
FORMAT AS Time series

I do this in a SingleStat box as I am only after the single accumulated kWh over the entire time range selected