Search in sources :

Example 1 with Stems

use of com.twosigma.beakerx.chart.xychart.plotitem.Stems in project beakerx by twosigma.

the class StemsSerializerTest method initTestStubData.

@Before
public void initTestStubData() throws IOException {
    sw = new StringWriter();
    jgen = mapper.getJsonFactory().createJsonGenerator(sw);
    stems = new Stems();
    stems.setX(Arrays.asList(1, 2));
    stems.setY(Arrays.asList(1, 2));
}
Also used : StringWriter(java.io.StringWriter) Stems(com.twosigma.beakerx.chart.xychart.plotitem.Stems) Before(org.junit.Before)

Example 2 with Stems

use of com.twosigma.beakerx.chart.xychart.plotitem.Stems in project beakerx by twosigma.

the class GroovyEvaluatorChartTest method parsePlotWithStemsScript_returnPlotObjectWithStems.

@Test
public void parsePlotWithStemsScript_returnPlotObjectWithStems() {
    // when
    Object result = parseClassFromScript("def plot = new Plot();\n" + "def y1 = [1.5, 1, 6, 5, 2, 8]\n" + "plot << new Stems(y: y1)");
    // then
    Assertions.assertThat(result instanceof Plot).isTrue();
    Plot plot = (Plot) result;
    Assertions.assertThat(plot.getGraphics()).isNotEmpty();
    Assertions.assertThat(plot.getGraphics().get(0) instanceof Stems).isTrue();
}
Also used : TimePlot(com.twosigma.beakerx.chart.xychart.TimePlot) SimpleTimePlot(com.twosigma.beakerx.chart.xychart.SimpleTimePlot) CombinedPlot(com.twosigma.beakerx.chart.xychart.CombinedPlot) Plot(com.twosigma.beakerx.chart.xychart.Plot) CategoryPlot(com.twosigma.beakerx.chart.categoryplot.CategoryPlot) NanoPlot(com.twosigma.beakerx.chart.xychart.NanoPlot) Stems(com.twosigma.beakerx.chart.xychart.plotitem.Stems) Test(org.junit.Test)

Example 3 with Stems

use of com.twosigma.beakerx.chart.xychart.plotitem.Stems in project beakerx by twosigma.

the class GroovyEvaluatorChartTest method parsePlotWithDashStyleStemsScript_returnPlotObjectWithDashStyleStems.

@Test
public void parsePlotWithDashStyleStemsScript_returnPlotObjectWithDashStyleStems() {
    // when
    Object result = parseClassFromScript("def plot = new Plot();\n" + "def y1 = [1.5, 1, 6, 5, 2, 8]\n" + "plot << new Stems(y: y1, style: StrokeType.DASH)");
    // then
    Assertions.assertThat(result instanceof Plot).isTrue();
    Plot plot = (Plot) result;
    Assertions.assertThat(plot.getGraphics()).isNotEmpty();
    Assertions.assertThat(((Stems) plot.getGraphics().get(0)).getStyle()).isEqualTo(StrokeType.DASH);
}
Also used : TimePlot(com.twosigma.beakerx.chart.xychart.TimePlot) SimpleTimePlot(com.twosigma.beakerx.chart.xychart.SimpleTimePlot) CombinedPlot(com.twosigma.beakerx.chart.xychart.CombinedPlot) Plot(com.twosigma.beakerx.chart.xychart.Plot) CategoryPlot(com.twosigma.beakerx.chart.categoryplot.CategoryPlot) NanoPlot(com.twosigma.beakerx.chart.xychart.NanoPlot) Stems(com.twosigma.beakerx.chart.xychart.plotitem.Stems) Test(org.junit.Test)

Aggregations

Stems (com.twosigma.beakerx.chart.xychart.plotitem.Stems)3 CategoryPlot (com.twosigma.beakerx.chart.categoryplot.CategoryPlot)2 CombinedPlot (com.twosigma.beakerx.chart.xychart.CombinedPlot)2 NanoPlot (com.twosigma.beakerx.chart.xychart.NanoPlot)2 Plot (com.twosigma.beakerx.chart.xychart.Plot)2 SimpleTimePlot (com.twosigma.beakerx.chart.xychart.SimpleTimePlot)2 TimePlot (com.twosigma.beakerx.chart.xychart.TimePlot)2 Test (org.junit.Test)2 StringWriter (java.io.StringWriter)1 Before (org.junit.Before)1