mckinsey / vizro Goto Github PK
View Code? Open in Web Editor NEWVizro is a toolkit for creating modular data visualization applications.
Home Page: https://vizro.readthedocs.io/en/stable/
License: Apache License 2.0
Vizro is a toolkit for creating modular data visualization applications.
Home Page: https://vizro.readthedocs.io/en/stable/
License: Apache License 2.0
Could you provide an example on how the main.py or app.py should look like
In a Dash app , you typically have
app= Dash ( name)
server=app.server
if name == "main":
........
How is it supposed to work for Vizro?
My current code :
app = Dash(name)
server = app.server
if name == "main":
app = Vizro().build(create_dashboard()).run( debug=True). --> where create_dashboard create the most of the code to create the layout.
doesn't run
I get : dash.exceptions.NoLayoutException: The layout was None
at the time that run_server
was called.
No response
0.1.5
3.9.18
MacOS
vizro_ai is not working with openai package higher or equal to 1.0.0
https://github.com/mckinsey/vizro/actions/runs/6804870476/job/18503283998
No response
0.1.6
3.9
Linux
No response
Context why this is beneficial: https://teamtreehouse.com/community/labels-vs-paragraphs#:~:text=The%20tag%20is%20just,in%20the%20CSS.
Replace html.P(self.title)
with html.Label(self.title)
for all form components (dropdown, checklist, etc.) and where applicable
No response
vizro
0.1.9
3.9
No response
Is there a vizro component that allows the edition of a data table?
Or would it be possible (easy) to create such a component?
No response
I would like to write a small app based on two small tables.
The user would need to fill in this table.
0.1.7
3.11.5
macOS-14.2-arm64-arm-64bit
More generally though I think we're getting to the point where we need to figure out what the default/app.py
is for, since we have a few different things we're interested in:
At the moment these are all served by the same default/app.py
but that's probably not good in the longer term and we need some new example dashboards which have different responsibilities. We should also re-consider whether we want the yaml/json/dict versions and what they should contain.
Originally posted by @antonymilne in #114 (comment)
The vm.Graph sample doesn't work:
https://vizro.readthedocs.io/en/stable/pages/user_guides/graph/
No response
0.1.7
3.11.5
Mac OS Sonoma 14.2
Copy the sample to app.py and run
python app.py
It returns this error message:
AttributeError: 'DataFrame' object has no attribute 'iteritems'
(might be due to pandas version 2.0.3?)
Important
All the below is based on some very quick glancing through of recently run Actions. Before making any changes we should look properly at how long these jobs take and which jobs seem redundant.
I want our CI to remain super fast and slick. At the moment it's not too bad but there are several things I think could be optimised.
Let's start with the most blatant offender and probably easiest to fix, which seems to be windows integration tests. Very roughly it looks like these can take 6-8 mins when all other jobs take a maximum of 3 mins.
Currently we run integration tests on the following matrix:
vizro/.github/workflows/test-integration-vizro-core.yml
Lines 29 to 30 in 1cfa247
Things to ponder:
Probably it's not really worthwhile covering all versions of Python on Windows but since they seem to be run in parallel, the actual number of jobs doesn't make a big difference I think, just the speed of each one.
My first question when I saw vizro
release note and docs was: "How is it different from streamlit
and dash
"?
I asked this question on slack, and thanks for the reply! Though I clearly see that many other users are asking for exactly the same thing. So that is probably a good sign that there should be a separate dedicated page in the docs elaborating on this particular comparison.
This would allow users to understand when to choose vizro
over the other two mentioned framework, and in general advertise the product.
The best reference that comes to mind is this comparison of neptune
with mlflow
.
Another example is... kedro-mlflow
plugin docs that compare kedro
with mlflow
.
Hopefully that helps, and I believe that this addition to documentation helps vizro
grow.
Currently our tests show any deprecation warnings raised during running but these are easy to miss and I expect everyone ignores them (I do anyway). Let's get stricter about this so (a) we don't miss future deprecations in our dependencies that could break us and (b) our users aren't bothered by deprecation warnings.
This applies to both vizro-ai
and vizro-core
, though could be done in two separate PRs if easier.
filterwarnings = "error"
to tool.pytest.ini_options
in pyproject.toml
See https://docs.pytest.org/en/7.1.x/how-to/capture-warnings.html for more guidance.
First of all congratulations for the very good work! I wanted to try the demo you linked, but unfortunately the app page doesn't get scaled in mobile browsers. All you can see is the sidebar
The dashboard should be responsive and scale according to the screen size.
Latest
Android 12
Is it possible to use multiple datasets for custom graphs? Right now, you have to create a function with @capture
and data_frame
as an argument, but what, if I want to use two datasets so it can also play nicely with the filter from vizro.
No response
No response
No response
No response
No response
Currently when using parameters it is impossible to use None
as this is forbidden by pydantic types
Ability to allow parameters to take None
as value
Pydantic validation forbids any feasible work arounds
None required
I have some markdown text that I would like to have be colored red/green (percentual growth). How to accomplish this with vm.Card?
components=[
vm.Card(
text=f"""
#### Dagelijkse virtuele bundel sales
Gemiddelde groei in sales 2 maanden vóór en ná de kortingsverhoging:
Absoluut (voor): 709 Absoluut (na): 710
Gecorrigeerd (voor): 709 Gecorrigeerd (na): 710 <p style="color: green">(+1.5%)</p>
"""
),
...
For example, it's not possible right now to add HTML in the Markdown, eg: <p style="color: green">(+1.5%)</p>
0.1.7
3.10
Ubuntu 22.04
I'd like to have a date filter, so I can filter to a certain date range.
I'd expect a "Start date" and "End date" filter to show up.
In our case, we only need to filter per month, so I can create a dropdown to filter to a certain month. However that is not very flexible.
In our case we've got a MongoDB and I use pymongo to retrieve the data, which converts date values to date objects.
Currently, there is no text input feature similar to Streamlit's chatbox in place
Create the custom component to recieve text
This would help teams create natural language applications using vizro
Enabling users to input SQL queries for data retrieval can significantly enhance the utility of data connectors. This feature would allow for the generation of dynamic dashboards that can be customized according to user-defined queries as texts.
The following functionality from https://dash.plotly.com/dash-core-components/textarea#textarea-properties will suit text-based input.
from dash import Dash, dcc, html, Input, Output, callback
app = Dash(__name__)
app.layout = html.Div([
dcc.Textarea(
id='textarea-example',
value='Textarea content initialized\nwith multiple lines of text',
style={'width': '100%', 'height': 300},
),
html.Div(id='textarea-example-output', style={'whiteSpace': 'pre-line'})
])
@callback(
Output('textarea-example-output', 'children'),
Input('textarea-example', 'value')
)
def update_output(value):
return 'You have entered: \n{}'.format(value)
A different approach would be to have dropdown menus where the user could select the list of tables and filters and we generate the query in the backend.
I was thinking of implementing a component like the following. I haven't tested it yet, but will work on such a solution.
from typing import Optional
from dash import ClientsideFunction, Input, Output, State, clientside_callback, dcc, html
from pydantic import Field, validator
from vizro.models import Action, VizroBaseModel
from vizro.models._action._actions_chain import _action_validator_factory
from vizro.models._models_utils import _log_call
class Textarea(VizroBaseModel):
"""Textarea component for Vizro.
Can be provided to [`Filter`][vizro.models.Filter] or
[`Parameter`][vizro.models.Parameter]. Based on the underlying
[`dcc.Textarea`](https://dash.plotly.com/dash-core-components/textarea).
Args:
value (Optional[str]): Default value for textarea. Defaults to `None`.
title (Optional[str]): Title to be displayed. Defaults to `None`.
actions (List[Action]): See [`Action`][vizro.models.Action]. Defaults to `[]`.
"""
value: Optional[str] = Field(None, description="Default value for textarea.")
title: Optional[str] = Field(None, description="Title to be displayed.")
actions: List[Action] = []
# Validator for actions, if needed
_set_actions = _action_validator_factory("value")
@_log_call
def build(self):
output = [Output(f"{self.id}_output", "children")]
inputs = [Input(f"{self.id}_textarea", "value")]
clientside_callback(
ClientsideFunction(namespace="clientside", function_name="update_textarea_output"),
output=output,
inputs=inputs,
)
return html.Div(
[
html.P(self.title) if self.title else None,
dcc.Textarea(
id=f"{self.id}_textarea",
value=self.value,
style={'width': '100%', 'height': 300},
),
html.Div(
id=f"{self.id}_output",
style={'whiteSpace': 'pre-line'}
),
],
className="textarea_container",
id=f"{self.id}_outer",
)
Im using a Google Colab Notebook due to my need to access a BigQuery instance in which I dont have access to other than via login with a google account.
Im not so sure how to make it work. Using the following snippet doesnt work as expected
Vizro().build(dashboard=dashboard).run()
No response
No response
No response
No response
No response
Google doesn't recognise underscores as word separators when it indexes pages. So if we have a page called first_dashboard
then Google will report that as firstdashboard
to its algorithm. (If we had first-dashboard
then it would go into the mix as first dashboard
which earns more google juice for the keywords "dashboard"). More explanation here
As we are at an early stage with Vizro, we can make some changes (and use RTD redirects to ensure we don't break anyone's links) that set the docs up for success later. SEO doesn't seem that important but every little helps.
Hi, how can i built grouped charts?
In example, i want to built a bar chart with not pure Price, i want to do it with Sum of Price or Mean of Price for this years which places at x-axis.
But in Selector i want to filter pure Dataframe for a prices in example (and after built grouped chart)
df = df[["brand", "year", "price"]]
components=[
vm.Graph(
id="win_time_graph",
figure=px.bar(
data_frame = df,
x="year",
y="price",
color="brand",
),
),
---> i want to built MEAN of prices for every Year
No response
last
3.11
win 10
The below example does not set the slider default (3) properly. It seems that the custom action on_page_load
fetches the minimum.
import vizro.models as vm
import vizro.plotly.express as px
from vizro import Vizro
from vizro.models.types import capture
@capture("graph")
def scatter_with_line(data_frame, x, y, color=None, size=None, hline=None):
fig = px.scatter(data_frame=data_frame, x=x, y=y, color=color, size=size)
fig.add_hline(y=hline, line_color="gray")
return fig
page_0 = vm.Page(
title="Custom chart",
components=[
vm.Graph(
id="enhanced_scatter",
figure=scatter_with_line(
x="sepal_length",
y="sepal_width",
color="species",
size="petal_width",
hline=3,
data_frame=px.data.iris(),
),
),
],
controls=[
vm.Parameter(
targets=["enhanced_scatter.hline"],
selector=vm.Slider(min=2, max=5, step=1, value=3, title="Horizontal line"),
),
],
)
dashboard = vm.Dashboard(pages=[page_0])
Vizro().build(dashboard).run()
How can I modify the card text based on a value selected in a Dropdown filter?
For example below is how my basic Vizro app looks:
How can I target my CustomCard to change text when I select another value in my Merk brand filter?
class CustomCard(vm.Card):
type: Literal['custom_card'] = 'custom_card'
def build(self):
card_build_obj = super().build()
# Overwrite default settings - card_build_obj[self.id] fetches the underlying dcc.Markdown
card_build_obj[self.id].dangerously_allow_html = True
card_build_obj[self.id].mathjax = True
return card_build_obj
vm.Page.add_type("components", CustomCard)
@capture("graph")
def chart_daily_bundle_sales_brand(
data_frame: pd.DataFrame,
x: PandasField = None,
y: PandasField = None,
title: ChartTitle = None
):
fig = go.Figure()
fig.add_trace(
go.Scatter(
x=data_frame[x].dt.date,
y=data_frame[y],
mode="lines",
name="Absolute aantal",
)
)
fig.update_layout(title=title, title_x=0.25, hovermode="x unified", legend=dict(x=0, y=1.1, traceorder="normal", orientation="h"))
fig.update_xaxes(type="category", tickangle=55)
return fig
@capture("graph")
def chart_daily_bts_ratios_brand(
data_frame: pd.DataFrame,
x: PandasField = None,
y: PandasField = None,
title: ChartTitle = None
):
fig = go.Figure()
fig.add_trace(
go.Scatter(
x=data_frame[x].dt.date,
y=data_frame[y],
mode="lines",
name="Merk bundle-to-single verhouding"
)
)
fig.update_layout(title=title, title_x=0.25, yaxis_title="%", hovermode="x unified", showlegend=False)
fig.update_xaxes(type="category", tickangle=55)
return fig
page_brand = vm.Page(
title="Merk",
layout=vm.Layout(
grid=[
[0, 1, 2, 3],
[4, 4, 4, 4],
[5, 5, 5, 5],
[6, 6, 6, 6],
],
row_min_height="200px"
),
components=[
CustomCard(
text=f"""
#### Dagelijkse virtuele bundel sales
Gemiddelde groei in sales 2 maanden vóór en ná de kortingsverhoging:
**Absoluut** (voor): {mean_virtual_bundle_sales_pre_discount_change}<br>
**Absoluut** (na): {mean_virtual_bundle_sales_post_post_discount_change}<br>
"""
),
CustomCard(
text=f"""
#### Dagelijkse harde bundel sales
Gemiddelde groei in sales 2 maanden vóór en ná de kortingsverhoging:
**Absoluut** (voor): {mean_hard_bundle_sales_pre_discount_change}<br>
**Absoluut** (na): {mean_hard_bundle_sales_post_discount_change}<br>
"""
),
CustomCard(
text=f"""
#### Dagelijkse bundel-to-single ratio
Gemiddelde bundel-to-single ratio 2 maanden vóór en ná de kortingsverhoging:
**Voor**: {mean_bts_ratio_pre_discount_change}%<br>
**Na**: {mean_bts_ratio_post_discount_change}%
"""
),
CustomCard(
text="""
#### Correctie
Kortingsverhoging: **2023-10-17**<br>
Black Friday: **2023-11-17** t/m **11-27** <br>(verwijderd om bias te mijden)
"""
),
vm.Graph(
id="daily_virtual_bundle_sales_brand",
figure=chart_daily_bundle_sales_brand(
ts_daily_vh_bundle_sales_brand_df,
x="date",
y="quantity_virtual_bundles",
title="Sold <b>virtual</b> bundles"
)
),
vm.Graph(
id="daily_hard_bundle_sales_brand",
figure=chart_daily_bundle_sales_brand(
ts_daily_vh_bundle_sales_brand_df,
x="date",
y="quantity_hard_bundles",
title="Sold <b>hard</b> bundles 2"
)
),
vm.Graph(
id="daily_bts_ratios_brand",
figure=chart_daily_bts_ratios_brand(
ts_daily_vh_bundle_sales_brand_df,
x="date",
y="bts_ratio",
title="Bundel-to-single ratio",
)
),
],
controls=[
vm.Filter(column="discount_change", selector=vm.Dropdown(title="Discount change")),
vm.Filter(column="brand", selector=vm.Dropdown(title="Merk")),
]
)
No response
0.1.7
3.10
Linux
Hi there!
As far as I know, the only way to create a clicktable container/button to switch to another Page is to use a Card, and use the href
parameter.
I was wondering if this was possible to do the same thing using Button instead of Card ? The Button design seems a bit more user-friendly. At the moment, Button needs to take an action as an input, but the only two actions available are filter actions, or data exports, so I haven't found a way to do this.
Thank you!
No response
No response
No response
No response
No response
How to create login user for vizro toolkit dashboard?
No response
No response
vizro
No response
python3.8
ubuntu
vizro
Perhaps there is a way already to do it, but I want the user to be able to select a file on the local computer and use it for analysis. I was hoping that there was a "vizro" object to do uploads, but I can't find one. Lacking that, can one somehow include a dcc object, such as Upload, into a "vizro" app? I saw one place that said one vizro object was "a thin wrapper" on a dcc object, but I don't know if there is someway for me to do that. Also lacking that, could I make a multipage app where I could have a dcc Update on a separate page or perhaps as a dropdown? If not, I think you really should have an "Upload" object or some object that includes that functionality.
I described ideally want to do Upload in a vizro object in the "What's the problem" section above.
I described alternative solutions in the "What's the problem" section above.
Is there a vizro forum for discussing this sort of issue? I looked at the "dash" forum, but it only seemed to mention vizro in one post.
I find this tool very easy to use but what I want is add a refresh icon or update each second to get the real time data to monitor the resource usuage.
when get the data from data source, i.e. call a function, refresh the data every second.
None
None
I'd like to dynamic change the selector options according to the another selector.
for example:
I use titanic_data to set dropdown list:
first dropdown is pclass , it's including 1,2,3
second dropdown is deck it's including A,B,C,D,E,F,G
What I want is when select plass=2 on the first dropdown, the second dropdown only show D,E,F
because there are only deck D,E,F on pclass=2
This function can be done by callback in dash/plotly.
How can I achieve this function inVizro? Please advise, thank you!
No response
No response
No response
No response
No response
The Homepage on https://vizro.mckinsey.com/ is currently written entirely manually but follows a very clear formula. Following #176 we now have a field Page.description
and so all of the ingredients are in place with the exception of the page image. Somehow we should make it possible to automatically generate such a homepage. In theory this sounds pretty easy to do.
Major considerations
HomePage
model that subclasses Page
? A Homepage
model that includes a Page
model? Just some Python helper functions? We'd like to follow our paradigm of extensibility and customisability and enable something that's possible from YAML too 🤔Navigation
and different ways of grouping pages in hierarchy?Minor considerations
Page.image
field that's also used in meta tags (originally existed in #176 but removed)? Or to automatically pick up an image with filename page.id
? Could we generate preview images of the pages automatically as discussed in final point of this comment and subsequent responses?This is a good issue for anyone interested in docs to the point of applying a style guide to some markdown. There's no rewriting required (just small tweaks) and no knowledge of Vizro is expected.
I think the core docs (and probably vizro-ai docs too) could benefit from a minor edit to improve their readability. This would involve the following steps:
When trying to export xlsx file using actions, console error occurs
Traceback (most recent call last):
File "/Users/o/PycharmProjects/vizro/vizro-core/src/vizro/models/_action/_action.py", line 80, in callback_wrapper
return_value = self.function(**inputs) or {}
File "/Users/o/PycharmProjects/vizro/vizro-core/src/vizro/models/types.py", line 59, in __call__
return self.__function(**bound_arguments.arguments)
File "/Users/o/PycharmProjects/vizro/vizro-core/src/vizro/actions/export_data_action.py", line 61, in export_data
callback_outputs[f"download-dataframe_{target_id}"] = dcc.send_data_frame(
File "/Users/o/anaconda3/envs/w3af/lib/python3.8/site-packages/dash/dcc/express.py", line 91, in send_data_frame
return _data_frame_senders[name](writer, filename, type, **kwargs)
File "/Users/o/anaconda3/envs/w3af/lib/python3.8/site-packages/dash/dcc/express.py", line 32, in send_bytes
content = src if isinstance(src, bytes) else _io_to_str(io.BytesIO(), src, **kwargs)
File "/Users/o/anaconda3/envs/w3af/lib/python3.8/site-packages/dash/dcc/express.py", line 58, in _io_to_str
writer(data_io, **kwargs)
File "/Users/o/anaconda3/envs/w3af/lib/python3.8/site-packages/pandas/core/generic.py", line 2252, in to_excel
formatter.write(
File "/Users/o/anaconda3/envs/w3af/lib/python3.8/site-packages/pandas/io/formats/excel.py", line 934, in write
writer = ExcelWriter( # type: ignore[abstract]
File "/Users/o/anaconda3/envs/w3af/lib/python3.8/site-packages/pandas/io/excel/_openpyxl.py", line 56, in __init__
from openpyxl.workbook import Workbook
ModuleNotFoundError: No module named 'openpyxl'
No response
0.1.3
3.8
Mac OS
No response
If we create path="/page page"
for any page it will be available in browser like /page-page
.
At the same time if we create Card.href="/page page"
we'll get 404 during page opening.
Looks like to synchronise this values we should apply same validation for href
and path
No response
vizro
0.1.8
3.9
Mac OS
path="/page page"
Card.href="/page page"
Card
on the second page.No response
Use Latex in Markdown. dcc.Markdown supports MathJax: https://dash.plotly.com/dash-core-components/markdown#latex
Use Latex in Markdown of vm.Card to format my formulas
AttributeError Traceback (most recent call last)
7 from vizro_ai.chains import ModelConstructor
8 from vizro_ai.chains._llm_models import LLM_MODELS
----> 9 from vizro_ai.components import (
10 GetChartSelection,
11 GetCodeExplanation,
12 GetCustomChart,
13 GetDataFrameCraft,
14 GetDebugger,
15 GetVisualCode,
16 )
17 from vizro_ai.utils import _safeguard_check
...
---> 35 if field and field.field_info.description:
36 prop["description"] = field.field_info.description.split("\n")[0]
37 else:
AttributeError: 'FieldInfo' object has no attribute 'field_info'
Please can you help here.
It should have outputted the version
0.1.0
3.11.4
Windows
Install package using pip install vizro_ai
Run the below program
from vizro_ai import VizroAI
print(VizroAI.version)
No response
@maxchristlmck raised that he would like to have the ability to create grouping headers for the controls with a horizontal ruler in place, see this draft PR: #81
Ability to add control headers and horizontal rulers
Typically, organizations need to control access to data dashboards to ensure only trusted stakeholders can view the information.
Authentication and authorization are the mechanisms most commonly used to provide access control. It is possible to leverage an existing authentication framework in the Python ecosystem and build an authorization mechanism for per-dashboard, chart, and query/data source control (depending on the desired granularity).
VPN is an alternative but is typically less user-friendly while still leaving the possibility of accidentally exposing dashboards on public-facing URLs.
Plotly Dash enterprise demonstrates the need for authentication/authorization. The package django-plotly-dash shows one example of integrating Plotly Dash in a framework with inbuilt authentication/authorization mechanisms.
We routinely tackle questions about plotly and it would be useful to have some standard answers (e.g. FAQs) or a document that guides readers. We may also be able to better link through to plotly docs in our content.
Make a list of common queries and answer these as standard FAQ. This may go into docs or maybe just as a pinned post on our (internal) slack channel or elsewhere (e.g. in our repo).
Investigate plotly docs and see if we can better build on them to help our users understand their content.
Extension task: Research if there is any scope for a contribution back to plotly e.g. if we spot a way to improve their docs nav/discoverability?
When using a card and a graph on the same page, the space is distributed equally. What setting do you need to apply to make the card smaller.
components=[
vm.Card(
text="""
### Card Title
text
"""
),
vm.Graph(
id="val_stocks",
figure= code to get some figure
),
),
No response
0.1.3
No response
MacOs
Ty Petar, please consider supporting polars, I think it is necessary, given that the whole point of vizro is working with a dataframe in memory. Currently vizro cannot determine polars column names (detects them as [0,1,2,3,4...])
Originally posted by @vmisusu in #191 (comment)
I'm opening this issue to see whether other people have the same question so we can figure out what priority it should be. Just hit 👍 if it's something you'd like to see in vizro and feel free to leave and comments.
The current situation (25 January 2024) is:
to_pandas
method, and as of 5.16 it supports dataframes that follow the dataframe interchange protocol (which is now pip install
able)to_pandas
call. The biggest changes we'd need to make would be to actions code like filtering functionality (FYI @petar-qb). I don't think it would be too hard, but it's certainly not a small task eitherSee also How Polars Can Help You Build Fast Dash Apps for Large Datasets
From @Coding-with-Adam:
Chad had a nice app that he built to compare between pandas and polars and show the difference when using Dash. https://dash-polars-pandas-docker.onrender.com/ (free tier)
I also made a video him: https://youtu.be/_iebrqafOuM
And here’s the article he wrote: Dash: Polars vs Pandas. An interactive battle between the… | by Chad Bell | Medium
FYI @astrojuanlu
One of the cool features of Dash Pages is that it’s easy to update the meta tags for each page. This is good for SEO and creating nice looking preview cards when sharing a link on social media.
Currently with the Vizro demo app, only the title is included in the meta tags. Here's what the link preview looks like:
However, Dash Pages will update the meta tags with an image and description if supplied. For example, see the Dash Example Index. It has over 100 pages, each with it's own title, description and image:
It's easy to enable this feature in Vizro. Simple include (an optional) description
, image
, and image_url
parameter in the Page
.
I could do a pull request if you would like this feature enabled. I got it working locally. You can't see what the link looks like until the app is deployed , but when inspecting the browser, you can see that the meta tags now include an image and description.
No
None at this time.
ValidationError: 1 validation error for Graph
figure
Component with id=scatter_chart already exists and is mapped to dataset 140638475834896. Components must uniquely map to a dataset across the whole dashboard. If you are working from a Jupyter Notebook, please either restart the kernel, or use 'from vizro.managers import data_manager; data_manager._reset()`. (type=value_error)
'from vizro.managers import data_manager; data_manager._reset()`. After I follow the instruction and rerun the cell, I run into a new error.
DuplicateIDError: Model with id=scatter_chart already exists. Models must have a unique id across the whole dashboard. If you are working from a Jupyter Notebook, please either restart the kernel, or use 'from vizro.managers import model_manager; model_manager._reset()`.
After I run 'from vizro.managers import model_manager; model_manager._reset()`, no error is raised but it doesn't show the dashboard UI anymore.
I expect the dashboard render properly. Workaround is restart the Kernel which work fine but is considerably slower.
0.1.4
3.8.5
MacOS
Follow the tutorial and run it in a notebook twice.
https://vizro.readthedocs.io/en/stable/pages/tutorials/first_dashboard/#4-explore-further
No response
Currently only the plotly.expres can use the dataframes from data_manager directly. If we want to create a custom plot using plotly.graph_objects it's not possible due data_manager not have a public method to acces the added dataframes.
Add a wrapper for plotly.graph_objects as vizro.plotly.express has
A temporal solution could be add a public method to data_manager that returns a copy of the the dataframe to be used en go.
Rough notes for now... A few somewhat related problems:
page.build
call is required to generate slider callbacks - could be solved by moving callback definition to pre_build
but then it's dash-dependentregister_page
call live? See #74 (comment)dash.page_registry
or model manager as the source of truth? How do they relate?If you configure sliders with big numbers and change it using input field you'll get an error:
Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside
componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent
infinite loops.
No response
0.1.7
3.9
Mac
RangeSlider(step=1000000.0, min=1000000, max=10000000)
for pop
columnNo response
At the moment, using Vizro in a Jupyter notebook may feel annoying when re-evaluating cells, because
ID
causes the an error.model_manager
(MM), thus creating a situation where models are in the MM that are not used within the dashboardSolving this may entail multiple levels of investigation/considerations. See also #56 for some notes and code around this issue.
Short term solution
In the short term, #59 ensures that users get a more comprehensive error message when working in Jupyter.
Note that this does not catch all cases, as a cell could also not contain a model with manual ID
, thus never triggering an error that catches the additional models added to the MM.
Medium term solution
_items_with_type
_items_with_type
in particular should not be a wild card search to any type, but if at all search for a Dashboard
, all subsequent scans should be hierarchical and on a per need basisLong term solution
Idea 1
Reasoning from @antonymilne as to why this is NOT a no-brainer:
I think this is one of the disadvantages of the recursive approach to registering models in the model manager. Let’s say you go for the recursive approach like this:
- call dashboard.register that recursively registers all models
- pre_build uses models existing in model manager
- pre_build can itself create models
- if we want those models to also be registered in the model manager then we need to somehow register them e.g. by manually calling selector.register or by re-running dashboard.register after the pre-build
This step 4 with the extra manual registration stage is a bit ugly, annoying and easy to forget, whereas if it’s done automatically upon model instantiation it’s not required at all.
tbh the current solution with pre_build creating models is also not very satisfactory, as described in the comment:
# Note that a pre_build method can itself add a model (e.g. an Action) to the model manager, and so we need to
# iterate through set(model_manager) rather than model_manager itself or we loop through something that
# changes size.
# Any models that are created during the pre-build process *will not* themselves have pre_build run on them.
# In future may add a second pre_build loop after the first one.
Overall if we do want to change how components are registered in the model manager then we’d need to think about it in combination with pre_build. Hopefully there’s some better overall solution, but I don’t think we can change one without thinking about the other at the same time. I’d love if we could come up with an improvement here, but I don’t think there’s going to be an easy solution.
Idea 2
context_manager
that associates every model with a dashboardIdea 3
This is partly a learning exercise for me as I've not used mkdocs before, but also because it would be nice to start to use the Vizro branding across our content where possible. The goal is to set up the favicon to enhance the docs beyond the standard logo, which seems relatively straightforward.
Quick and easy - do for both vizro-core
and vizro-ai
:
matrix
on Github actions, we currently test on python-version
up to and including 3.11. Let's add 3.12 to the listclassifiers
in pyproject.toml
[[envs.all.matrix]]
Could be difficult but I don't expect it will be necessary, at least for vizro-core:
Enable developers to portray the significance behind a particular x (or y) value
A simple mechanism for a developer to add a vertical (or horizontal) line to a given px.line
figure. Please see the green line in the screenshot as an example of the expected output.
I attempted multiple different parameter configurations of the fig.add_vline
function as indicated in the plotly docs
my_figure = px.line(
df_gapminder,
x="year",
y="gdpPercap",
color="data",
labels={"year": "Year", "data": "Data", "gdpPercap": "GDP per capita"},
color_discrete_map={"Country": "#afe7f9", "Continent": "#003875"},
markers=True,
)
my_figure.add_vline(1970)
# my_figure.add_vline(x=1970)
# my_figure.add_vline(x=1970, line_width=3)
# my_figure.add_vline(x=1970, line_width=3, line_dash="dash")
# my_figure.add_vline(x=1970, line_width=3, line_dash="dash", line_color="green")
As noted in the docs, this appears to be a feature implemented by plotly. I'm curious if:
Following up on: #205 (comment)
Currently, the dashboard looks off if people try to add their dbc.themes as external stylesheets as our components are not only based on dbc components.
Available vizro stylesheets are currently accessible via dashboard.theme
but the process for the user to add their own themes is not as straight-forward as dbc-themes. This issue opens several questions:
Originally posted by @antonymilne in #114 (comment)
Just from quickly playing around with the the example dashboard here, I prefer the AG Grid. I wonder whether we should be recommending that instead of Dash data table as the default table for people to use in the (I guess) most common case that someone just wants to draw a nice table?
I'd guess some of these you can probably also achieve with Dash data table by using appropriate styling parameters or arguments though?
These are just my impressions from playing around for a few seconds though, so don't take them too seriously - it's the first time I've used both sorts of table, so I don't know what each is capable of or how easily we can get all the features we want out of each. But curious what other people think - should Dash data table or AG Grid be the "default" table that we suggest people to use?
Does anyone know anything about the error <ContextVar name='callback_context' at 0x7f78465b2f90>
when trying to run a dashboard in jupyterHub?
Originally posted by @LucaYoy in #109 (comment)
my version of Vizro: 0.1.0
Here is my code:
I'd like from vizro.tables import dash_data_table
but the terminal will pop up the error: ModuleNotFoundError: No module named 'vizro.tables'
No response
No response
No response
No response
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.