# description: Display forecasted solar production and actual production for the current week in a minimalistic chart # author: Copyright (c) 2026 Florian Hotze under MIT License uid: solarForecast tags: - florianh-widgetset - solar - chart props: parameters: # Item & Persistence Configuration - context: item description: Item for forecasted energy (stored in persistence) label: Item name: forecastItem required: true type: TEXT groupName: forecast - context: persistenceService description: Persistence service for forecasted energy Item label: Persistence Service name: forecastService required: false type: TEXT groupName: forecast - context: item description: Item for actual energy produced (stored in persistence) label: Item name: actualItem required: true type: TEXT groupName: actual - context: persistenceService description: Persistence service for actual energy Item label: Persistence Service name: actualService required: false type: TEXT groupName: actual # Chart Configuration - default: kWh description: Y-Axis Unit name: yAxisName required: false type: TEXT # Appearance Configuration - default: 250px description: Height of the widget (any CSS height value supported, but px is recommended) label: Height name: height required: false type: TEXT groupName: appearance - default: Forecast description: Chart label (will be displayed in the legend and on tooltip hover) for forecasted production label: Forecast Label name: forecastLabel required: false type: TEXT groupName: appearance - default: Actual description: Chart label (will be displayed in the legend and on tooltip hover) for actual produced energy label: Actual Label name: actualLabel required: false type: TEXT groupName: appearance - context: color default: "#ff9800" description: Color for produced energy bar name: colorProduced required: false type: TEXT groupName: appearance - context: color default: "#999999" description: Color for forecasted energy bar (light mode) name: colorForecastLight required: false type: TEXT groupName: appearance - context: color default: "#e0e0e0" description: Color for forecasted energy bar (dark mode) name: colorForecastDark required: false type: TEXT groupName: appearance parameterGroups: - name: forecast label: Forecasted Production - name: actual label: Actual Production - name: appearance label: Appearance component: oh-context config: constants: aggregateDimension1: isoWeekday chartBackgroundColor: transparent textColor: "=themeOptions.dark === 'dark' ? '#1c1c1d' : '#fff'" functions: forecastFormatter: "=(params) => Number(params.value[1]) ? Number(params.value[1]).toFixed(0) : ''" producedFormatter: =(params) => Number(params.value[1]).toFixed(0) tooltipFormatter: =(value, index) => Number(value).toFixed(1).toString().replace('.', ',') slots: default: - component: f7-card config: style: backdrop-filter: blur(6px) background-color: "=themeOptions.dark === 'dark' ? 'rgba(28, 28, 30, 0.85)' : 'rgba(255, 255, 255, 0.85)'" border: 1px solid var(--f7-card-border-color, rgba(0,0,0,0.06)) border-radius: var(--f7-card-expandable-border-radius) box-shadow: var(--f7-card-box-shadow, 0px 4px 12px rgba(0,0,0,0.05)) margin-left: 5px margin-right: 5px slots: content: - component: oh-chart config: chartType: isoWeek height: =props.height options: backgroundColor: =const.chartBackgroundColor periodVisible: false slots: grid: - component: oh-chart-grid config: bottom: 30 containLabel: true left: 5 right: 5 top: 10 legend: - component: oh-chart-legend config: bottom: 0 show: true series: - component: oh-aggregate-series config: aggregationFunction: max barWidth: 50% dimension1: =const.aggregateDimension1 item: =props.forecastItem itemStyle: borderRadius: - 8 - 8 - 8 - 8 color: "=themeOptions.dark === 'dark' ? props.colorForecastDark : props.colorForecastLight" label: color: =const.textColor formatter: =fn.forecastFormatter position: insideBottom show: true name: =props.forecastLabel + ' (' + props.yAxisName + ')' service: =props.forecastService type: bar - component: oh-aggregate-series config: aggregationFunction: last barGap: -60% barWidth: 50% dimension1: =const.aggregateDimension1 item: =props.actualItem itemStyle: borderRadius: - 8 - 8 - 8 - 8 color: =props.colorProduced label: color: =props.colorProduced formatter: =fn.producedFormatter position: top show: true name: =props.actualLabel + ' (' + props.yAxisName + ')' service: =props.actualService type: bar tooltip: - component: oh-chart-tooltip config: show: true trigger: axis valueFormatter: =fn.tooltipFormatter xAxis: - component: oh-category-axis config: axisLine: show: false axisTick: show: false categoryType: week weekdayFormat: short yAxis: - component: oh-value-axis config: axisLabel: show: false splitLine: show: false