Hi @JustinG . You’re right. I was hoping for a quick option/property that I missed ;-).
Some background information. In the meantime I did the upgrade to 4.2, so I got the latest version of openHAB (didn’t solve this). My usecase is a wall mounted tablet where I use a gridlayout with tiles, sliders and popups to create kind of a single page app as a dashboard and control to my home. At the moment I have copies of widgets for 1,2 or 3 row tiles because of this layouy issue. I was trying to merge them to one.
So to make is as easy as possible I removed most of the configuration to get to a minimal setup to reproduce the issue. Below the configuration for the gridlayout page. It’s setup to the max resolution on the tablet that displays without scroll bars. But on my laptop (HD resolution) it behaves the same.
config:
colNum: 8
fixedType: grid
hideNavbar: false
label: Demo
layoutType: fixed
margin: 5
scale: false
screenHeight: 773
screenWidth: 1275
showFullscreenIcon: true
sidebar: true
style:
--f7-card-bg-color: "#202020"
--f7-navbar-bg-color: "#202020"
--f7-navbar-border-color: "#101010"
--f7-page-bg-color: black
--f7-theme-color: gray
blocks: []
grid:
- component: oh-grid-item
config:
h: 2
w: 3
x: 3
y: 0
slots:
default:
- component: widget:lineTest
config:
average: netto_totaal_avg
- component: oh-grid-item
config:
h: 1
w: 2
x: 3
y: 2
slots:
default:
- component: widget:lineTest
config:
average: netto_totaal_avg
Did the same for the widget, killed everything except a basic linegraph for 1 item.
uid: lineTest
tags: []
props:
parameters:
- context: item
description: The average value
label: Average
name: average
required: true
type: TEXT
parameterGroups: []
timestamp: Aug 1, 2024, 7:58:01 AM
component: f7-card
slots:
default:
- component: oh-chart
config:
height: 100%
options:
backgroundColor: transparent
period: 2h
periodVisible: false
slots:
grid:
- component: oh-chart-grid
config:
height: 100%
series:
- component: oh-time-series
config:
areaStyle:
opacity: 0.6
item: =props.average
itemStyle:
color: rgb(50, 50, 150)
type: line
tooltip:
- component: oh-chart-tooltip
config:
trigger: axis
xAxis:
- component: oh-time-axis
config:
axisLabel:
show: true
boundaryGap: false
gridIndex: 0
splitNumber: 3
type: time
yAxis:
- component: oh-value-axis
config:
axisLabel:
show: true
axisTick:
inside: true
boundaryGap:
- 0%
- 0%
gridIndex: 0
splitLine: true
type: value
On both tablet and PC this produces the same, the linegraph becomes bigger than the tile. the smaller the tile, the more the overflow. Screenshot below.
As a update on my quest:
- The chart (in the canvas) does scale with (the root div) of the tile. But 100% is the size of the tile + an absolute value. That at least explains the behaviour. If the tile gets smaller, the absolute addition takes a bigger part. So more of the graph is lost. That’s why in my copy solution for a 1 row the height percentage of the grid must be the smallest to make it fit. Wild thought on this is using css on that root div and give it a inset/margin/border to match this absolute vale and allowing the chart to overflow it’s container. Hopefully the canvas will only use the height and be tricked by this. But that’s kind of a complex workaround. Would be easier to put in a change request to also allow formulas in this height propertie and wait for this.
- Googling of echarts shows more people have this issue with several configuration hints (properties). Scaling might be default with a fixed aspect ratio (maybe the horizontal size is the limitation that sets the vertical size). All suggested properties are not openHAB standard, Maybe they can be used anyway, but didn’t find to proper place to put them in the yaml. Do you now if all is passed anyway? Of does openHAB ‘filter’ the yaml so they can’t be used anyway?
My best guess for the found echart props (put them all in, not working)
- component: oh-chart
config:
height: 100%
options:
backgroundColor: transparent
maintainAspectRatio: false
responsive: true
scaleSize: 20
radius: [20, 180]
Wel thats it. Hope this helps you (or someone else of course) in a brainwave for a solution