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

docs: deephaven.ui dashboard crash course #1057

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

jnumainville
Copy link
Collaborator

Continued from https://github.com/deephaven/deephaven.io/pull/4567

Contains a deephaven.ui crash course

Idea is to progressively build an iris dashboard, creating a panel with some basic components, then move to a dashboard with several panels and more components, than add a custom panel with a picker and ui.use_state for a bit of interactivity. If someone just cares about putting some components together they could easily skip the last section, but I think it's important to include at least a basic example as that's where the power of deephaven.ui is.

```py
@ui.component
def species_panel():
species, set_species = ui.use_state()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's worth showing both somewhere, not sure that needs to be here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added badges with data hooks

plugins/ui/docs/describing/deephaven-ui.md Outdated Show resolved Hide resolved
title: Create a Dashboard with deephaven.ui
---

This guide shows you how to build a dashboard with `deephaven.ui`. [`deephaven.ui`](https://github.com/deephaven/deephaven-plugins/tree/main/plugins/ui) is Deephaven’s Python library to create user interfaces. You’ll use a wide range of components supported by the library to get you familiar with what `deephaven.ui` provides.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't kidding about my suggested introduction from your outline, I think its okay to give some personality, and introduce context to the dataset of what we are building from, and why.

Contextualize what you are building, and what your views into the data you are trying to show and weave the narrative through out.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did try to contextualize a bit more, but I think I'd need more specific examples/guidance throughout to write something more creative if that's still needed


This guide shows you how to build a dashboard with `deephaven.ui`. [`deephaven.ui`](https://github.com/deephaven/deephaven-plugins/tree/main/plugins/ui) is Deephaven’s Python library to create user interfaces. You’ll use a wide range of components supported by the library to get you familiar with what `deephaven.ui` provides.

![img](../_assets/deephaven-ui-crash-course/iris_dashboard_species.png)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the end result dashboard is sexy enough yet.

The same view of the data twice looks boring, and the really tall vertically stretched plot just looks bad.

Doing some aggregations on the data or something to present it differently.

Make a histogram.

The tab view just being the same thing is also just lame. It should at least pretend to be useful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a more general comment, but especially pertinent to this comment.
One thing that I'm not entirely sure about is what the scope of this tutorial should be. I was under the impression that the original intended scope is really the sections of Basic Components and Dashboard. I added Interactivity as I think it's important, but could be skipped easily by someone only interested in the first two sections. If I start pulling in tons of different component this becomes a very tutorial from that original objective.
Maybe that's fine, but I think we still want something incredibly basic, perhaps in a different PR, of "I just want to build a super basic dashboard because I don't need tons of complex things, and maybe I'll pick up those complex things later, but really I just want to know how deephaven.ui works to get my feet wet."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added all suggestions


### `ui.table`

Wrapping a table in `ui.table` unlocks visual functionality on the table. With `iris`, create a `ui.table` that:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the first usage of each component should link to it's docs page.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


### `ui.flex`

Wrap your chart and `ui.table` in a `ui.flex` component. `ui.flex` enables responsive layouts that adjust as you resize panels.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explain what a flex is, that is is an implementation of a flexbox [mdn link] and that it is one way to lay things out within a panel.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

```

![img](../_assets/deephaven-ui-crash-course/iris.png)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need more introduction of the plan, and the parts. What is a dashboard, what is a panel. The idea that we will iterate and create all our panels, then arrange them in a dashboard.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


![img](../_assets/deephaven-ui-crash-course/species_picker_panel.png)

### `ui.use_state`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect and example of showing state within a panel, and also state hoisted to the dashboard level that controls things across multiple panels.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


![img](../_assets/deephaven-ui-crash-course/iris_dashboard_column.png)

### Stack
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no stacks in the final example

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


![img](../_assets/deephaven-ui-crash-course/about_panel.png)

### Row
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect at least one example of manually setting a row or columns width or height.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

4. Uses the compact table density so you can see as many rows as possible

```py
ui_iris = ui.table(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should show off table interactivity, with a row on_double_press handler

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good overall, couple small things I noticed that could be cleaned up/improved.


![img](_assets/deephaven-ui-crash-course/iris_species_dashboard_final.png)
To follow along, you need the [`deephaven.ui`](https://pypi.org/project/deephaven-plugin-ui/) package.
You also need simulated data and charts from [`deephaven.plot.express`](https://pypi.org/project/deephaven-plugin-ui/). You’ll create the simulated `iris` data below.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You also need simulated data and charts from [`deephaven.plot.express`](https://pypi.org/project/deephaven-plugin-ui/). You’ll create the simulated `iris` data below.
You also need simulated data and charts from [`deephaven.plot.express`](https://pypi.org/project/deephaven-plugin-ui/). You’ll create the simulated [`iris` data set](https://en.wikipedia.org/wiki/Iris_flower_data_set) below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

ui_iris_max = ui.panel(iris_max, title="Max")
ui_iris_min = ui.panel(iris_min, title="Min")

iris_agg_stack = ui.stack(ui_iris_avg, ui_iris_max, ui_iris_min)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block doesn't work as is. Getting an error on the ui.stack ..

Copy link
Collaborator Author

@jnumainville jnumainville Dec 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed that chunk. Shouldn't have been there yet anyways.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still getting an error here. Chunk not removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooops. Absolutely, definitely removed this time.


```python
@ui.component
def summary_badges(species):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be a nice place to use dx.indicator. But I like the use of badge in the meantime.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed!

@@ -14,6 +14,10 @@
"label": "Introduction",
"path": "README.md"
},
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Order after installation please.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

plugins/ui/docs/tutorial.md Show resolved Hide resolved
- [`dx.scatter`](../../plotly-express/main/scatter.md)
- [`dx.histogram`](../../plotly-express/main/histogram.md)
- [`dx.densityheatmap`](../../plotly-express/main/density_heatmap.md)
- Component State
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: for these links

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsmmcken what should these links look like?

@jnumainville
Copy link
Collaborator Author

jnumainville commented Dec 16, 2024

Took into account the feedback from the Friday demo. Specifically I added a small section on memoization. I didn't mention the flickering explicitly because of #1063 but that step does fix it.
I'm happy with the breadth of this.

Copy link
Member

@mofojed mofojed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just that one block that throws an error didn't get removed, looks good to me otherwise.

ui_iris_max = ui.panel(iris_max, title="Max")
ui_iris_min = ui.panel(iris_min, title="Min")

iris_agg_stack = ui.stack(ui_iris_avg, ui_iris_max, ui_iris_min)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still getting an error here. Chunk not removed?

@jnumainville jnumainville requested a review from mofojed December 18, 2024 19:45
plugins/ui/docs/tutorial.md Outdated Show resolved Hide resolved
plugins/ui/docs/tutorial.md Outdated Show resolved Hide resolved
plugins/ui/docs/tutorial.md Outdated Show resolved Hide resolved
plugins/ui/docs/tutorial.md Outdated Show resolved Hide resolved
plugins/ui/docs/tutorial.md Outdated Show resolved Hide resolved
plugins/ui/docs/tutorial.md Outdated Show resolved Hide resolved
mofojed
mofojed previously approved these changes Dec 19, 2024
mofojed
mofojed previously approved these changes Jan 3, 2025
@margaretkennedy margaretkennedy removed the request for review from dsmmcken January 3, 2025 20:53
Comment on lines 814 to 816
- [`dx.scatter`](../../plotly-express/main/scatter.md)
- [`dx.histogram`](../../plotly-express/main/histogram.md)
- [`dx.densityheatmap`](../../plotly-express/main/density_heatmap.md)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these links won't work

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +814 to +816
- [`dx.scatter`](core/plotly/docs/box)
- [`dx.histogram`](core/plotly/docs/histogram)
- [`dx.density_heatmap`](core/plotly/docs/density_heatmap)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need the leading slash.

/core

is not a relative path.

Comment on lines +817 to +818
- Component State
- Custom Components
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove if not linking to anything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants