markArea with dynamic bounderies possible?

Hi there,

I’ve a chart page with markArea, such that an area is highlighted by a green background. Now I wanted to change that from 40 - 50 to being calculated dynamically based on some item’s state. But it doesn’t work. Why? Is this not supposed to work?

Here my code:

config:
  label: Luftfeuchtigkeit
  period: D
  sidebar: true
slots:
  grid:
    - component: oh-chart-grid
      config: {}
  legend:
    - component: oh-chart-legend
      config:
        bottom: true
        show: true
  series:
    - component: oh-time-series
      config:
        gridIndex: 0
        item: Shelly_HT_3__Humidity
        lineStyle:
          type: solid
        markArea:
          data:
            - - itemStyle:
                  color: RGB(250,240,230,0.5)
                name: .
                yAxis: 100
              - yAxis: = (60 - 0.5* (20 - Number.parseFloat(items.Warmepumpe_Calculated_Ambient_Temperature_Value.state)))
            - - itemStyle:
                  color: palegreen
                name: zu hoch
                yAxis: = (60 - 0.5* (20 - Number.parseFloat(items.Warmepumpe_Calculated_Ambient_Temperature_Value.state)))
              - yAxis: = (50 - 0.5* (20 - Number.parseFloat(items.Warmepumpe_Calculated_Ambient_Temperature_Value.state)))
            - - name: ok
              - itemStyle:
                  color: RGB(250,240,230,0.5)
                yAxis: = (50 - 0.5* (20 - Number.parseFloat(items.Warmepumpe_Calculated_Ambient_Temperature_Value.state)))
              - yAxis: 0
            - - name: zu tief
              - itemStyle:
                  color: RGB(250,240,230,0)
                yAxis: 35
              - yAxis: 0
          silent: true
        name: Samuel
        type: line
        xAxisIndex: 0
        yAxisIndex: 0
    - component: oh-time-series
      config:
        gridIndex: 0
        item: Shelly_HT_1__Humidity
        lineStyle:
          type: dashed
        name: Musik
        type: line
        xAxisIndex: 0
        yAxisIndex: 0
    - component: oh-time-series
      config:
        gridIndex: 0
        item: Shelly_HT_2__Humidity
        lineStyle:
          type: dotted
        name: Eltern
        type: line
        xAxisIndex: 0
        yAxisIndex: 0
    - component: oh-time-series
      config:
        gridIndex: 0
        item: WetterstationInnen_Humidity_Inside
        lineStyle:
          type:
            - 5.1
        name: DG
        type: line
        xAxisIndex: 0
        yAxisIndex: 0
  title:
    - component: oh-chart-title
      config:
        show: true
        subtext: Messwerte und Zielband
        text: Luftfeuchtigkeit
  xAxis:
    - component: oh-time-axis
      config:
        gridIndex: 0
  yAxis:
    - component: oh-value-axis
      config:
        gridIndex: 0

What worked before was:

        markArea:
          data:
            - - itemStyle:
                  color: RGB(250,240,230,0.5)
                name: .
                yAxis: 100
              - yAxis: 50
            - - itemStyle:
                  color: palegreen
                name: zu hoch
                yAxis: 50
              - yAxis: 40
            - - name: ok
              - itemStyle:
                  color: RGB(250,240,230,0.5)
                yAxis: 40
              - yAxis: 0
            - - name: zu tief
              - itemStyle:
                  color: RGB(250,240,230,0)
                yAxis: 35
              - yAxis: 0
          silent: true

Thanks for your help.

Bernd

In recent openHAB versions you can use #'ItemName' as shortcut for item’s numeric state.

I tested following part and it should work with dynamic mark area definition. I added parenthesis and removed whitespace after = sign.

        markArea:
          data:
            - - itemStyle:
                  color: RGB(250,240,230,0.5)
                name: .
                yAxis: 100
              - yAxis: =(60 - 0.5*(20 - (#'Warmepumpe_Calculated_Ambient_Temperature_Value')))

That’s it, thanks a lot. Lesson learned :slight_smile:

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.