# Chart doesn’t show correct tooltip by markArea

**URL:** <https://community.openhab.org/t/chart-doesn-t-show-correct-tooltip-by-markarea/160613>\
**Category:** Beginners\
**Tags:** charts, pages, markarea\
**Created:** [December 2, 2024, 12:28pm UTC](https://community.openhab.org/t/chart-doesn-t-show-correct-tooltip-by-markarea/160613 "2024-12-02T12:28:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomka](https://community.openhab.org/letter_avatar_proxy/v4/letter/t/a9a28c/32.png) [@tomka](https://community.openhab.org/u/tomka)\
**Post date:** [December 2, 2024, 12:28pm UTC](https://community.openhab.org/t/chart-doesn-t-show-correct-tooltip-by-markarea/160613/1 "2024-12-02T12:28:44Z")

</div>

Hello everyone!

What I want to have:  
I’ve created and chart in my OH 4.2.2 to visualize my thermostat values for set temperature, current temperature AND humidity. I also want to display the state of a second item, if the window is OPEN or CLOSED. So far so good.

Problem:  
Now I have the problem that not all values are always displayed in the tooltip.

If I make a hover on the green lower area, the thermostat values are displayed, but the “Fenster“ will display „NaN“. If I do a hover above the green line (Set temperature), I only have the OPEN window value but no other thermostat values. If I am in a non-pink area, where the window should actually be CLOSED, it also says NaN.

I have added a few screenshots to clarify this.

 ![below green, on red](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/4/9/491671e54b28eb17180bd3f50fee7b8164032698.png)  
 ![between yellow and blue, over red](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/c/bcb85b548c306288473ddd274ffe311fc0dbf2d6.png)  
 ![between yellow and blue, on white](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/4/d/4d8dd71d7ea26668eb525219167aabf486e2cf58.png)

I know that the value from “Fenster (markArea)” is displayed for the upper tooltip and the value from “Fenster (oh-time-series)” is displayed in the lower tooltip. I don’t know why! Both are in one component.

Here is my chart code

```yaml
config:
  chartType: ""
  label: "Heizkorper Schlafzimmer: IST / SOLL / Luftfeuchtigkeit"
  period: D
slots:
  dataZoom:
    - component: oh-chart-datazoom
      config:
        type: inside
  grid:
    - component: oh-chart-grid
      config:
        includeLabels: true
  legend:
    - component: oh-chart-legend
      config:
        bottom: 3
        type: scroll
  series:
    - component: oh-time-series
      config:
        gridIndex: 0
        item: RST2HeizkorperthermostatSchlafzimmer_AktuelleTemperatur
        markLine:
          data:
            - type: average
        markPoint:
          data:
            - name: min
              type: min
            - name: max
              type: max
          label:
            backgroundColor: auto
        name: Aktuelle Temperatur
        type: line
        xAxisIndex: 0
        yAxisIndex: 0
    - component: oh-time-series
      config:
        areaStyle:
          opacity: 0.2
        gridIndex: 0
        item: RST2HeizkorperthermostatSchlafzimmer_Solltemperatur
        markLine:
          data:
            - type: average
        markPoint:
          data:
            - name: min
              type: min
            - name: max
              type: max
          label:
            backgroundColor: auto
        name: Solltemperatur
        type: line
        xAxisIndex: 0
        yAxisIndex: 0
    - component: oh-time-series
      config:
        gridIndex: 0
        item: RST2HeizkorperthermostatSchlafzimmer_Luftfeuchtigkeit
        markPoint:
          data:
            - name: min
              type: min
            - name: max
              type: max
          label:
            backgroundColor: auto
        name: Luftfeuchtigkeit
        type: line
        xAxisIndex: 0
        yAxisIndex: 1
    - component: oh-time-series
      config:
        areaStyle: {}
        gridIndex: 99
        item: WDS_Fenster_Schlafzimmer_2_TurFensterstatus
        name: Fenster (oh-time-series)
        type: line
        connectNulls: true
        xAxisIndex: 0
        yAxisIndex: 0
      slots:
        markArea:
          - component: oh-mark-area
            config:
              item: WDS_Fenster_Schlafzimmer_2_TurFensterstatus
              name: Fenster (markArea)
  tooltip:
    - component: oh-chart-tooltip
      config:
        _trigger: axis
        confine: true
        smartFormatter: true
  xAxis:
    - component: oh-time-axis
      config:
        gridIndex: 0
  yAxis:
    - component: oh-value-axis
      config:
        gridIndex: 0
        max: "40"
        min: "10"
        name: °C
    - component: oh-value-axis
      config:
        gridIndex: 0
        name: "%"

```

Can someone please help me?  
I’ve been trying for many days.

Many THX

---

<div class="post-metadata">

**Author:** ![JustinG](https://community.openhab.org/user_avatar/community.openhab.org/justing/32/55948_2.png) [@JustinG](https://community.openhab.org/u/JustinG)\
**Post date:** [December 2, 2024, 3:48pm UTC](https://community.openhab.org/t/chart-doesn-t-show-correct-tooltip-by-markarea/160613/2 "2024-12-02T15:48:36Z")

</div>

This is, as far as I know, just the default functioning of the e-charts tooltip. Because the data shown for the mark area and the line series is fundamentally different (note that the markarea tooltip shows the range of datetimes for that area, not the exact datetime of the cursor), e-charts is not going to combine them.

The reason that you have the `Fenster (oh-time-series)` added to the time series tooltip is that you have added the item and name configs to the time series itself which is not required if you just want the mark area.

I am not aware of a way to achieve what you are looking to do, although there is a small chance that you might be able to use e-charts tooltip formatter for this.

---

<div class="post-metadata">

**Author:** ![tomka](https://community.openhab.org/letter_avatar_proxy/v4/letter/t/a9a28c/32.png) [@tomka](https://community.openhab.org/u/tomka)\
**Post date:** [December 5, 2024, 3:25pm UTC](https://community.openhab.org/t/chart-doesn-t-show-correct-tooltip-by-markarea/160613/3 "2024-12-05T15:25:18Z")

</div>

Many thanks @JustinG for your support and advice.

I spent 2 more long evenings trying several eChart things. I have NOT found a solution to bring both tooltips together.

I am happy with my solution so far. I have given “humidity” an additional “areaStyle” with opacity, so I also get my 3 most important return values displayed under this area: target, current and humidity  
Above “yellow” it shows the duration when a window was open. In the “white area” there is nothing about the window, but my important values - it fits 😉

Here are the current screenshots with the 3 scenarios:

 ![under yellow, with window open](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/e/c/eca3a163b23404748109a0f92a1741238409b16f.png)  
 ![Bildschirmfoto 2024-12-05 um 15.33.26](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/c/1/c18b8c79ad3c086a07ca66a03901e887debca426.png)  
 ![above humidity, window closed](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/2/c/2cd66237c6f02ba16bdbae1c9e8e32fcdb93f0f8.png)

Here is the current YAML chart code:

```YAML
config:
  chartType: ""
  label: "Heizkorper Schlafzimmer: IST / SOLL / Luftfeuchtigkeit"
  period: D
slots:
  dataZoom:
    - component: oh-chart-datazoom
      config:
        type: inside
  grid:
    - component: oh-chart-grid
      config:
        includeLabels: true
  legend:
    - component: oh-chart-legend
      config:
        bottom: 3
        type: scroll
  series:
    - component: oh-time-series
      config:
        gridIndex: 0
        item: RST2HeizkorperthermostatSchlafzimmer_AktuelleTemperatur
        markLine:
          data:
            - type: average
        markPoint:
          data:
            - name: min
              type: min
            - name: max
              type: max
          label:
            backgroundColor: auto
        name: Aktuelle Temperatur
        type: line
        xAxisIndex: 0
        yAxisIndex: 0
    - component: oh-time-series
      config:
        areaStyle:
          opacity: 1
        gridIndex: 0
        item: RST2HeizkorperthermostatSchlafzimmer_Solltemperatur
        markLine:
          data:
            - type: average
        markPoint:
          data:
            - name: min
              type: min
            - name: max
              type: max
          label:
            backgroundColor: auto
        name: Solltemperatur
        type: line
        xAxisIndex: 0
        yAxisIndex: 0
    - component: oh-time-series
      config:
        areaStyle:
          opacity: 0.2      
        gridIndex: 0
        smooth: true
        item: RST2HeizkorperthermostatSchlafzimmer_Luftfeuchtigkeit
        markPoint:
          data:
            - name: min
              type: min
            - name: max
              type: max
          label:
            backgroundColor: auto
        name: Luftfeuchtigkeit
        type: line
        xAxisIndex: 0
        yAxisIndex: 1
    - component: oh-time-series
      config:
        areaStyle: {}
        gridIndex: 0
        type: line
        name: Fenster
        connectNulls: true # Lücken schließen
        xAxisIndex: 0
        yAxisIndex: 0
      slots:
        markArea:
          - component: oh-mark-area
            config:
              item: WDS_Fenster_Schlafzimmer_2_TurFensterstatus
              name: Fenster
  tooltip:
    - component: oh-chart-tooltip
      config:
        _trigger: axis # Tooltip synchronisiert auf alle Achsen
        confine: true
        smartFormatter: true
  xAxis:
    - component: oh-time-axis
      config:
        gridIndex: 0
  yAxis:
    - component: oh-value-axis
      config:
        gridIndex: 0
        max: "40"
        min: "10"
        name: °C
        splitArea:
          show: true
        splitNumber: 5  
    - component: oh-value-axis
      config:
        gridIndex: 0
        name: "%"
        max: "80"
        min: "20"
        splitNumber: 5

```

**I still have two questions that I couldn’t solve by trying and trying again:**

1. Where can I set the opacity of my red “markArea” for the window status?  
(Nothing is accepted in “areaStyle”. “color” would work directly in config.)

```YAML
    - component: oh-time-series
      config:
        areaStyle: {}
        gridIndex: 0
        type: line
        name: Fenster
        color: red
        connectNulls: true # Lücken schließen
        xAxisIndex: 0
        yAxisIndex: 0
      slots:
        markArea:
          - component: oh-mark-area
            config:
              item: WDS_Fenster_Schlafzimmer_2_TurFensterstatus
              name: Fenster

```

1. Why can’t I make my lines rounder using “smooth: true”, but they all remain square?

```YAML
    - component: oh-time-series
      config:
        areaStyle:
          opacity: 0.2      
        gridIndex: 0
        smooth: true
        item: RST2HeizkorperthermostatSchlafzimmer_Luftfeuchtigkeit
        markPoint:
          data:
            - name: min
              type: min
            - name: max
              type: max
          label:
            backgroundColor: auto
        name: Luftfeuchtigkeit
        type: line
        xAxisIndex: 0
        yAxisIndex: 1

```

Thanks again

---

<div class="post-metadata">

**Author:** ![JustinG](https://community.openhab.org/user_avatar/community.openhab.org/justing/32/55948_2.png) [@JustinG](https://community.openhab.org/u/JustinG)\
**Post date:** [December 6, 2024, 3:28am UTC](https://community.openhab.org/t/chart-doesn-t-show-correct-tooltip-by-markarea/160613/4 "2024-12-06T03:28:28Z")

</div>

> [@tomka](#):
>
> Where can I set the opacity of my red “markArea” for the window status?

Add `itemStyle` to the markArea config, and then add `color` to the itemStyle:

> **[Documentation - Apache ECharts](https://echarts.apache.org/en/option.html#series-lines.markArea.itemStyle)**
>
> Apache ECharts, a powerful, interactive charting and visualization library for browser

> [@tomka](#):
>
> Why can’t I make my lines rounder using “smooth: true”, but they all remain square?

It probably is smoothing it just a little bit. The problem is that because your persistence data is every minute, you’re not really going to get much smoothing . If you add a data zoom and zoom in to a very high degree you’ll see the smoothing at the minute level like this:

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/f/a/fa5160e4ecc892654694b0bd0d6b6e0798e12a67.png)

---

<div class="post-metadata">

**Author:** ![tomka](https://community.openhab.org/letter_avatar_proxy/v4/letter/t/a9a28c/32.png) [@tomka](https://community.openhab.org/u/tomka)\
**Post date:** [December 10, 2024, 11:37am UTC](https://community.openhab.org/t/chart-doesn-t-show-correct-tooltip-by-markarea/160613/5 "2024-12-10T11:37:18Z")

</div>

Hi there!

> [@JustinG](#):
>
> Add `itemStyle` to the markArea config, and then add `color` to the itemStyle:

Many thanks, that worked for me!  
`color` I don’t need, but `opacity` is the right thing.

```yaml
    - component: oh-time-series
      config:
        areaStyle: {}
        gridIndex: 0
        type: line
        name: Fenster
        connectNulls: true
        xAxisIndex: 0
        yAxisIndex: 0
      slots:
        markArea:
          - component: oh-mark-area
            config:
              item: WDS_Fenster_Schlafzimmer_2_TurFensterstatus
              name: Fenster
              itemStyle:
                opacity: 0.6

```

> [@JustinG](#):
>
> The problem is that because your persistence data is every minute, you’re not really going to get much smoothing .

I tried to zoom in and saw a little bit of smoothing 😁

For me I have found the solution  
THX @JustinG

 ![final chart](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/3/3/333a2140961d0b05d2fa75c5a131de71d5d7a49b.png)
