Search in sources :

Example 1 with BoxTrace

use of tech.tablesaw.plotly.traces.BoxTrace in project tablesaw by jtablesaw.

the class BoxTest method name.

/**
 * Test ensures that the name() method returns a BoxTraceBuilder as expected.
 */
@Test
void name() {
    BoxTrace trace = BoxTrace.builder(x, y).name("my name").build();
    assertNotNull(trace);
}
Also used : BoxTrace(tech.tablesaw.plotly.traces.BoxTrace) Test(org.junit.jupiter.api.Test)

Example 2 with BoxTrace

use of tech.tablesaw.plotly.traces.BoxTrace in project tablesaw by jtablesaw.

the class BoxExample method main.

public static void main(String[] args) throws Exception {
    Table table = Table.read().csv("../data/tornadoes_1950-2014.csv");
    Layout layout = Layout.builder().title("Tornado Injuries by Scale").build();
    BoxTrace trace = BoxTrace.builder(table.categoricalColumn("scale"), table.nCol("injuries")).build();
    Plot.show(new Figure(layout, trace));
}
Also used : BoxTrace(tech.tablesaw.plotly.traces.BoxTrace) Table(tech.tablesaw.api.Table) Layout(tech.tablesaw.plotly.components.Layout) Figure(tech.tablesaw.plotly.components.Figure)

Example 3 with BoxTrace

use of tech.tablesaw.plotly.traces.BoxTrace in project tablesaw by jtablesaw.

the class BoxTest method show.

@Test
void show() {
    BoxTrace trace = BoxTrace.builder(x, y).build();
    Figure figure = new Figure(trace);
    assertNotNull(figure);
    Plot.show(figure, "target");
}
Also used : BoxTrace(tech.tablesaw.plotly.traces.BoxTrace) Figure(tech.tablesaw.plotly.components.Figure) Test(org.junit.jupiter.api.Test)

Example 4 with BoxTrace

use of tech.tablesaw.plotly.traces.BoxTrace in project tablesaw by jtablesaw.

the class BoxTest method testAsJavascript.

@Test
void testAsJavascript() {
    BoxTrace trace = BoxTrace.builder(x, y).build();
    assertNotNull(trace.asJavascript(1));
}
Also used : BoxTrace(tech.tablesaw.plotly.traces.BoxTrace) Test(org.junit.jupiter.api.Test)

Example 5 with BoxTrace

use of tech.tablesaw.plotly.traces.BoxTrace in project tablesaw by jtablesaw.

the class BoxPlot method create.

public static Figure create(String title, Table table, String groupingColumn, String numericColumn) {
    Layout layout = Layout.builder().title(title).height(HEIGHT).width(WIDTH).build();
    BoxTrace trace = BoxTrace.builder(table.categoricalColumn(groupingColumn), table.nCol(numericColumn)).build();
    return new Figure(layout, trace);
}
Also used : BoxTrace(tech.tablesaw.plotly.traces.BoxTrace) Layout(tech.tablesaw.plotly.components.Layout) Figure(tech.tablesaw.plotly.components.Figure)

Aggregations

BoxTrace (tech.tablesaw.plotly.traces.BoxTrace)5 Test (org.junit.jupiter.api.Test)3 Figure (tech.tablesaw.plotly.components.Figure)3 Layout (tech.tablesaw.plotly.components.Layout)2 Table (tech.tablesaw.api.Table)1