I try to display 3 values in one chart. Since the type of value is different for all of them, I use multiple Y-axis. One for temperature, one for humidity and one for air quality. The last one is just a line and the scale is not shown on the Y-axis.
To get all values displayed in one tooltip I have used the aggregate function. However, aggregated values can not be used with a dynamic time period according to the docs.
When doing aggregations, you have to be careful to add the right type of axes based on the period that you chose (Aggregate Series don’t support Dynamic period as chart type).
And thus I am left with the following picture. It is based on 24hrs from the start of the current day to the end of the current day.
YAML:
config:
label: Grafiek keukenwaarden
chartType: Day
options:
color:
- red
- blue
- "#59f42f"
slots:
grid:
- component: oh-chart-grid
config:
includeLabels: true
height: 75%
bottom: 50px
show: false
xAxis:
- component: oh-category-axis
config:
gridIndex: 0
categoryType: day
weekdayFormat: default
monthFormat: default
show: false
yAxis:
- component: oh-value-axis
config:
name: °C
scale: false
gridIndex: 0
- component: oh-value-axis
config:
name: "%"
scale: false
gridIndex: 0
- component: oh-value-axis
config:
name: ""
scale: false
gridIndex: 0
show: false
series:
- component: oh-aggregate-series
config:
name: Temperatuur
gridIndex: 0
xAxisIndex: 0
yAxisIndex: 0
type: line
item: tempKeuken
dimension1: hour
areaStyle:
opacity: 0.2
smooth: true
showSymbol: false
- component: oh-aggregate-series
config:
name: Luchtvochtigheid
gridIndex: 0
xAxisIndex: 0
yAxisIndex: 1
type: line
item: humKeuken
dimension1: hour
areaStyle:
opacity: 0.2
smooth: true
showSymbol: false
- component: oh-aggregate-series
config:
name: Luchtkwaliteit
gridIndex: 0
xAxisIndex: 0
yAxisIndex: 2
type: line
item: iaqKeuken
dimension1: hour
areaStyle:
opacity: 0.2
smooth: true
showSymbol: false
tooltip:
- component: oh-chart-tooltip
config:
show: true
orient: vertical
trigger: axis
legend:
- component: oh-chart-legend
config:
show: true
bottom: "10"
type: scroll
What I rather want is to show a 24hr window where the end of the chart is now and the beginning of the chart is now-24hrs. So I made a dynamic time period chart that looks like the picture below. However, now the tooltip only shows one value.
YAML:
config:
label: test
period: D
options:
color:
- red
- blue
- "#59f42f"
axisPointer:
link:
xAxisIndex: all
slots:
grid:
- component: oh-chart-grid
config: {}
xAxis:
- component: oh-time-axis
config:
gridIndex: 0
yAxis:
- component: oh-value-axis
config:
gridIndex: 0
name: °C
min: "0"
- component: oh-value-axis
config:
gridIndex: 0
name: "%"
min: "0"
- component: oh-value-axis
config:
gridIndex: 0
min: "0"
show: false
series:
- component: oh-time-series
config:
name: Temperatuur
gridIndex: 0
xAxisIndex: 0
yAxisIndex: 0
type: line
item: tempKeuken
areaStyle:
opacity: 0.2
smooth: true
- component: oh-time-series
config:
name: Luchtovchtigheid
gridIndex: 0
xAxisIndex: 0
type: line
item: humKeuken
yAxisIndex: 1
areaStyle:
opacity: 0.2
smooth: true
- component: oh-time-series
config:
name: Luchtkwaliteit
gridIndex: 0
xAxisIndex: 0
yAxisIndex: 2
type: line
item: iaqKeuken
areaStyle:
opacity: 0.2
smooth: true
tooltip:
- component: oh-chart-tooltip
config:
show: true
orient: vertical
order: seriesAsc
trigger: axis
axisPointer:
axis: auto
legend:
- component: oh-chart-legend
config:
show: true
orient: horizontal
bottom: "10"
I read somewhere to use this code to link the X-axis together:
axisPointer:
link:
xAxisIndex: all
But to no avail or I can’t get it implemented correctly. Ideally, all the intervals could be smoothed out as well but the main thing is the tooltip. I just want it to show all 3 values at a given time. Any hints please?