Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable dash datatable #114

Merged
merged 99 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
642ec46
Bring over changes from old repo
huong-li-nguyen Sep 28, 2023
a300631
Add notes
huong-li-nguyen Oct 10, 2023
3c45787
Add comments which code sections are plotly specific
huong-li-nguyen Oct 10, 2023
16516f7
Add more thoughts
huong-li-nguyen Oct 11, 2023
6ad33ca
Update scratch.py
huong-li-nguyen Oct 11, 2023
3bd9e48
Clean up
huong-li-nguyen Oct 11, 2023
c494fcb
Comment out d3 changes
huong-li-nguyen Oct 11, 2023
caf154a
Merge branch 'main' into feature/table_component_MS
maxschulz-COL Oct 12, 2023
5aa22b0
Revert table CSS (for now)
maxschulz-COL Oct 13, 2023
e3a08b6
Update refactoring places
maxschulz-COL Oct 13, 2023
53e3124
UPdate example
maxschulz-COL Oct 13, 2023
447f9af
Abstracting several plotly dependent methods
maxschulz-COL Oct 16, 2023
ad363b7
Improvement to abstraction level
maxschulz-COL Oct 16, 2023
bc16ba5
Further abstraction
maxschulz-COL Oct 16, 2023
e84fcb7
implement hasattr logic more
maxschulz-COL Oct 16, 2023
f2376ed
Individually comment out CSS
maxschulz-COL Oct 16, 2023
6fc5c78
further abstraction of update theme
maxschulz-COL Oct 16, 2023
b83ec59
Simplify update layout even further
maxschulz-COL Oct 16, 2023
b2b2b29
Fix table CSS
maxschulz-COL Oct 17, 2023
b38b8b4
Avoid jumping
maxschulz-COL Oct 17, 2023
fc87121
interaction example
maxschulz-COL Oct 17, 2023
6ad35de
Private attributes for input properties
maxschulz-COL Oct 17, 2023
8ff80c7
Take out hover behaviour on dark
maxschulz-COL Oct 17, 2023
5a7ffe9
Table CSS
maxschulz-COL Oct 17, 2023
51bcd91
reminder
maxschulz-COL Oct 17, 2023
5d080c3
Try out AGGrid
maxschulz-COL Oct 17, 2023
ac58e28
Delete unnecessary files
maxschulz-COL Oct 17, 2023
381514b
Enable proper capture decorator
maxschulz-COL Oct 17, 2023
05f19c6
remove scratch
maxschulz-COL Oct 17, 2023
5168a6f
Clean up comments
maxschulz-COL Oct 17, 2023
edd0386
Mypy lint including ModelID
maxschulz-COL Oct 18, 2023
77719b7
General lint
maxschulz-COL Oct 18, 2023
652ab17
Clean up table
maxschulz-COL Oct 18, 2023
322202b
Docstring
maxschulz-COL Oct 18, 2023
2db779d
Enable datatable properly
maxschulz-COL Oct 18, 2023
6cc33be
Schema
maxschulz-COL Oct 18, 2023
178559e
Demo callable Card.text
antonymilne Oct 19, 2023
81879eb
Revert "Demo callable Card.text"
antonymilne Oct 19, 2023
0f931fb
Improve table build
maxschulz-COL Oct 19, 2023
a4648cc
Merge branch 'feature/table_component_MS' of github.com:mckinsey/vizr…
maxschulz-COL Oct 19, 2023
96741c1
Showcase bound_arguments interference with kwargs
maxschulz-COL Oct 19, 2023
b4b4e6b
Warning to table fix
maxschulz-COL Oct 19, 2023
2a5db2b
Explanation for kwargs behaviour
maxschulz-COL Oct 19, 2023
997bed4
Fixing decorator again
maxschulz-COL Oct 19, 2023
7b6dadc
Delete metadata
maxschulz-COL Oct 19, 2023
4ca792a
add unit test for erronous binding behaviour
maxschulz-COL Oct 19, 2023
809a883
Add callable component private attribute
maxschulz-COL Oct 20, 2023
95e4d16
Add reusable validator
maxschulz-COL Oct 20, 2023
846b346
Add unit test to check on arguments
maxschulz-COL Oct 20, 2023
f2d4db4
Move theme switch back to page
maxschulz-COL Oct 20, 2023
459f037
lint
maxschulz-COL Oct 20, 2023
8d89d30
remove input property from graph
maxschulz-COL Oct 20, 2023
1da2585
Change _callable_component to string + add to page
maxschulz-COL Oct 20, 2023
3aefc06
Lint
maxschulz-COL Oct 20, 2023
fda85b0
Cleanup
maxschulz-COL Oct 23, 2023
95448f7
Move table to correct import path
maxschulz-COL Oct 23, 2023
4bf294e
Fix docs
maxschulz-COL Oct 23, 2023
60f3963
Add import path
maxschulz-COL Oct 23, 2023
fa055a5
Remove callable_component and add figure to table
maxschulz-COL Oct 23, 2023
5548fa2
Add unit tests
maxschulz-COL Oct 23, 2023
3329484
Lint
maxschulz-COL Oct 23, 2023
9131a25
Merge branch 'main' into feature/table_component_MS
maxschulz-COL Oct 23, 2023
ebc1d18
Fix tests
maxschulz-COL Oct 23, 2023
60c456d
Add documentation
maxschulz-COL Oct 23, 2023
c8cbdf7
Cleanup
maxschulz-COL Oct 23, 2023
7670eab
dropdown css bugfix
nadijagraca Oct 24, 2023
205b759
First round of PR comments
maxschulz-COL Oct 25, 2023
ab5d738
Table styling and default setting
maxschulz-COL Oct 25, 2023
ff3f9ff
Update docs and remove comments
maxschulz-COL Oct 25, 2023
7632ea7
adjusting tests to keep up with code change
maxschulz-COL Oct 25, 2023
369d63f
Lint
maxschulz-COL Oct 25, 2023
6ce1015
Fix overflow of table
huong-li-nguyen Oct 25, 2023
bc494e5
Merge branch 'feature/table_component_MS' of https://github.com/mckin…
huong-li-nguyen Oct 25, 2023
5f4c46b
PR comments
maxschulz-COL Oct 25, 2023
22c85c9
Merge branch 'main' into feature/table_component_MS
maxschulz-COL Oct 25, 2023
b75d2bf
Improve table docs
maxschulz-COL Oct 25, 2023
167b506
Merge branch 'main' into feature/table_component_MS
maxschulz-COL Oct 25, 2023
30aa168
Change test
maxschulz-COL Oct 25, 2023
5a6d6a8
Merge branch 'feature/table_component_MS' of github.com:mckinsey/vizr…
maxschulz-COL Oct 25, 2023
5669c12
Update vizro-core/src/vizro/models/_components/table.py
maxschulz-COL Oct 26, 2023
2b7d936
Update vizro-core/src/vizro/static/css/dropdown.css
maxschulz-COL Oct 26, 2023
7aa773e
Update vizro-core/src/vizro/static/css/table.css
maxschulz-COL Oct 26, 2023
c1c442f
Update vizro-core/src/vizro/static/css/dropdown.css
maxschulz-COL Oct 26, 2023
e2c346e
Update vizro-core/src/vizro/static/css/dropdown.css
maxschulz-COL Oct 26, 2023
3fb1155
Lint
maxschulz-COL Oct 26, 2023
2617b9b
Add custom table example
maxschulz-COL Oct 26, 2023
e39e603
PR comments
maxschulz-COL Oct 27, 2023
55a55f0
PR comments
maxschulz-COL Oct 27, 2023
ae5618a
Add dcc Loading to table
maxschulz-COL Oct 30, 2023
f55d46e
Revert changes
maxschulz-COL Oct 30, 2023
5e55817
Revert yaml changes
maxschulz-COL Oct 30, 2023
7ad5ce0
Merge branch 'main' into feature/table_component_MS
maxschulz-COL Oct 30, 2023
e950cbc
Small docs change
maxschulz-COL Oct 30, 2023
7eb7e90
Linting issue
maxschulz-COL Oct 30, 2023
151f795
Different solution try
maxschulz-COL Oct 30, 2023
51f492a
Schema
maxschulz-COL Oct 30, 2023
4fb900a
Lint schema using hatch rather than subprocess
maxschulz-COL Oct 30, 2023
91f9fb1
use subprocess for linting
maxschulz-COL Oct 30, 2023
c551e71
Changelog
maxschulz-COL Oct 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
-->

### Highlights ✨

- Release of the Vizro Dash DataTable. Visit the [user guide on tables](https://vizro.readthedocs.io/en/stable/pages/user_guides/table/) to learn more. ([#114](https://github.com/mckinsey/vizro/pull/114))

<!--
### Removed

- A bullet item for the Removed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!-- ### Added

- A bullet item for the Added category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#114](https://github.com/mckinsey/vizro/pull/114)) -->

<!--
### Changed

- A bullet item for the Changed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Deprecated

- A bullet item for the Deprecated category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Fixed

- A bullet item for the Fixed category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
<!--
### Security

- A bullet item for the Security category with a link to the relevant PR at the end of your entry, e.g. Enable feature XXX ([#1](https://github.com/mckinsey/vizro/pull/1))

-->
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
86 changes: 3 additions & 83 deletions vizro-core/docs/pages/user_guides/components.md
Original file line number Diff line number Diff line change
@@ -1,89 +1,9 @@
# How to use charts/components
# How to use cards & buttons

This guide shows you how to use charts/components to visualize your data in the dashboard.
This guide shows you how to use cards and buttons to visualize and interact with your data in the dashboard.

The [`Page`][vizro.models.Page] models accepts the `components` argument, where you can enter your visual content e.g.
[`Graph`][vizro.models.Graph], [`Card`][vizro.models.Card] or [`Button`][vizro.models.Button].

## Graph

The [`Graph`][vizro.models.Graph] model is the most used component in many dashboards, allowing you to visualize data in a variety of ways.

You can add a [`Graph`][vizro.models.Graph]
to your dashboard by inserting the [`Graph`][vizro.models.Graph] model into the `components` argument of the
[`Page`][vizro.models.Page] model. You will need to specify the `figure` argument, where you can enter any of the
currently available charts of the open source library [`plotly.express`](https://plotly.com/python/plotly-express/).

!!! note

Note that in order to use the [`plotly.express`](https://plotly.com/python/plotly-express/) chart in a Vizro dashboard, you need to import it as `import vizro.plotly.express as px`.
This leaves any of the [`plotly.express`](https://plotly.com/python/plotly-express/) functionality untouched, but allows _direct insertion_ into the [`Graph`][vizro.models.Graph] model _as is_.

!!! example "Graph"
=== "app.py"
```py
import vizro.models as vm
import vizro.plotly.express as px
from vizro import Vizro

df = px.data.iris()

page = vm.Page(
title="My first page",
components=[
vm.Graph(
id="my_chart",
figure=px.scatter_matrix(
df, dimensions=["sepal_length", "sepal_width", "petal_length", "petal_width"], color="species"
),
),
],
controls=[vm.Filter(column="species", selector=vm.Dropdown(title="Species"))],
)

dashboard = vm.Dashboard(pages=[page])

Vizro().build(dashboard).run()
```
=== "app.yaml"
```yaml
# Still requires a .py to register data connector in Data Manager and parse yaml configuration
# See from_yaml example
pages:
- components:
- figure:
_target_: scatter_matrix
color: species
data_frame: iris
dimensions: ["sepal_length", "sepal_width", "petal_length", "petal_width"]
id: my_chart
type: graph
controls:
- column: continent
type: filter
- selector:
title: Species
type: dropdown
title: My first page
```
=== "Result"
[![Graph]][Graph]

[Graph]: ../../assets/user_guides/components/graph1.png

Note that in the above example we directly inserted the chart into the `figure` argument for the `.py` version. This is also the simplest way to connect your chart to a Pandas `DataFrame` - for other connections, please refer to [this guide](data.md). For the `yaml` version, we simply referred to the [`plotly.express`](https://plotly.com/python/plotly-express/) name by string.


???+ info

When importing Vizro, we automatically set the `plotly` [default template](https://plotly.com/python/templates/#specifying-a-default-themes) to
a custom designed template. In case you would like to set the default back, simply run
```py
import plotly.io as pio
pio.templates.default = "plotly"
```
or enter your desired template into any `plotly.express` chart as `template="plotly"` on a case-by-case basis.
Note that we do not recommend the above steps for use in dashboards, as other templates will look out-of-sync with overall dashboard design.
[`Graph`][vizro.models.Graph], [`Table`][vizro.models.Table], [`Card`][vizro.models.Card] or [`Button`][vizro.models.Button].

## Card

Expand Down
89 changes: 89 additions & 0 deletions vizro-core/docs/pages/user_guides/graph.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# How to use graphs

This guide shows you how to use graphs to visualize your data in the dashboard.

The [`Page`][vizro.models.Page] models accepts the `components` argument, where you can enter your visual content e.g.
[`Graph`][vizro.models.Graph], [`Table`][vizro.models.Table], [`Card`][vizro.models.Card] or [`Button`][vizro.models.Button].

## Graph

The [`Graph`][vizro.models.Graph] model is the most used component in many dashboards, allowing you to visualize data in a variety of ways.

To add a [`Graph`][vizro.models.Graph] to your page, do the following:

- insert the [`Graph`][vizro.models.Graph] model into the `components` argument of the
[`Page`][vizro.models.Page] model
- enter any of the currently available charts of the open source library [`plotly.express`](https://plotly.com/python/plotly-express/) into the `figure` argument

!!! note

In order to use the [`plotly.express`](https://plotly.com/python/plotly-express/) chart in a Vizro dashboard, you need to import it as `import vizro.plotly.express as px`.
This leaves any of the [`plotly.express`](https://plotly.com/python/plotly-express/) functionality untouched, but allows _direct insertion_ into the [`Graph`][vizro.models.Graph] model _as is_.



!!! example "Graph"
=== "app.py"
```py
import vizro.models as vm
import vizro.plotly.express as px
from vizro import Vizro

df = px.data.iris()

page = vm.Page(
title="My first page",
components=[
vm.Graph(
id="my_chart",
figure=px.scatter_matrix(
df, dimensions=["sepal_length", "sepal_width", "petal_length", "petal_width"], color="species"
),
),
],
controls=[vm.Filter(column="species", selector=vm.Dropdown(title="Species"))],
)

dashboard = vm.Dashboard(pages=[page])

Vizro().build(dashboard).run()
```
=== "app.yaml"
```yaml
# Still requires a .py to register data connector in Data Manager and parse yaml configuration
# See from_yaml example
pages:
- components:
- figure:
_target_: scatter_matrix
color: species
data_frame: iris
dimensions: ["sepal_length", "sepal_width", "petal_length", "petal_width"]
id: my_chart
type: graph
controls:
- column: species
type: filter
selector:
title: Species
type: dropdown
title: My first page
```
=== "Result"
[![Graph]][Graph]

[Graph]: ../../assets/user_guides/components/graph1.png

Note that in the above example we directly inserted the chart into the `figure` argument for the `.py` version. This is also the simplest way to connect your chart to a Pandas `DataFrame` - for other connections, please refer to [this guide on data connections](data.md). For the `yaml` version, we simply referred to the [`plotly.express`](https://plotly.com/python/plotly-express/) name by string.


??? info "Vizro automatically sets the plotly default template"

When importing Vizro, we automatically set the `plotly` [default template](https://plotly.com/python/templates/#specifying-a-default-themes) to
a custom designed template. In case you would like to set the default back, simply run
```py
import plotly.io as pio
pio.templates.default = "plotly"
```
or enter your desired template into any `plotly.express` chart as `template="plotly"` on a case-by-case basis.
Note that we do not recommend the above steps for use in dashboards, as other templates will look out-of-sync with overall dashboard design.
Loading