I need a statistics graph card based on the MEDIAN instead on the mean

Dear all,
I have data (COPs of a heat pump) with some outliers and therefore want to display the median of the data for each hour. Until now, I am using the statistics graph car which works well, but only shows the mean. Using the mean produces highly misleading results.
Thus, I am looking for a possibility to create a graph (bar chart if possible) showing the median for each hour of the day.

Any idea how to do that?

You can create sensor with the median value using a statistics sensor:

You could also consider using an outlier filter:

I prefer the first option. How would the yaml code look like?
I don’t know how to collect the values of each hour and then calculate the median.
Afterwards, a bar plot shall be created.

Like the samples in the docs i linked to, but with state_characteristic set to median. It then calculates the median for you. It will not give you any results for before when you created the sensor though, as it calculates the median as of the moment you create it.

    name: "median_cop"
    entity_id: sensor.eu13l_hp1_cop
    state_characteristic: median
    max_age:
      hours: 1

How will that help? Only the median of the last hour will be saved, but I need to keep the complete history. I don’t see how I can store the medians of all hours and draw a graph