# \[OH3\] Charts with Apache ECharts Options

**URL:** <https://community.openhab.org/t/oh3-charts-with-apache-echarts-options/126463>\
**Category:** UIs\
**Created:** [September 13, 2021, 1:52pm UTC](https://community.openhab.org/t/oh3-charts-with-apache-echarts-options/126463 "2021-09-13T13:52:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![BartVdP](https://community.openhab.org/user_avatar/community.openhab.org/bartvdp/32/42193_2.png) [@BartVdP](https://community.openhab.org/u/BartVdP)\
**Post date:** [September 13, 2021, 1:52pm UTC](https://community.openhab.org/t/oh3-charts-with-apache-echarts-options/126463/1 "2021-09-13T13:52:46Z")

</div>

Hi,

Running on OH3.1 I made a page showing an chart with 4 switch items… I would like to have one tooltip-axis that combines all of this grids? I have read this post [https://community.openhab.org/t/oh3-charts-with-apache-echarts/111505](https://community.openhab.org/t/oh3-charts-with-apache-echarts/111505)  
where Yannick suggest to use

```auto
options:
    axisPointer:
      link:
        xAxisIndex: all

```

But can’t get this working… don’t know how to translate the [Documentation - Apache Echarts](https://echarts.apache.org/en/option.html#axisPointer.link) into YAML..

this is the chart

 ![image](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/original/3X/9/e/9e39aa19debe75db40885baa18f9b57bf5c1d739.png)  
and YAML code:

```yaml
config:
  chartType: ""
  period: h
  label: Bewegingsmelding
slots:
  grid:
    - component: oh-chart-grid
      config:
        includeLabels: true
        height: "150"
        show: true
        containLabel: true
        bottom: "10"
    - component: oh-chart-grid
      config:
        show: true
        containLabel: false
        height: "150"
        bottom: "170"
    - component: oh-chart-grid
      config:
        show: true
        containLabel: false
        height: "150"
        bottom: "330"
    - component: oh-chart-grid
      config:
        show: true
        containLabel: false
        height: "150"
        bottom: "490"
    - component: oh-chart-grid
      config:
        show: true
        containLabel: false
        height: "150"
        bottom: "650"
  xAxis:
    - component: oh-time-axis
      config:
        gridIndex: 0
    - component: oh-time-axis
      config:
        gridIndex: 1
    - component: oh-time-axis
      config:
        gridIndex: 2
    - component: oh-time-axis
      config:
        gridIndex: 3
    - component: oh-time-axis
      config:
        gridIndex: 4
  yAxis:
    - component: oh-value-axis
      config:
        gridIndex: 0
    - component: oh-value-axis
      config:
        gridIndex: 1
    - component: oh-value-axis
      config:
        gridIndex: 2
    - component: oh-value-axis
      config:
        gridIndex: 3
    - component: oh-value-axis
      config:
        gridIndex: 4
  series:
    - component: oh-time-series
      config:
        name: VISU_IB_INKOMHAL
        gridIndex: 0
        xAxisIndex: 0
        yAxisIndex: 0
        type: line
        areaStyle: {}
      slots:
        markArea:
          - component: oh-mark-area
            config:
              name: VISU_IB_INKOMHAL
              item: VISU_IB_INKOMHAL
    - component: oh-time-series
      config:
        name: VISU_IB_LIVING
        gridIndex: 1
        type: line
        areaStyle: {}
        xAxisIndex: 1
        yAxisIndex: 1
      slots:
        markArea:
          - component: oh-mark-area
            config:
              name: VISU_IB_LIVING
              item: VISU_IB_LIVING
    - component: oh-time-series
      config:
        name: VISU_IB_KEUKEN
        gridIndex: 2
        xAxisIndex: 2
        yAxisIndex: 2
        type: line
        areaStyle: {}
      slots:
        markArea:
          - component: oh-mark-area
            config:
              name: VISU_IB_KEUKEN
              item: VISU_IB_KEUKEN
    - component: oh-time-series
      config:
        name: VISU_IB_WASPLAATS
        gridIndex: 3
        xAxisIndex: 3
        yAxisIndex: 3
        type: line
        areaStyle: {}
      slots:
        markArea:
          - component: oh-mark-area
            config:
              name: VISU_IB_WASPLAATS
              item: VISU_IB_WASPLAATS
    - component: oh-time-series
      config:
        name: Alarm ingeschakeld
        gridIndex: 4
        xAxisIndex: 4
        yAxisIndex: 4
        type: line
        areaStyle: {}
      slots:
        markArea:
          - component: oh-mark-area
            config:
              name: VISU_IB_IN_VD
              item: VISU_IB_IN_VD
  tooltip:
    - component: oh-chart-tooltip
      config:
        confine: true
        smartFormatter: true
        show: true
        orient: vertical
        xAxisIndex:
          - 0
          - 1
          - 2
          - 3
          - 4
  axisPointer:
    - component: oh-chart-axispointer
      config:
        link:
          xAxisIndex: all
  legend:
    - component: oh-chart-legend
      config:
        type: scroll
        show: true
        top: "1"
  dataZoom:
    - component: oh-chart-datazoom
      config:
        type: slider
        show: true
        xAxisIndex:
          - 0
          - 1
          - 2
          - 3
          - 4
        bottom: "10"

```

Could someone help me where to put this axisPointer option?

thanks!

---

<div class="post-metadata">

**Author:** ![Dibbler42](https://community.openhab.org/user_avatar/community.openhab.org/dibbler42/32/56084_2.png) [@Dibbler42](https://community.openhab.org/u/Dibbler42)\
**Post date:** [September 13, 2021, 2:49pm UTC](https://community.openhab.org/t/oh3-charts-with-apache-echarts-options/126463/2 "2021-09-13T14:49:31Z")

</div>

That could be a nice thing with a repeat etc.

---

<div class="post-metadata">

**Author:** ![ysc](https://community.openhab.org/letter_avatar_proxy/v4/letter/y/e480ec/32.png) [@ysc](https://community.openhab.org/u/ysc)\
**Post date:** [September 14, 2021, 11:30am UTC](https://community.openhab.org/t/oh3-charts-with-apache-echarts-options/126463/3 "2021-09-14T11:30:43Z")

</div>

> [@BartVdP](#):
>
> ```auto
> config:
> chartType: ""
> period: h
> label: Bewegingsmelding
> 
> ```

Here, under `config:`

```yaml
config:
  chartType: ""
  period: h
  label: Bewegingsmelding
  options:
    axisPointer:
      link:
        xAxisIndex: all
slots:
  ...

```

The final ECharts configuration is a “merge” of the transformation of the components in the slots (grid etc.) and this `options` object taken as-is.  
(Note that the merging is only done on top-level properties that are not covered by components so you can’t define grids with the `grid` option under the `options` config parameter of the chart page, same thing for axes, series and other components; however you can specify most ECharts options under `grid` in the `oh-chart-grid` components).  
The objects that aren’t supported in `options` and are taken from subcomponents are listed below in that `return` statement:

> <https://github.com/openhab/openhab-webui/blob/0c2b25beb8cf3eebc1af120c82ad62f4d1ce6dea/bundles/org.openhab.ui/web/src/components/widgets/chart/chart-mixin.js#L56-L76>

---

<div class="post-metadata">

**Author:** ![BartVdP](https://community.openhab.org/user_avatar/community.openhab.org/bartvdp/32/42193_2.png) [@BartVdP](https://community.openhab.org/u/BartVdP)\
**Post date:** [September 15, 2021, 10:32am UTC](https://community.openhab.org/t/oh3-charts-with-apache-echarts-options/126463/4 "2021-09-15T10:32:17Z")

</div>

Hi Yannick,

@ysc Thanks for your help and additional information. It works perfect!  
You have done a fantastic job with OH3!

Many thanks!
