Skip to content

Commit

Permalink
Add more questions about the color_ methods, view args on ui.table
Browse files Browse the repository at this point in the history
  • Loading branch information
mofojed committed Oct 11, 2023
1 parent 6783e3f commit 47e0396
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions plugins/ui/DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ d = my_dashboard()

```py
import deephaven.ui as ui
ui_table = ui.table(table: Table) -> UITable
ui_table = ui.table(table: Table, **view_args: dict) -> UITable
```

It has an [immutable fluent](https://en.wikipedia.org/wiki/Fluent_interface#Immutability) interface, similar to Deephaven `Table`. That means each method below will return a new `UITable` object, rather than modifying the existing one. This allows you to chain multiple customizations together, e.g.:
Expand All @@ -909,11 +909,17 @@ from deephaven import ui
# Create a table with some customizations
ui_table = (
ui.table(source)
.format_columns(["X = Y > 5 ? RED : NO_FORMATTING"])
.color_column("X", ["X = Y > 5 ? RED : NO_FORMATTING"])
.column_group("Group 1", ["Col1", "Col2"], "RED")
)
```

You can also set margins and padding by passing in the appropriate arguments to the `ui.table` function:

```py
ui_table = ui.table(source, padding="size-250")
```

`ui.table` will support the below methods.

##### aggregations
Expand Down Expand Up @@ -1036,6 +1042,10 @@ ui_table.color_column(
| `background_color` | `Color \| None` | The background color. Accepts hex color strings or Deephaven color names. |

<!-- TODO: For ranges, such as "In Between", how should we specify that? Should we define a quick filter format for that? (e.g. `(5, 20)`, and `[5, 20]`, matching how you'd notate an interval) -->
<!--
TODO: We also don't allow conditional formatting that sets a colour on one column depending on the value on another column; eg. `source.format_columns(["A = B > 2 ? BLUE : NO_FORMATTING"])`
That seems like a limitation of our UI - should we build support for that in the UI?
-->

##### color_row

Expand All @@ -1052,6 +1062,11 @@ ui_table.color_row(
) -> UITable
```

<!--
TODO: This doesn't allow for formatting by row index like we could do previously, e.g. `t4.formatRowWhere("i % 2 == 0", "VIVID_PURPLE")`
This is a limitation in our UI - should we build support for that in the UI?
-->

###### Parameters

| Parameter | Type | Description |
Expand Down

0 comments on commit 47e0396

Please sign in to comment.