Skip to content

Commit

Permalink
refactor method signature
Browse files Browse the repository at this point in the history
  • Loading branch information
rayeaster committed Apr 19, 2020
1 parent 03cadb8 commit 3372bae
Showing 1 changed file with 13 additions and 16 deletions.
29 changes: 13 additions & 16 deletions jsplot/src/main/java/tech/tablesaw/plotly/api/BubblePlot.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package tech.tablesaw.plotly.api;

import java.util.List;
import tech.tablesaw.api.NumericColumn;
import tech.tablesaw.api.Table;
import tech.tablesaw.columns.Column;
import tech.tablesaw.plotly.components.Figure;
import tech.tablesaw.plotly.components.Layout;
import tech.tablesaw.plotly.components.Marker;
Expand Down Expand Up @@ -40,23 +40,21 @@ public static Figure create(
return new Figure(layout, traces);
}

public static Figure create(
private static Figure create(
String title,
Table table,
String xCol,
Column xColumn,
String yCol,
Column yColumn,
String sizeColumn,
NumericColumn xColumn,
NumericColumn yColumn,
NumericColumn sizeColumn,
double[] color,
SizeMode sizeMode,
Double opacity) {
Layout layout = Layout.builder(title, xCol, yCol).build();

Layout layout = Layout.builder(title, xColumn.name(), yColumn.name()).build();

Marker marker = null;
MarkerBuilder builder = Marker.builder();
if (sizeColumn != null) {
builder.size(table.numberColumn(sizeColumn));
builder.size(sizeColumn);
}
if (opacity != null) {
builder.opacity(opacity);
Expand All @@ -69,16 +67,15 @@ public static Figure create(
}
marker = builder.build();

xColumn = (xColumn == null) ? table.numberColumn(xCol) : xColumn;
yColumn = (yColumn == null) ? table.numberColumn(yCol) : yColumn;

ScatterTrace trace = ScatterTrace.builder(xColumn, yColumn).marker(marker).build();
return new Figure(layout, trace);
}

public static Figure create(
String title, Table table, String xCol, String yCol, String sizeColumn) {
return create(title, table, xCol, null, yCol, null, sizeColumn, null, null, null);
public static Figure create(String title, Table table, String xCol, String yCol, String sizeCol) {
NumericColumn xColumn = table.numberColumn(xCol);
NumericColumn yColumn = table.numberColumn(yCol);
NumericColumn sizeColumn = table.numberColumn(sizeCol);
return create(title, xColumn, yColumn, sizeColumn, null, null, null);
}

public static Figure create(
Expand Down

0 comments on commit 3372bae

Please sign in to comment.