How to overlap an offset time series in OH3? (Corelate yesterdays values vs. today)

You can absolutely compare two time series, no need to be aggregates:

The trick is that you have to define two separate time axes on the same “grid”.
Then you assign the two series (day before and now) to each of these axes (with xAxisIndex 0 & 1), also giving the second series the proper offsetAmount & offsetUnit.

YAML for the above chart:

config:
  chartType: day
  label: Temperature Comparison
  sidebar: false
  visibleTo:
    - role:administrator
slots:
  dataZoom:
    - component: oh-chart-datazoom
      config:
        show: true
        type: inside
  grid:
    - component: oh-chart-grid
      config:
        top: "120"
  series:
    - component: oh-time-series
      config:
        gridIndex: 0
        item: FlowerCare_Temperature
        name: Now
        type: line
        xAxisIndex: 0
        yAxisIndex: 0
    - component: oh-time-series
      config:
        gridIndex: 0
        item: FlowerCare_Temperature
        name: Day before
        offsetAmount: 1
        offsetUnit: day
        type: line
        xAxisIndex: 1
        yAxisIndex: 0
  tooltip:
    - component: oh-chart-tooltip
      config:
        show: true
  xAxis:
    - component: oh-time-axis
      config:
        gridIndex: 0
    - component: oh-time-axis
      config:
        gridIndex: 0
  yAxis:
    - component: oh-value-axis
      config:
        gridIndex: 0

If you wanted to add the series from 2 days ago it would be similar, add an axis, assign a new series to this new axis.

1 Like