use of com.twosigma.beakerx.chart.xychart.Plot in project beakerx by twosigma.
the class PlotObjectSerializerTest method serializeXYChart_returnTrue.
@Test
public void serializeXYChart_returnTrue() throws Exception {
// when
boolean result = plotObjectSerializer.writeObject(new Plot(), jgen, true);
// then
Assertions.assertThat(result).isTrue();
}
use of com.twosigma.beakerx.chart.xychart.Plot in project beakerx by twosigma.
the class CombinedPlotSerializerTest method serializeWeightsOfCombinedPlot_resultJsonHasWeights.
@Test
public void serializeWeightsOfCombinedPlot_resultJsonHasWeights() throws IOException {
// when
CombinedPlot combinedPlot = new CombinedPlot();
combinedPlot.add(new Plot(), 3);
combinedPlot.add(new Plot(), 3);
combinedPlotSerializer.serialize(combinedPlot, jgen, new DefaultSerializerProvider.Impl());
jgen.flush();
// then
JsonNode actualObj = mapper.readTree(sw.toString());
Assertions.assertThat(actualObj.has("weights")).isTrue();
Assertions.assertThat(actualObj.get("weights")).isNotEmpty();
}
use of com.twosigma.beakerx.chart.xychart.Plot in project beakerx by twosigma.
the class GroovyEvaluatorChartTest method parsePlotWithRedColorLineScript_returnPlotObjectWithRedLine.
@Test
public void parsePlotWithRedColorLineScript_returnPlotObjectWithRedLine() {
// when
Object result = parseClassFromScript("def plot = new Plot()\n" + "def ys = [0, 1, 6, 5, 2, 8]\n" + "plot << new Line(y: ys, color: Color.red)");
// then
Assertions.assertThat(result instanceof Plot).isTrue();
Plot plot = (Plot) result;
Assertions.assertThat(plot.getGraphics()).isNotEmpty();
Assertions.assertThat(plot.getGraphics().get(0).getColor()).isEqualTo(Color.RED);
}
use of com.twosigma.beakerx.chart.xychart.Plot in project beakerx by twosigma.
the class GroovyEvaluatorChartTest method parsePlotWithAreaScript_returnPlotObjectWithArea.
@Test
public void parsePlotWithAreaScript_returnPlotObjectWithArea() {
// when
Object result = parseClassFromScript("def plot = new Plot()\n" + "def ys = [3, 5, 2, 3]\n" + "def xs = [0, 1, 2, 3]\n" + "plot << new Area(x: xs, y: ys)");
// then
Assertions.assertThat(result instanceof Plot).isTrue();
Plot plot = (Plot) result;
Assertions.assertThat(plot.getGraphics()).isNotEmpty();
Assertions.assertThat(plot.getGraphics().get(0) instanceof Area).isTrue();
}
use of com.twosigma.beakerx.chart.xychart.Plot in project beakerx by twosigma.
the class GroovyEvaluatorChartTest method parseLodFilterScript_returnLineObjectWithLodFilter.
@Test
public void parseLodFilterScript_returnLineObjectWithLodFilter() {
// when
Object result = parseClassFromScript("new Plot() << new Line(y: (0..10), lodFilter: Filter.LINE); ");
// then
Assertions.assertThat(result instanceof Plot).isTrue();
Plot plot = (Plot) result;
Assertions.assertThat(plot.getGraphics()).isNotEmpty();
}
Aggregations