Search in sources :

Example 26 with Plot

use of com.twosigma.beakerx.chart.xychart.Plot in project beakerx by twosigma.

the class GroovyEvaluatorChartTest method parsePlotWithConstantBandScript_returnPlotObjectWithConstantBand.

@Test
public void parsePlotWithConstantBandScript_returnPlotObjectWithConstantBand() {
    // when
    Object result = parseClassFromScript("def plot = new Plot()\n" + "plot << new ConstantBand(x: [1, 2])");
    // then
    Assertions.assertThat(result instanceof Plot).isTrue();
    Plot plot = (Plot) result;
    Assertions.assertThat(plot.getConstantBands()).isNotEmpty();
    Assertions.assertThat(plot.getConstantBands().get(0)).isNotNull();
}
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) Test(org.junit.Test)

Example 27 with Plot

use of com.twosigma.beakerx.chart.xychart.Plot in project beakerx by twosigma.

the class GroovyEvaluatorChartTest method parsePlotWithBarsScript_returnPlotObjectWithBars.

@Test
public void parsePlotWithBarsScript_returnPlotObjectWithBars() {
    // when
    Object result = parseClassFromScript("def plot = new Plot()\n" + "plot << new Bars(x: (1..5), y: [3, 5, 2, 3, 7])");
    // then
    Assertions.assertThat(result instanceof Plot).isTrue();
    Plot plot = (Plot) result;
    Assertions.assertThat(plot.getGraphics()).isNotEmpty();
    Assertions.assertThat(plot.getGraphics().get(0) instanceof Bars).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) CategoryBars(com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryBars) Bars(com.twosigma.beakerx.chart.xychart.plotitem.Bars) Test(org.junit.Test)

Example 28 with Plot

use of com.twosigma.beakerx.chart.xychart.Plot 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)

Example 29 with Plot

use of com.twosigma.beakerx.chart.xychart.Plot in project beakerx by twosigma.

the class GroovyEvaluatorChartTest method parsePlotWithTextScript_returnPlotObjectWithText.

@Test
public void parsePlotWithTextScript_returnPlotObjectWithText() {
    // when
    Object result = parseClassFromScript("def plot = new Plot ()\n" + "plot << new Text(text: \"labelText \")");
    // then
    Assertions.assertThat(result instanceof Plot).isTrue();
    Plot plot = (Plot) result;
    Assertions.assertThat(plot.getTexts()).isNotEmpty();
    Assertions.assertThat(plot.getTexts().get(0)).isNotNull();
}
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) Test(org.junit.Test)

Aggregations

Plot (com.twosigma.beakerx.chart.xychart.Plot)29 Test (org.junit.Test)27 CombinedPlot (com.twosigma.beakerx.chart.xychart.CombinedPlot)23 SimpleTimePlot (com.twosigma.beakerx.chart.xychart.SimpleTimePlot)22 CategoryPlot (com.twosigma.beakerx.chart.categoryplot.CategoryPlot)20 NanoPlot (com.twosigma.beakerx.chart.xychart.NanoPlot)19 TimePlot (com.twosigma.beakerx.chart.xychart.TimePlot)19 KernelTest (com.twosigma.beakerx.KernelTest)7 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 DefaultSerializerProvider (com.fasterxml.jackson.databind.ser.DefaultSerializerProvider)3 TryResult (com.twosigma.beakerx.TryResult)2 Points (com.twosigma.beakerx.chart.xychart.plotitem.Points)2 Stems (com.twosigma.beakerx.chart.xychart.plotitem.Stems)2 SimpleEvaluationObject (com.twosigma.beakerx.jvm.object.SimpleEvaluationObject)2 Map (java.util.Map)2 Chart (com.twosigma.beakerx.chart.Chart)1 CategoryBars (com.twosigma.beakerx.chart.categoryplot.plotitem.CategoryBars)1 Area (com.twosigma.beakerx.chart.xychart.plotitem.Area)1 Bars (com.twosigma.beakerx.chart.xychart.plotitem.Bars)1 Line (com.twosigma.beakerx.chart.xychart.plotitem.Line)1