Way to stack values in charts

Hi there,

ihm looking for a way to somehow “stack” different series to another in a chart. Hard to understand maybe, therefore I give an example:
i want to display the overall power-consumption as well as some parts of it. I have items for every value I want to show. It looks like this:

But the value in the item “Waschen”, “Trocknen” etc are part of the “Netzverbrauch”, so I want the “Netzverbrauch” not starting from the zero-line but with an offset of the value of “Waschen” and “Trocknen”

a bit like this chart from another tool (not openHAB):

(See i.e. the orange ones, which have as an offset the grey value)
Any idea? In the GUI I just found the time-offset…

As far I remember, it is possible to stack things with a bar chart, but not for line chart.

I do not have any difference in the settings between line and bar, they look the same.
… unfortunately also no way to stack. Ist there a way directly editing the YAML??

A way around it would be to create a dummy item.
So dummy_item = Waschen + Trocknen for example.
And then you graph the dummy item. Feels a bit wrong though to create an other item just to be able to show it stacked.
Grafana can do this though.

Yes. You can’t do it with the UI but it is easy to do with direct edits to the chart yaml. For each series you want stacked, you just add a stack property and give all the lines you want stacked the same stack name. It looks something like this:

- component: oh-time-series
  config:
    name: Power component 1
    gridIndex: 0
    xAxisIndex: 0
    yAxisIndex: 0
    type: line
    item: First_power_item
    stack: power
- component: oh-time-series
  config:
    name: Power component 2
    gridIndex: 0
    xAxisIndex: 0
    yAxisIndex: 0
    type: line
    item: Second_power_item
    stack: power
4 Likes

@Marijn_Oudijk: I was thinking about something like this too, but than I can’t see the single items any more…

@JustinG: Sounds simple, is simple AND works (bar as well as line)!! Thanks a lot!