Hello,
I have disabled the label values of gauge component and by using value or maxvalue , I am trying to display the values for gauge but it is not working.
I have attached the snapshot of the script below -
devices_data = sum([durations['ON'] / 60 for address, durations in address_durations.items()])
# Calculate per minute consumption
minute_consumption_kwh = hourly_consumption_kwh / 60
print(minute_consumption_kwh)
duration_data = minute_consumption_kwh * devices_data
# Format the values for display
total_kwh_consumed_with_unit = "{:.2f}kwh".format(duration_data)
print(total_kwh_consumed_with_unit)
# Calculate the difference
difference_kwh = total_consumption_str - duration_data
# Format the values for display
difference_with_unit = "{:.2f} kWh".format(difference_kwh)
print("Difference:", difference_with_unit)
#Updating in gauge component
gauge_day = self.parent.parent.parent.getChild("FlexContainer_1").getChild("FlexContainer_0").getChild("Gauge")
gauge_week = self.parent.parent.parent.getChild("FlexContainer_1").getChild("FlexContainer_0").getChild("Gauge_0")
gauge_month = self.parent.parent.parent.getChild("FlexContainer_1").getChild("FlexContainer_0").getChild("Gauge_1")
# Now, depending on the duration_type, update the corresponding gauge
if duration_type == 1: # Daily
gauge_day.props.outerAxis.maxValue = difference_with_unit
print("Daily gauge updated:", difference_with_unit)
elif duration_type == 7: # Weekly
gauge_week.props.outerAxis.maxValue = difference_with_unit
print("Weekly gauge updated:", difference_with_unit)
elif duration_type == 30: # Monthly
gauge_month.props.outerAxis.maxValue = difference_with_unit
print("Monthly gauge updated:", difference_with_unit)
It would be really helpful if anyone can please help me out with this issue?
Thanks in advance!