Strange Behaviour when platting after using aggregations

Hi, I am using plotly with the aggreagtions feature and whilst it is aggregating correctly, I get strange behaviour in that the trace jumps from the end of the chart back to another data point before (see screenshot).

This is the config for the aggregations:
type: ‘aggregate’,
groups: xname,
aggregations: [
{target: yname, func: func, enabled: true}

Nothing out of the ordinary. Any ideas why this might be happening and how I can fix it?