Skip to content

Commit

Permalink
merge latest
Browse files Browse the repository at this point in the history
  • Loading branch information
dgodinez-dh committed Dec 30, 2024
2 parents 183f80d + 6b261d6 commit 1fddb44
Show file tree
Hide file tree
Showing 88 changed files with 2,850 additions and 118 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/typescript-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check TypeScript types

on:
push:
branches:
- main
- 'release/**'
- 'feature/**'
pull_request:
branches:
- main
- 'release/**'
- 'feature/**'

jobs:
typescript-check:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: npm ci
- name: Check TypeScript types
run: python tools/check_typescript_ci.py

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function DashboardPlugin({
widget: VariableDefinition;
}) => {
const { id: widgetId, name, type } = widget;
if (type === dh.VariableType.TABLE || type === dh.VariableType.FIGURE) {
if (type === 'Table' || type === 'Figure') {
// Just ignore table and figure types - only want interesting other types
return;
}
Expand Down
6 changes: 6 additions & 0 deletions plugins/plotly-express/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.

- - -
## plotly-express-v0.12.1 - 2024-12-12
#### Bug Fixes
- switch to webgl by default for line plot (#992) - (2c7bc01) - Joe

- - -

## plotly-express-v0.12.0 - 2024-11-23
#### Bug Fixes
- `dx` now respects the webgl flag (#934) - (9cdf1ee) - Joe
Expand Down
273 changes: 273 additions & 0 deletions plugins/plotly-express/docs/indicator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
# Indicator Plot

An indicator plot is a type of plot that highlights a collection of numeric values.

### What are indicator plots useful for?

- **Highlight specific metrics**: Indicator plots are useful when you want to highlight specific numeric metrics in a visually appealing way.
- **Compare metrics to a reference value**: Indicator plots are useful to compare metrics to a reference value, such as a starting value or a target value.
- **Compare metrics to each other**: Indicator plots are useful to compare multiple metrics to each other by highlighting where they fall relative to each other.

## Examples

### A basic indicator plot

Visualize a single numeric value by passing the column name to the `value` argument. The table should contain only one row.

```python
import deephaven.plot.express as dx
from deephaven import agg as agg

my_table = dx.data.stocks()

# subset data and aggregate for DOG prices
dog_avg = my_table.where("Sym = `DOG`").agg_by([agg.avg(cols="Price")])

indicator_plot = dx.indicator(dog_avg, value="Price")
```

### A delta indicator plot

Visualize a single numeric value with a delta to a reference value by passing the reference column name to the `reference` argument.

```python order=indicator_plot,my_table
import deephaven.plot.express as dx
from deephaven import agg as agg
my_table = dx.data.stocks()

# subset data and aggregate for DOG prices
dog_agg = my_table.where("Sym = `DOG`").agg_by([agg.avg(cols="Price"), agg.first(cols="StartingPrice = Price")])

indicator_plot = dx.indicator(dog_agg, value="Price", reference="StartingPrice")
```

## Indicator plots from variables

Pass variables into a table to create an indicator plot.

```python order=indicator_plot,my_table
import deephaven.plot.express as dx
from deephaven import new_table
from deephaven.column import int_col

my_value = 10
my_reference = 5

my_table = new_table([
int_col("MyValue", [my_value]),
int_col("MyReference", [my_reference])
])

indicator_plot = dx.indicator(my_table, value="MyValue", reference="MyReference")
```

# Delta only indicator plot

Visualize only the delta to a reference value by passing `number=False`.

```python order=indicator_plot,my_table
import deephaven.plot.express as dx
from deephaven import agg as agg
my_table = dx.data.stocks()

# subset data and aggregate for DOG prices
dog_agg = my_table.where("Sym = `DOG`").agg_by([agg.avg(cols="Price"), agg.first(cols="StartingPrice = Price")])

indicator_plot = dx.indicator(dog_agg, value="Price", reference="StartingPrice", number=False)
```

### An angular indicator plot

Visualize a single numeric value with an angular gauge by passing `gauge="angular"`.

```python order=indicator_plot,my_table
import deephaven.plot.express as dx
from deephaven import agg as agg
my_table = dx.data.stocks()

# subset data and aggregate for DOG prices
dog_avg = my_table.where("Sym = `DOG`").agg_by([agg.avg(cols="Price")])

indicator_plot = dx.indicator(dog_avg, value="Price", gauge="angular")
```

### A hidden axis bullet indicator plot

Visualize a single numeric value with a bullet gauge by passing `gauge="bullet"`. Hide the axis by passing `axis=False`.

```python order=indicator_plot,my_table
import deephaven.plot.express as dx
from deephaven import agg as agg
my_table = dx.data.stocks()

# subset data and aggregate for DOG prices
dog_avg = my_table.where("Sym = `DOG`").agg_by([agg.avg(cols="Price")])

indicator_plot = dx.indicator(dog_avg, value="Price", gauge="bullet", axis=False)
```

### Prefixes and suffixes

Add a prefix and suffix to the numeric value by passing `prefix` and `suffix`.

```python order=indicator_plot,my_table
import deephaven.plot.express as dx
from deephaven import agg as agg
my_table = dx.data.stocks()

# subset data and aggregate for DOG prices
dog_avg = my_table.where("Sym = `DOG`").agg_by([agg.avg(cols="Price")])

indicator_plot = dx.indicator(dog_avg, value="Price", prefix="$", suffix="USD")
```

### Delta Symbols

Modify the symbol before the delta value by passing `increasing_text` and `decreasing_text`.

```python order=indicator_plot,my_table
import deephaven.plot.express as dx
from deephaven import agg as agg
my_table = dx.data.stocks()

# subset data and aggregate for DOG prices
dog_avg = my_table.where("Sym = `DOG`").agg_by([agg.avg(cols="Price")])

indicator_plot = dx.indicator(dog_avg, value="Price", increasing_text="Up: ", decreasing_text="Down: ")
```

### Indicator with text

Add text to the indicator by passing the text column name to the `text` argument.

```python order=indicator_plot,my_table
import deephaven.plot.express as dx
from deephaven import agg as agg
my_table = dx.data.stocks()

# subset data and aggregate prices, keeping the Sym
dog_avg = my_table.where("Sym = `DOG`").agg_by([agg.avg(cols="Price")])

indicator_plot = dx.indicator(dog_avg, value="Price", text="Sym")
```

### Multiple indicators

Visualize multiple numeric values by passing in a table with multiple rows. By default, a square grid of indicators is created.

```python order=indicator_plot,my_table
import deephaven.plot.express as dx
my_table = dx.data.stocks()

# aggregate for average prices by Sym
sym_avg = my_table.agg_by([agg.avg(cols="Price")], by="Sym")

indicator_plot = dx.indicator(sym_avg, value="Price")
```

### Multiple rows

By default, a grid of indicators is created. To create a specific amount of rows with a dynamic number of columns, pass the number of rows to the `rows` argument.

```python order=indicator_plot,my_table
import deephaven.plot.express as dx
my_table = dx.data.stocks()

# aggregate for average prices by Sym
sym_avg = my_table.agg_by([agg.avg(cols="Price")], by="Sym")

indicator_plot = dx.indicator(sym_avg, value="Price", rows=2)
```

### Multiple columns

By default, a grid of indicators is created. To create a specific amount of columns with a dynamic number of rows, pass the number of columns to the `columns` argument.

```python order=indicator_plot,my_table
import deephaven.plot.express as dx
my_table = dx.data.stocks()

# aggregate for average prices by Sym
sym_avg = my_table.agg_by([agg.avg(cols="Price")], by="Sym")

indicator_plot = dx.indicator(sym_avg, value="Price", columns=2)
```

### Delta colors

Change the color of the delta value based on whether it is increasing or decreasing by passing `increasing_color_sequence` and `decreasing_color_sequence`.
These colors are applied sequentially to the indicators and looped if there are more indicators than colors.

```python
import deephaven.plot.express as dx
from deephaven import agg as agg

my_table = dx.data.stocks()

# subset data and aggregate for DOG prices
sym_agg = my_table.agg_by(
[agg.avg(cols="Price"), agg.first(cols="StartingPrice = Price")]
)

indicator_plot = dx.indicator(
sym_agg,
value="Price",
reference="Starting Price",
increasing_color_sequence=["green", "darkgreen"],
decreasing_color_sequence=["red", "darkred"],
)
```

### Gauge colors

Change the color of the gauge based on the value by passing `gauge_color_sequence`.
These colors are applied sequentially to the indicators and looped if there are more indicators than colors.

```python
import deephaven.plot.express as dx
from deephaven import agg as agg

my_table = dx.data.stocks()

# subset data and aggregate for DOG prices
sym_agg = my_table.agg_by([agg.avg(cols="Price")])

indicator_plot = dx.indicator(
sym_agg, value="Price", gauge_color_sequence=["green", "darkgreen"]
)
```

### Plot by

Create groups of styled indicators by passing the grouping categorical column name to the `by` argument.
`increasing_color_map` and `decreasing_color_map` can be used to style the indicators based on the group.

```python
import deephaven.plot.express as dx
from deephaven import agg as agg

my_table = dx.data.stocks()

# subset data and aggregate prices, keeping the Sym
sym_agg = my_table.agg_by(
[
agg.avg(cols="Price"),
agg.first(cols="StartingPrice = Price"),
agg.last(cols="Sym"),
]
)

indicator_plot = dx.indicator(
sym_agg,
value="Price",
reference="StartingPrice",
by="Sym",
increasing_color_map={"DOG": "darkgreen"},
decreasing_color_map={"DOG": "darkred"},
)
```

## API Reference
```{eval-rst}
.. dhautofunction:: deephaven.plot.express.indicator
```
2 changes: 1 addition & 1 deletion plugins/plotly-express/setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = deephaven-plugin-plotly-express
description = Deephaven Chart Plugin
long_description = file: README.md
long_description_content_type = text/markdown
version = 0.12.0.dev0
version = 0.12.1.dev0
url = https://github.com/deephaven/deephaven-plugins
project_urls =
Source Code = https://github.com/deephaven/deephaven-plugins
Expand Down
Loading

0 comments on commit 1fddb44

Please sign in to comment.