I'm using taipy==1.1 and I have an issue with the rendering of my charts.
Here is a snippet of my code:
import pandas as pd
from taipy import Gui
...
total_cost = dataset['costInUsd'].sum()
daily_costs = dataset.groupby(['date', 'costInUsd']).sum().reset_index()
regions_location = dataset[['date', 'resourceLocation']].groupby('resourceLocation').count().reset_index().rename(columns={'date': 'Number of resources', 'resourceLocation': 'Location'})
services_family = dataset[['date', 'serviceFamily']].groupby('serviceFamily').count().reset_index()
services_cost = dataset[['costInUsd', 'serviceFamily']].groupby('serviceFamily').sum().reset_index()
...
services_info = services_family.merge(services_cost).rename(columns={'serviceFamily': 'Family', 'costInUsd': 'Cost in USD', 'date': 'Number of resources'})
page = f"""
# Cost Analysis
Month to day cost: <|{total_cost}|>
<|
Daily costs:
<|{daily_costs}|chart|type=bar|width=90%|>
|>
<|layout|gap=5px|columns=20% 60%|
<|
<|{regions_location}|table|width=90%|>
|>
<|
<|{services_info}|table|width=90%|>
|>
|>
Costs:
<|{dataset}|table|height=400px|width=90%|>
"""
# Create a Gui object with our page content
Gui(page=page).run(dark_mode=True)
I can run it but the interpreter prints warnings:
* Server starting on http://127.0.0.1:5000
* Serving Flask app 'Taipy' (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
Opening in existing browser session.
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
* Server starting on http://127.0.0.1:5000
WARNING:root:
--- 4 warning(s) were found for page '/' in variable 'page' ---
- Warning 1: Invalid tag name 'text' in line 8
- Warning 2: Invalid tag name 'text' in line 27
- Warning 3: Invalid tag name 'text' in line 35
- Warning 4: Invalid tag name 'text' in line 47
----------------------------------------------------------------
The page is rendered but without any graphs, here is a snippet:
My data frame looks good, here is the head relative to the previous screenshot:
CodePudding user response:
Try to delete the f
before the page string. Taipy is formatting by itself the string to create controls (charts, buttons, tables, ...) and make the connections between the different variables.
page = """
# Cost Analysis
Month to day cost: <|{total_cost}|>
<|
Daily costs:
<|{daily_costs}|chart|type=bar|width=90%|>
|>
<|layout|gap=5px|columns=20% 60%|
<|
<|{regions_location}|table|width=90%|>
|>
<|
<|{services_info}|table|width=90%|>
|>
|>
Costs:
<|{dataset}|table|height=400px|width=90%|>
"""