use of com.twosigma.beakerx.chart.categoryplot.CategoryPlot in project beakerx by twosigma.
the class CategoryPlotSerializerTest method serializeGraphicsListCategoryPlot_resultJsonHasGraphicsList.
@Test
public void serializeGraphicsListCategoryPlot_resultJsonHasGraphicsList() throws IOException {
// when
CategoryPlot categoryPlot = new CategoryPlot();
categoryPlot.add(Arrays.asList(new CategoryBars(), new CategoryPoints()));
categoryPlotSerializer.serialize(categoryPlot, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("graphics_list")).isTrue();
ArrayNode arrayNode = (ArrayNode) actualObj.get("graphics_list");
Assertions.assertThat(arrayNode.size()).isEqualTo(2);
}
use of com.twosigma.beakerx.chart.categoryplot.CategoryPlot in project beakerx by twosigma.
the class CategoryPlotSerializerTest method serializeCategoryMarginOfCategoryPlot_resultJsonHasCategoryMargin.
@Test
public void serializeCategoryMarginOfCategoryPlot_resultJsonHasCategoryMargin() throws IOException {
// when
CategoryPlot categoryPlot = new CategoryPlot();
categoryPlot.setCategoryMargin(0.5);
categoryPlotSerializer.serialize(categoryPlot, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("category_margin")).isTrue();
Assertions.assertThat(actualObj.get("category_margin").asDouble()).isEqualTo(0.5);
}
use of com.twosigma.beakerx.chart.categoryplot.CategoryPlot in project beakerx by twosigma.
the class CategoryPlotSerializerTest method serializeOrientationCategoryPlot_resultJsonHasOrientation.
@Test
public void serializeOrientationCategoryPlot_resultJsonHasOrientation() throws IOException {
// when
CategoryPlot categoryPlot = new CategoryPlot();
categoryPlot.setOrientation(PlotOrientationType.VERTICAL);
categoryPlotSerializer.serialize(categoryPlot, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("orientation")).isTrue();
Assertions.assertThat(actualObj.get("orientation").asText()).isEqualTo("VERTICAL");
}
use of com.twosigma.beakerx.chart.categoryplot.CategoryPlot in project beakerx by twosigma.
the class ItemLabelBuilderTest method setUp.
@Before
public void setUp() throws Exception {
categoryGraphics = new CategoryBars();
categoryGraphics.setValue(new Integer[] { new Integer(1), new Integer(2) });
categoryGraphics.setSeriesNames(Arrays.asList("test series name"));
categoryPlot = new CategoryPlot();
categoryPlot.setCategoryNames(Arrays.asList("test category name"));
categoryPlot.add(Arrays.asList(categoryGraphics));
}
use of com.twosigma.beakerx.chart.categoryplot.CategoryPlot in project beakerx by twosigma.
the class GroovyEvaluatorChartTest method parseCategoryPlotWithCategoryLinesScript_returnCategoryPlotObjectWithCategoryLines.
@Test
public void parseCategoryPlotWithCategoryLinesScript_returnCategoryPlotObjectWithCategoryLines() {
// when
Object result = parseClassFromScript("new CategoryPlot() << new CategoryLines(value: [[1, 2, 4], [4, 5, 8]])");
// then
Assertions.assertThat(result instanceof CategoryPlot).isTrue();
CategoryPlot categoryPlot = (CategoryPlot) result;
Assertions.assertThat(categoryPlot.getGraphics()).isNotEmpty();
}
Aggregations