For instance look at this. Sum shows up. Max doesn't (neither does min or avg).
Given that the data looks so peaky and a little synthetic, is it possible that there's only a single document per spike? In that case, max and sum are identical and the lines will overlap exactly.
I just spotted that max() works on the larger ranges.
So my hypothesis is max() refuses to work if there is only 1 item per point, but for 2+ it will take the max.
I.e. in psuedocode, max(50) = null, but max(50,40) = 50 in your code.
Since this isn't really how max() should work, it should work for 1 or more items, I'd characterise this is a bug.
I can workaround this, but this is going to be annoying for anyone with data that might be sparse at point and dense at other points, as you can't have a single chart of that data. I imagine this is a common case.

