Obtain plot difference in chart

I am plotting two datasets in a chart and both Datasets have different amount of data.

I want to obtain the difference between both lines, ¿Is there any way to do so?

I can’t go row by row obtaining the difference because the datasets have different lengths.

Thank you,


Even if they have different number of rows, just loop through the dataset that has less rows.
You can have the script run when either dataset1 or dataset2 changes.

Maybe even bind the difference dataset to the sql query.

SELECT ID, ABS(val1-val2)
FROM table


SELECT t1.ID, ABS(t1.val1 - t2.val2)
FROM table1 t1
JOIN table2 t2 ON t2.ID = t1.ID

Yes I could do so, the thing is thay maybe row number 2 from plot 1 corresponds to row number 5 from plot 2…

I woul like to know if I can create a dataset from the plot that gets the Y value every 0,1 X value or something like that.

Click on the lines.