Skip to content

Commit

Permalink
* Rename to vizro.figures.library
Browse files Browse the repository at this point in the history
* Add note to API docs
  • Loading branch information
antonymilne committed Aug 2, 2024
1 parent c834ed5 commit 05c4081
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
5 changes: 5 additions & 0 deletions vizro-core/docs/pages/API-reference/figure-callables.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
API reference for all pre-defined [`CapturedCallable`][vizro.models.types.CapturedCallable] figure functions to be used in the
[`Figure`][vizro.models.Figure]. The [how-to guide on figures](../user-guides/figure.md) contains more information.

Identical functions can also be used outside the Vizro framework in a pure Dash app by importing from the `vizro.figures.library` namespace:
```python
from vizro.figures.library import kpi_card, kpi_card_reference
```

::: vizro.figures
options:
show_source: true
Expand Down
5 changes: 2 additions & 3 deletions vizro-core/examples/scratch_dev/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@
import dash_bootstrap_components as dbc
import pandas as pd
from dash import Dash, html
from vizro.figures.unwrapped import kpi_card, kpi_card_reference
from vizro.figures.library import kpi_card, kpi_card_reference

df_kpi = pd.DataFrame({"Actual": [100, 200, 700], "Reference": [100, 300, 500], "Category": ["A", "B", "C"]})

# Add single CSS file figures.css or
base = "https://cdn.jsdelivr.net/gh/mckinsey/vizro@tidy/create-module-pure-functions/vizro-core/src/vizro/static/css/"
vizro_bootstrap = base + "vizro-bootstrap.min.css"
vizro_css = base + "figures.min.css"

# Add entire assets folder from Vizro
app = Dash(
Expand Down Expand Up @@ -58,7 +57,7 @@
),
],
# Note: They need to add vizro_light here
# className="vizro_light",
className="vizro_light",
),
]
)
Expand Down
2 changes: 1 addition & 1 deletion vizro-core/src/vizro/figures/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from vizro.figures.kpi_cards import kpi_card, kpi_card_reference
from vizro.figures._kpi_cards import kpi_card, kpi_card_reference

# Please keep alphabetically ordered
__all__ = ["kpi_card", "kpi_card_reference"]
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@

kpi_card = kpi_card.__wrapped__
kpi_card_reference = kpi_card_reference.__wrapped__


def f(a):
"""Blah blahblah"""
pass


__all__ = ["kpi_card", "kpi_card_reference", "f"]
4 changes: 0 additions & 4 deletions vizro-core/src/vizro/figures/unwrapped/__init__.py

This file was deleted.

0 comments on commit 05c4081

Please sign in to comment.