use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryBars in project beakerx by twosigma.
the class CategoryBarsSerializerTest method serializeLabelPositionCategoryBars_resultJsonHasLabelPosition.
@Test
public void serializeLabelPositionCategoryBars_resultJsonHasLabelPosition() throws IOException {
// when
CategoryBars categoryBars = new CategoryBars();
categoryBars.setLabelPosition(LabelPositionType.CENTER);
categoryBarsSerializer.serialize(categoryBars, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("labelPosition")).isTrue();
Assertions.assertThat(actualObj.get("labelPosition").asText()).isEqualTo("CENTER");
}
use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryBars in project beakerx by twosigma.
the class GroovyEvaluatorChartTest method parseCategoryBarsWithLabelPositionScript_returnCategoryBarsObjectWithLabelPosition.
@Test
public void parseCategoryBarsWithLabelPositionScript_returnCategoryBarsObjectWithLabelPosition() {
// when
Object result = parseClassFromScript("def p = new CategoryPlot()\n" + "p << new CategoryBars(value: [[1500, 2200, 2500, 4000]], width: 0.6,\n" + " color: Color.PINK, yAxis: \"Volume\", showItemLabel: true,\n" + " labelPosition: LabelPositionType.VALUE_INSIDE)");
// then
Assertions.assertThat(result instanceof CategoryPlot).isTrue();
CategoryPlot categoryPlot = (CategoryPlot) result;
Assertions.assertThat(categoryPlot.getGraphics()).isNotEmpty();
CategoryBars categoryBars = (CategoryBars) categoryPlot.getGraphics().get(0);
Assertions.assertThat(categoryBars.getLabelPosition()).isEqualTo(LabelPositionType.VALUE_INSIDE);
}
use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryBars in project beakerx by twosigma.
the class CategoryBarsSerializerTest method serializeOutlineColorCategoryBars_resultJsonHasOutlineColor.
@Test
public void serializeOutlineColorCategoryBars_resultJsonHasOutlineColor() throws IOException {
// when
CategoryBars categoryBars = new CategoryBars();
categoryBars.setOutlineColor(Color.GREEN);
categoryBarsSerializer.serialize(categoryBars, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("outline_color")).isTrue();
Assertions.assertThat(actualObj.get("outline_color").get("rgb").asInt()).isEqualTo(Color.GREEN.getRGB());
}
use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryBars in project beakerx by twosigma.
the class CategoryBarsSerializerTest method serializeBaseCategoryBars_resultJsonHasBase.
@Test
public void serializeBaseCategoryBars_resultJsonHasBase() throws IOException {
// when
CategoryBars categoryBars = new CategoryBars();
categoryBars.setBase(11);
categoryBarsSerializer.serialize(categoryBars, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("base")).isTrue();
Assertions.assertThat(actualObj.get("base").asInt()).isEqualTo(11);
}
use of com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryBars in project beakerx by twosigma.
the class CategoryBarsSerializerTest method serializeDrawOutlineCategoryBars_resultJsonHasOutline.
@Test
public void serializeDrawOutlineCategoryBars_resultJsonHasOutline() throws IOException {
// when
CategoryBars categoryBars = new CategoryBars();
categoryBars.setDrawOutline(true);
categoryBarsSerializer.serialize(categoryBars, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("outline")).isTrue();
Assertions.assertThat(actualObj.get("outline").asBoolean()).isTrue();
}
Aggregations