use of com.twosigma.beakerx.chart.categoryplot.CategoryPlot in project beakerx by twosigma.
the class ChartDetails method getGraphics.
/**
* Taken from code{@code com.twosigma.beaker.groovy.rest.ChartRest#getGraphics}
*
* @param info GraphicsActionObject
* @param chart ChartDetails
* @return list of Graphics for given plot data
*/
protected List<? extends Graphics> getGraphics(GraphicsActionObject info, ChartDetails chart) {
List<? extends Graphics> graphics = null;
if (chart instanceof XYChart) {
graphics = ((XYChart) chart).getGraphics();
} else if (chart instanceof CategoryPlot) {
graphics = ((CategoryPlot) chart).getGraphics();
} else if (chart instanceof CombinedPlot) {
XYChart subplot = ((CombinedPlot) chart).getSubplots().get(((CombinedPlotActionObject) info).getSubplotIndex());
graphics = subplot.getGraphics();
}
return graphics;
}
use of com.twosigma.beakerx.chart.categoryplot.CategoryPlot in project beakerx by twosigma.
the class PlotObjectSerializerTest method serializeCategoryPlot_returnTrue.
@Test
public void serializeCategoryPlot_returnTrue() throws Exception {
// when
boolean result = plotObjectSerializer.writeObject(new CategoryPlot(), jgen, true);
// then
Assertions.assertThat(result).isTrue();
}
use of com.twosigma.beakerx.chart.categoryplot.CategoryPlot in project beakerx by twosigma.
the class GroovyEvaluatorChartTest method parseCategoryPlotWithHorizontalOrientationScript_returnCategoryPlotObjectWithHorizontalOrientation.
@Test
public void parseCategoryPlotWithHorizontalOrientationScript_returnCategoryPlotObjectWithHorizontalOrientation() {
// when
Object result = parseClassFromScript("def plot = new CategoryPlot(orientation: PlotOrientationType.HORIZONTAL)\n" + "plot << new CategoryBars(value:[[1, 2, 3], [1, 3, 5]])");
// then
Assertions.assertThat(result instanceof CategoryPlot).isTrue();
CategoryPlot categoryPlot = (CategoryPlot) result;
Assertions.assertThat(categoryPlot.getOrientation()).isEqualTo(PlotOrientationType.HORIZONTAL);
}
use of com.twosigma.beakerx.chart.categoryplot.CategoryPlot in project beakerx by twosigma.
the class GroovyEvaluatorChartTest method parseCategoryPlotWithCategoryPointsScript_returnCategoryPlotObjectWithCategoryPoints.
@Test
public void parseCategoryPlotWithCategoryPointsScript_returnCategoryPlotObjectWithCategoryPoints() {
// when
Object result = parseClassFromScript("new CategoryPlot() << new CategoryPoints(value: [[1, 2, 4], [4, 5, 8]])");
// then
Assertions.assertThat(result instanceof CategoryPlot).isTrue();
CategoryPlot categoryPlot = (CategoryPlot) result;
Assertions.assertThat(categoryPlot.getGraphics()).isNotEmpty();
}
use of com.twosigma.beakerx.chart.categoryplot.CategoryPlot in project beakerx by twosigma.
the class GroovyEvaluatorChartTest method parseCategoryPlotWithCategoryBarsScript_returnCategoryPlotObjectWithCategoryBars.
@Test
public void parseCategoryPlotWithCategoryBarsScript_returnCategoryPlotObjectWithCategoryBars() {
// when
Object result = parseClassFromScript("def bars = new CategoryBars(value: [[1, 2, 3], [1, 3, 5]])\n" + "new CategoryPlot() << bars");
// then
Assertions.assertThat(result instanceof CategoryPlot).isTrue();
CategoryPlot categoryPlot = (CategoryPlot) result;
Assertions.assertThat(categoryPlot.getGraphics()).isNotEmpty();
}
Aggregations