use of tech.tablesaw.plotly.traces.PieTrace in project tablesaw by jtablesaw.
the class PiePlot method create.
public static Figure create(String title, Table table, String groupColName, String numberColName) {
Layout layout = Layout.builder(title).build();
PieTrace trace = PieTrace.builder(table.column(groupColName), table.numberColumn(numberColName)).showLegend(true).build();
return new Figure(layout, trace);
}
use of tech.tablesaw.plotly.traces.PieTrace in project tablesaw by jtablesaw.
the class PieExample method main.
public static void main(String[] args) throws Exception {
Table table = Table.read().csv("../data/tornadoes_1950-2014.csv");
Table t2 = table.countBy(table.categoricalColumn("Scale"));
PieTrace trace = PieTrace.builder(t2.categoricalColumn("Category"), t2.numberColumn("Count")).build();
Layout layout = Layout.builder().title("Total fatalities by scale").build();
Plot.show(new Figure(layout, trace));
}
use of tech.tablesaw.plotly.traces.PieTrace in project tablesaw by jtablesaw.
the class PieTest method testAsJavascript.
@Test
public void testAsJavascript() {
PieTrace trace = PieTrace.builder(x, y).build();
System.out.println(trace.asJavascript(1));
}
use of tech.tablesaw.plotly.traces.PieTrace in project tablesaw by jtablesaw.
the class PieTest method show.
@Test
public void show() {
PieTrace trace = PieTrace.builder(x, y).build();
Figure figure = new Figure(trace);
File outputFile = Paths.get("testoutput/output.html").toFile();
Plot.show(figure, "target", outputFile);
}