-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: switch to webgl by default for line plot (#992)
Fixes #991 Used code from that issue ``` from deephaven.plot import express as dx from deephaven.plot.figure import Figure _stocks = dx.data.stocks() p = dx.line(_stocks, "Timestamp", "Random") ```
- Loading branch information
1 parent
6e73350
commit 2c7bc01
Showing
3 changed files
with
85 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
plugins/plotly-express/test/deephaven/plot/express/plots/test_line.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import unittest | ||
|
||
from ..BaseTest import BaseTestCase | ||
|
||
|
||
class LineTestCase(BaseTestCase): | ||
def setUp(self) -> None: | ||
from deephaven import new_table | ||
from deephaven.column import int_col | ||
|
||
self.source = new_table( | ||
[ | ||
int_col("X", [1, 2, 2, 3, 3, 3, 4, 4, 5]), | ||
int_col("X2", [1, 2, 2, 3, 3, 3, 4, 4, 5]), | ||
int_col("Y", [1, 2, 2, 3, 3, 3, 4, 4, 5]), | ||
int_col("Y2", [1, 2, 2, 3, 3, 3, 4, 4, 5]), | ||
int_col("size", [1, 2, 2, 3, 3, 3, 4, 4, 5]), | ||
int_col("text", [1, 2, 2, 3, 3, 3, 4, 4, 5]), | ||
int_col("hover_name", [1, 2, 2, 3, 3, 3, 4, 4, 5]), | ||
int_col("category", [1, 2, 1, 2, 1, 2, 1, 2, 1]), | ||
] | ||
) | ||
|
||
def test_basic_scatter(self): | ||
import src.deephaven.plot.express as dx | ||
from deephaven.constants import NULL_INT | ||
|
||
chart = dx.line(self.source, x="X", y="Y").to_dict(self.exporter) | ||
|
||
expected_data = [ | ||
{ | ||
"hovertemplate": "X=%{x}<br>Y=%{y}<extra></extra>", | ||
"legendgroup": "", | ||
"line": {"color": "#636efa", "dash": "solid", "shape": "linear"}, | ||
"marker": {"symbol": "circle"}, | ||
"mode": "lines", | ||
"name": "", | ||
"showlegend": False, | ||
"x": [NULL_INT], | ||
"xaxis": "x", | ||
"y": [NULL_INT], | ||
"yaxis": "y", | ||
"type": "scattergl", | ||
} | ||
] | ||
|
||
expected_layout = { | ||
"legend": {"tracegroupgap": 0}, | ||
"margin": {"t": 60}, | ||
"xaxis": { | ||
"anchor": "y", | ||
"domain": [0.0, 1.0], | ||
"side": "bottom", | ||
"title": {"text": "X"}, | ||
}, | ||
"yaxis": { | ||
"anchor": "x", | ||
"domain": [0.0, 1.0], | ||
"side": "left", | ||
"title": {"text": "Y"}, | ||
}, | ||
} | ||
|
||
expected_mappings = [ | ||
{ | ||
"table": 0, | ||
"data_columns": {"X": ["/plotly/data/0/x"], "Y": ["/plotly/data/0/y"]}, | ||
} | ||
] | ||
|
||
self.assert_chart_equals( | ||
chart, | ||
expected_data=expected_data, | ||
expected_layout=expected_layout, | ||
expected_mappings=expected_mappings, | ||
expected_is_user_set_template=False, | ||
expected_is_user_set_color=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters