def test_color(self): figure = Figure() new_f = figure.plot_xy("plot1", self.test_table, x="a", y="b") line = new_f.line(color=Colors.RED, style=LineStyle(width=1.0, end_style=LineEndStyle.ROUND)) self.assertIsNotNone(line)
def test_chart_tile_with_font(self): figure = Figure() custom_color = Color.of_hsl(h=128, s=58, l=68, alpha=0.6) custom_font = Font(family="SansSerif", style=FontStyle.BOLD_ITALIC, size=18) new_f = figure.plot_xy("plot1", self.test_table, x="a", y="b") new_chart_title = new_f.chart_title(title="Dummy Char", color=custom_color, font=custom_font) self.assertIsNotNone(new_chart_title)
def test_color_hsl(self): figure = Figure() custom_color = Color.of_hsl(h=128, s=58, l=68, alpha=0.6) new_f = figure.plot_xy("plot1", self.test_table, x="a", y="b") line = new_f.line(color=custom_color, style=LineStyle(width=1.0, end_style=LineEndStyle.ROUND)) self.assertIsNotNone(line)
def test_line(self): figure = Figure() new_f = figure.plot_xy("plot1", self.test_table, x="a", y="b") line = new_f.line(color=Colors.ANTIQUEWHITE, style=LineStyle(width=1.0, end_style=LineEndStyle.ROUND)) self.assertIsNotNone(line) with self.assertRaises(DHError): line = new_f.line(color=Colors.ANTIQUEWHITE, style=LineStyle(width=1.0, end_style=LineEndStyle.ROUND, dash_pattern=[-1]))
def test_axis_format(self): figure = Figure() new_f = figure.plot_xy("plot1", self.test_table, x="a", y="b") dec_aix_format = DecimalAxisFormat() axis = new_f.axis(format=dec_aix_format) self.assertIsNotNone(axis) nanos_aix_format = NanosAxisFormat() axis = new_f.axis(format=nanos_aix_format) self.assertIsNotNone(axis) nanos_aix_format = NanosAxisFormat(tz=TimeZone.PT) nanos_aix_format.set_pattern("yyyy-MM-dd'T'HH:mm") axis = new_f.axis(format=nanos_aix_format) self.assertIsNotNone(axis)
def test_figure(self): with self.subTest("Not supported yet."): with self.assertRaises(Exception) as cm: figure = Figure() new_f = figure.plot_xy("plot1", self.test_table, x="a", y="b", by=['e']) self.assertIn("NullPointerException", str(cm.exception)) with self.subTest("this should work"): figure = Figure() new_f = figure.plot_xy("plot1", self.test_table, x="a", y="b") plot1 = new_f.show() new_f = figure.plot_xy("plot2", x=[1, 2, 3], y=[1.0, 2.0, 3.0]) plot2 = new_f.show() self.assertIsNotNone(new_f)
def test_axis_transform(self): figure = Figure() new_f = figure.plot_xy("plot1", self.test_table, x="a", y="b") for name in axis_transform_names(): axis = new_f.axis(transform=axis_transform(name)) self.assertIsNotNone(axis)
def test_shape(self): figure = Figure() new_f = figure.plot_xy("plot1", self.test_table, x="a", y="b") new_p = new_f.point(shape=Shape.SQUARE, size=10, label="Big Point") self.assertIsNotNone(new_p)
def test_plot_style(self): figure = Figure() new_f = figure.plot_xy("plot1", self.test_table, x="a", y="b") axes = new_f.axes(axes=0, plot_style=PlotStyle.PIE) self.assertIsNotNone(axes)