You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Google Chart vAxis maxValue在Tasmota中失效问题求助

问题解决:Tasmota中Google Chart Y轴最大值锁定失败

问题原因

Google Chart 默认会根据数据的实际范围自动调整坐标轴范围,即便你在 vAxis 中设置了 maxValue,只要存在超过该值的数据点,Y轴就会自动扩大范围来适配数据。要强制锁定轴的范围,需要额外添加严格模式配置。

修复代码

修改你的 vAxis 配置项,添加 strict: true 属性,强制图表遵循你设置的轴范围:

$vAxis:{format:'# W',minValue:0,maxValue:300, strict: true},

完整的修改后代码片段:

; 4h power chart - new value every 30s
$<div id="chart1" style="text-align:center;width:400px"></div>
$gc(lt s4h "wr" "Leistung [W]" cstr2)
$var options = {
$chartArea:{left:60,width:'83%%'},
$legend:'none',
$vAxis:{format:'# W',minValue:0,maxValue:300, strict: true},
$explorer:{actions:['dragToZoom', 'rightClickToReset']},
$series: {0: {type: 'area'}},
$title:'Verbrauch 4 Stunden [Watt]'
$};
$gc(e)

效果说明

添加 strict: true 后,无论数据中出现多大的数值,Y轴最大值都会固定为300,超出的数值点会显示在图表区域的上方(不会触发轴范围的自动调整)。

内容的提问来源于stack exchange,提问作者Connor MacLeod

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.01 11:20:01