I want to render bar chart based on the marimo buttons like day,week,month and year but bar chart is not rendering #1446
Replies: 4 comments 1 reply
-
Can you provide a minimal reproducible example? https://stackoverflow.com/help/minimal-reproducible-example It's not clear if this is a bug in marimo, or if there are just some concepts you need help understanding. In particular, it would help if your example were minimal. |
Beta Was this translation helpful? Give feedback.
-
@akshayka I want to create a altair barchart which will update based on the buttons such as week or month here is my code: below is the image of my notebook also attaching .md file for it I am stuck in last step of updating the chart I am getting filtered_data properly by selecting the button. e.g. previous_week Please help |
Beta Was this translation helpful? Give feedback.
-
I want to use Marimo tool for production environment with a large amount of data going in and out. What do you suggest to explore more to go ahead ? |
Beta Was this translation helpful? Give feedback.
-
Going to move this to discussions as it is not a bug in the software |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
Attached is my notebook I am not getting any kind of error though but bar chart is not getting updated based on the buttons selected Please help me where I am going wrong
Environment
{
"marimo": "0.5.2",
"OS": "Windows",
"OS Version": "10",
"Processor": "Intel64 Family 6 Model 140 Stepping 1, GenuineIntel",
"Python Version": "3.11.2",
"Binaries": {
"Browser": "--",
"Node": "v17.9.1"
},
"Requirements": {
"click": "8.1.7",
"importlib-resources": "6.1.1",
"jedi": "0.19.1",
"markdown": "3.6",
"pymdown-extensions": "10.8.1",
"pygments": "2.18.0",
"tomlkit": "0.12.5",
"uvicorn": "0.29.0",
"starlette": "0.37.2",
"websocket": "missing",
"typing-extensions": "4.8.0",
"black": "23.12.1"
}
}
Code to reproduce
import marimo
__generated_with = "0.5.3-dev14"
app = marimo.App()
@app.cell
def __():
import altair as alt
from vega_datasets import data
@app.cell
def __():
import datetime
import pandas as pd
import numpy as np
@app.cell
def __(dummy_data1):
dummy_data1.info()
return
@app.cell
def __(dummy_data1):
# import datetime
# import pandas as pd
# import altair as alt
import marimo as mo
@app.cell
def __(datetime, mo, set_end_date, set_start_date, update_chart):
# Function to generate date buttons
def date_button(label, days_delta):
today = datetime.datetime.now()
end_date = today - datetime.timedelta(days=days_delta)
@app.cell
def __():
# Functions to set start and end dates
def set_start_date(date):
# Logic to set the start date (e.g., updating a global variable or session state)
print(f"Start date set to: {date}")
@app.cell
def __(alt, dummy_data1, pd):
# Function to update the chart
def update_chart(start_date, end_date):
@app.cell
def __():
return
@app.cell
def __(alt, filtered_data, mo):
# Define the initial bar chart
mo.stop(len(filtered_data) == 0, "")
bar_chart = (
alt.Chart(filtered_data)
.mark_bar()
.encode(
x=alt.X(
"mean(Total_response_time):Q", title="Mean Total Response Time"
),
y=alt.Y("Request_date:T", title="Request Date"),
)
)
@app.cell
def __():
return
@app.cell
def __(
bar_chart,
button_prev_day,
button_prev_month,
button_prev_week,
button_prev_year,
mo,
):
layout = mo.vstack(
[
mo.hstack(
[
button_prev_day,
button_prev_week,
button_prev_month,
button_prev_year,
]
),
mo.ui.altair_chart(bar_chart),
]
)
if name == "main":
app.run()
Beta Was this translation helpful? Give feedback.
All reactions