Graph aggregate netapp historical

hello everybody !
I try to create a graph from the table below :
aggregate-history-view-table

it’s a MySQL datasource

I’ve created this request:

SELECT
aggregatecapacityhistoryyearview.periodEndTime AS "time_sec",
aggregatecapacityhistoryyearview.usedSum as "value",
aggregate.name as "metric"
FROM aggregatecapacityhistoryyearview
join aggregate
on aggregate.id = aggregatecapacityhistoryyearview.aggregateId
WHERE aggregate.name not like "aggr_root%"

note : i’ve created a join section to replace aggregate ID by aggregate name

I get the graph below :

i’m not far but there are strange points in my graph, here an example:

I’ve tried group by aggregate.name, different macro for order but i really get troubles to finalize this query !

thanks a lot for your advices and help !

i think my querie is better:

  SELECT
  periodEndTime AS "time",
  UsedSum as "value",
  aggregate.name as "metric"
FROM aggregatecapacityhistoryyearview
join aggregate
on aggregatecapacityhistoryyearview.aggregateId = aggregate.id
WHERE aggregate.name not like "aggr_root_%"
  and $__timeFilter(periodEndTime)
  #and ocum_report.aggregatecapacityhistoryyearview.periodEndTime BETWEEN '2019-01-01' and '2020-01-17'
  GROUP BY periodEndTime, name
  ORDER BY periodEndTime

but i have a Strange ending :

Thanks a lot in advance for you help !

i modified by :

SELECT
periodEndTime AS "time",
UsedSum as "value",
aggregate.name as "metric"
FROM aggregatecapacityhistoryyearview
join aggregate
on aggregatecapacityhistoryyearview.aggregateId = aggregate.id
WHERE aggregate.name not like "aggr_root_%"
and $__timeFilter(periodEndTime)
#and ocum_report.aggregatecapacityhistoryyearview.periodEndTime BETWEEN '2019-01-01' and '2020-01-17'
and ocum_report.aggregatecapacityhistoryyearview.periodEndTime BETWEEN NOW() - INTERVAL 365 DAY AND NOW()
GROUP BY periodEndTime, name
ORDER BY periodEndTime

and it seems better :