How to make Grafana show time series per year by months, month by days, day by hours?

Hi everyone.
I have Grafana v8.3.2.
Need to solve problem with time series. The input datasource is Elastic.
I need to display some stat in time series in format, when I choose 1 year interval it should display info grouped by months (12 data points), when 1 month interval (30-31 data points) grouped by days, when 1 day (24 data points) grouped by hours.
How it can be resolved?