# How to draw average graph

Hi,

it is possible to draw a graph of the calculated average values of a group like this:

`Group:Number:AVG gKeller_Temp "Temperatur Durchschnitt [%.2f °C]" <temperature> (All)`

How do i do this?

Sebastian

You would have to persist the group itself, so use

gKeller_Temp : everyChange, everyMinute

as persistence strategy.

The item is `gKeller_Temp` and as chart it draws all group members in one chart. This is pefect.
Now i want a different chart with only the calculated average.

Argh… that’s correct… You’ll have to copy the group state to another (proxy) item. just define an item:

`Number aKeller_Temp`

and a rule to update:

``````rule "update aKeller_Temp"
when
Item gKeller_Temp changed
then
aKeller_Temp.postUpdate(gKeller_Temp as DecimalType)
end
``````

and persist the proxy item.

Hmm,

casting GroupItem to DecimalType does not work. I think tried also this a while ago

`Error during the execution of rule 'update aKeller_Temp': Cannot cast org.openhab.core.items.GroupItem to org.openhab.core.library.types.DecimalType`

OK, i get it.

The update function has to be:
`aKeller_Temp.postUpdate(gKeller_Temp.state as DecimalType)`

1 Like

Argh… yes, missed the .state …