Skip to content

Commit

Permalink
adding title
Browse files Browse the repository at this point in the history
  • Loading branch information
jnumainville committed Apr 2, 2024
1 parent ff4b097 commit 87bc3e0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,9 @@ def default_figure(self) -> DeephavenFigure:
# this is very hacky but it's needed to prevent errors when
# there are no partitions until a better solution can be done
# also need the px template to be set
default_fig = px.scatter(x=[0], y=[0])
# the title can also be set here as it will never change
title = self.args.get("title")
default_fig = px.scatter(x=[0], y=[0], title=title)
default_fig.update_traces(x=[], y=[])
return DeephavenFigure(default_fig)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import unittest

from ..BaseTest import BaseTestCase


class ScatterTestCase(BaseTestCase):
def setUp(self) -> None:
from deephaven import empty_table

self.source = empty_table(0).update(["x=i", "y=i*Math.random()*i", "z=i%5"])

def test_empty_title(self):
import src.deephaven.plot.express as dx

chart = dx.line(
self.source, x="x", y="y", by=["z"], title="Hello World0"
).to_dict(self.exporter)
plotly, deephaven = chart["plotly"], chart["deephaven"]

expected_title = {"text": "Hello World0"}

self.assertEqual(plotly["layout"]["title"], expected_title)


if __name__ == "__main__":
unittest.main()

0 comments on commit 87bc3e0

Please sign in to comment.