The integral basically is a sum, at least in approximation. But given that the x-axis is time and it does not have the same meaning as the y-axis I’m not entirely certain what the integral will tell you. You’ll get fairly different different results depending on how you interpret the x-axis and convert it to a number that you can then use to calculate the area between two points using the trapeziodal rule or Simpson’s rule or what ever approach you choose.
I do notice that InfluxDB has an integral function built in which you could call out to using executeCommandLine. It might be worth a look to see how it interprets the time axis to do it’s calculation.