Having a lambda function inside the delta property does not work. It would be really useful for it to work. Maybe, other properties are impacted.
WARNING:root:
--- 1 warning(s) were found for page '/' ---
- Warning 1: Metric: delta cannot be transformed into a number:
could not convert string to float: '<lambda>'
----------------------------------------------
Expected Behavior
It should work; the delta property should be able to use the lambda function to get the proper delta displayed on the metric. Maybe, other properties are impacted.
Steps to Reproduce Issue
# Import necessary libraries
import pandas as pd
import taipy as tp
import datetime as dt
import taipy.gui.builder as tgb
value = 10
previous_value = 5
with tgb.Page() as page:
# Don't work
tgb.metric(lambda value: value if value else 0,
delta=lambda value, previous_value: (value - previous_value)
if value and previous_value else 0,
max=20,
title="Comparison",
height="250px")
# Works
tgb.metric(lambda value: value if value else 0,
delta="{(value - previous_value) if value and previous_value else 0}",
max=20,
title="Comparison",
height="250px")
# Main execution block with GUI setup
if __name__ == "__main__":
tp.Gui(page).run(title="Bug replication", port=3248)
Browsers
Chrome
OS
Windows
Version of Taipy
Develop - 7/15/24
Acceptance Criteria
[ ] Ensure new code is unit tested, and check code coverage is at least 90%.
[ ] Create related issue in taipy-doc for documentation and Release Notes.
What went wrong? 🤔
Having a lambda function inside the delta property does not work. It would be really useful for it to work. Maybe, other properties are impacted.
Expected Behavior
It should work; the delta property should be able to use the lambda function to get the proper delta displayed on the metric. Maybe, other properties are impacted.
Steps to Reproduce Issue
Browsers
Chrome
OS
Windows
Version of Taipy
Develop - 7/15/24
Acceptance Criteria
Code of Conduct