Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lwhite1 committed Apr 12, 2022
1 parent 5130f51 commit 41d7753
Show file tree
Hide file tree
Showing 126 changed files with 2,010 additions and 432 deletions.
5 changes: 5 additions & 0 deletions aggregate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
<artifactId>tablesaw-excel</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>tech.tablesaw</groupId>
<artifactId>tablesaw-plot</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>tech.tablesaw</groupId>
<artifactId>tablesaw-html</artifactId>
Expand Down
11 changes: 6 additions & 5 deletions jsplot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,17 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>30.0-jre</version>
</dependency>

<dependency>
<groupId>io.pebbletemplates</groupId>
<artifactId>pebble</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>tech.tablesaw</groupId>
<artifactId>tablesaw-core</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.google.common.base.Preconditions;
import java.util.HashMap;
import java.util.Map;
import tech.tablesaw.api.NumericColumn;
import tech.tablesaw.plotly.Utils;

public class Marker extends Component {
Expand Down Expand Up @@ -173,10 +172,6 @@ public MarkerBuilder size(double... size) {
return this;
}

public MarkerBuilder size(NumericColumn<?> size) {
return size(size.asDoubleArray());
}

/**
* Has an effect only if `marker.color` is set to a numerical array and `cmin`, `cmax` are also
* set. In this case, it controls whether the range of colors in `colorscale` is mapped to the
Expand Down
12 changes: 0 additions & 12 deletions jsplot/src/main/java/tech/tablesaw/plotly/traces/BarTrace.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import java.io.UncheckedIOException;
import java.io.Writer;
import java.util.Map;
import tech.tablesaw.api.CategoricalColumn;
import tech.tablesaw.api.NumericColumn;
import tech.tablesaw.plotly.components.Marker;

public class BarTrace extends AbstractTrace {
Expand All @@ -32,10 +30,6 @@ public static BarBuilder builder(Object[] x, double[] y) {
return new BarBuilder(x, y);
}

public static BarBuilder builder(CategoricalColumn<?> x, NumericColumn<? extends Number> y) {
return new BarBuilder(x, y);
}

@Override
public String asJavascript(int i) {
Writer writer = new StringWriter();
Expand Down Expand Up @@ -99,12 +93,6 @@ public static class BarBuilder extends TraceBuilder {
this.y = y;
}

BarBuilder(CategoricalColumn<?> x, NumericColumn<? extends Number> y) {

this.x = TraceBuilder.columnToStringArray(x);
this.y = y.asDoubleArray();
}

public BarTrace build() {
return new BarTrace(this);
}
Expand Down
11 changes: 0 additions & 11 deletions jsplot/src/main/java/tech/tablesaw/plotly/traces/BoxTrace.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import java.io.UncheckedIOException;
import java.io.Writer;
import java.util.Map;
import tech.tablesaw.api.CategoricalColumn;
import tech.tablesaw.api.NumericColumn;

public class BoxTrace extends AbstractTrace {

Expand All @@ -27,10 +25,6 @@ public static BoxBuilder builder(Object[] x, double[] y) {
return new BoxBuilder(x, y);
}

public static BoxBuilder builder(CategoricalColumn<?> x, NumericColumn<? extends Number> y) {
return new BoxBuilder(x, y);
}

public static BoxBuilder builder(double[] x, double[] y) {
Double[] xObjs = new Double[x.length];
for (int i = 0; i < x.length; i++) {
Expand Down Expand Up @@ -81,11 +75,6 @@ public BoxBuilder name(String name) {
return this;
}

BoxBuilder(CategoricalColumn<?> x, NumericColumn<? extends Number> y) {
this.x = columnToStringArray(x);
this.y = y.asDoubleArray();
}

public BoxTrace build() {
return new BoxTrace(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import java.io.UncheckedIOException;
import java.io.Writer;
import java.util.Map;
import tech.tablesaw.api.NumericColumn;
import tech.tablesaw.plotly.Utils;

public class Histogram2DTrace extends AbstractTrace {
Expand All @@ -19,11 +18,6 @@ public static Histogram2DBuilder builder(double[] x, double[] y) {
return new Histogram2DBuilder(x, y);
}

public static Histogram2DBuilder builder(
NumericColumn<? extends Number> x, NumericColumn<? extends Number> y) {
return new Histogram2DBuilder(x.asDoubleArray(), y.asDoubleArray());
}

private Histogram2DTrace(Histogram2DBuilder builder) {
super(builder);
this.x = builder.x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import java.io.UncheckedIOException;
import java.io.Writer;
import java.util.Map;
import tech.tablesaw.api.NumericColumn;
import tech.tablesaw.columns.Column;
import tech.tablesaw.plotly.Utils;
import tech.tablesaw.plotly.components.Marker;

Expand Down Expand Up @@ -67,15 +65,6 @@ public static HistogramBuilder builder(double[] values) {
return new HistogramBuilder(values);
}

public static HistogramBuilder builder(NumericColumn<? extends Number> values) {
return new HistogramBuilder(values.asDoubleArray());
}

public static HistogramBuilder builder(
Column<?> xValues, NumericColumn<? extends Number> values) {
return new HistogramBuilder(xValues.asObjectArray(), values.asDoubleArray());
}

private HistogramTrace(HistogramBuilder builder) {
super(builder);
if (builder.horizontal) {
Expand Down Expand Up @@ -268,11 +257,6 @@ public HistogramBuilder y(double[] y) {
return this;
}

public HistogramBuilder y(NumericColumn<? extends Number> values) {
this.y = values.asObjectArray();
return this;
}

public HistogramTrace build() {
return new HistogramTrace(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import java.io.UncheckedIOException;
import java.io.Writer;
import java.util.Map;
import tech.tablesaw.api.NumericColumn;
import tech.tablesaw.columns.Column;
import tech.tablesaw.plotly.Utils;
import tech.tablesaw.plotly.components.Domain;

Expand Down Expand Up @@ -59,10 +57,6 @@ public static PieBuilder builder(Object[] labels, double[] values) {
return new PieBuilder(labels, values);
}

public static PieBuilder builder(Column<?> labels, NumericColumn<? extends Number> values) {
return new PieBuilder(TraceBuilder.columnToStringArray(labels), values.asDoubleArray());
}

public static class PieBuilder extends TraceBuilder {

private final String type = "pie";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.io.UncheckedIOException;
import java.io.Writer;
import java.util.Map;
import tech.tablesaw.api.NumericColumn;
import tech.tablesaw.plotly.components.HoverLabel;
import tech.tablesaw.plotly.components.Marker;

Expand All @@ -28,13 +27,6 @@ public static Scatter3DBuilder builder(double[] x, double[] y, double[] z) {
return new Scatter3DBuilder(x, y, z);
}

public static Scatter3DBuilder builder(
NumericColumn<? extends Number> x,
NumericColumn<? extends Number> y,
NumericColumn<? extends Number> z) {
return new Scatter3DBuilder(x, y, z);
}

private Scatter3DTrace(Scatter3DBuilder builder) {
super(builder);
this.mode = builder.mode;
Expand Down Expand Up @@ -121,15 +113,6 @@ private Scatter3DBuilder(double[] x, double[] y, double[] z) {
this.z = z;
}

private Scatter3DBuilder(
NumericColumn<? extends Number> x,
NumericColumn<? extends Number> y,
NumericColumn<? extends Number> z) {
this.x = x.asDoubleArray();
this.y = y.asDoubleArray();
this.z = z.asDoubleArray();
}

public Scatter3DBuilder mode(Mode mode) {
this.mode = mode;
return this;
Expand Down
51 changes: 19 additions & 32 deletions jsplot/src/main/java/tech/tablesaw/plotly/traces/ScatterTrace.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import java.io.UncheckedIOException;
import java.io.Writer;
import java.util.Map;
import tech.tablesaw.api.NumericColumn;
import tech.tablesaw.columns.Column;
import tech.tablesaw.plotly.components.HoverLabel;
import tech.tablesaw.plotly.components.Line;
import tech.tablesaw.plotly.components.Marker;
Expand Down Expand Up @@ -85,19 +83,6 @@ public static ScatterBuilder builder(double[] x, double[] y) {
return new ScatterBuilder(x, y);
}

public static ScatterBuilder builder(Column<?> x, Column<?> y) {
return new ScatterBuilder(x, y);
}

public static ScatterBuilder builder(
Column<?> x,
NumericColumn<? extends Number> open,
NumericColumn<? extends Number> high,
NumericColumn<? extends Number> low,
NumericColumn<? extends Number> close) {
return new ScatterBuilder(x, open, high, low, close);
}

private ScatterTrace(ScatterBuilder builder) {
super(builder);
this.mode = builder.mode;
Expand Down Expand Up @@ -269,23 +254,25 @@ private ScatterBuilder(double[] x, double[] y) {
this.y = y1;
}

private ScatterBuilder(Column<?> x, Column<?> y) {
this.x = x.asObjectArray();
this.y = y.asObjectArray();
}

private ScatterBuilder(
Column<?> x,
NumericColumn<? extends Number> open,
NumericColumn<? extends Number> high,
NumericColumn<? extends Number> low,
NumericColumn<? extends Number> close) {
this.x = x.asObjectArray();
this.open = open.asDoubleArray();
this.high = high.asDoubleArray();
this.low = low.asDoubleArray();
this.close = close.asDoubleArray();
}
/*
private ScatterBuilder(Column<?> x, Column<?> y) {
this.x = x.asObjectArray();
this.y = y.asObjectArray();
}
private ScatterBuilder(
Column<?> x,
NumericColumn<? extends Number> open,
NumericColumn<? extends Number> high,
NumericColumn<? extends Number> low,
NumericColumn<? extends Number> close) {
this.x = x.asObjectArray();
this.open = open.asDoubleArray();
this.high = high.asDoubleArray();
this.low = low.asDoubleArray();
this.close = close.asDoubleArray();
}
*/

public ScatterBuilder mode(Mode mode) {
this.mode = mode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package tech.tablesaw.plotly.traces;

import com.google.common.base.Preconditions;
import tech.tablesaw.columns.Column;
import tech.tablesaw.plotly.components.HoverLabel;

public abstract class TraceBuilder {
Expand Down Expand Up @@ -79,14 +78,6 @@ protected TraceBuilder hoverLabel(HoverLabel hoverLabel) {
return this;
}

protected static String[] columnToStringArray(Column<?> column) {
String[] x = new String[column.size()];
for (int i = 0; i < column.size(); i++) {
x[i] = column.getString(i);
}
return x;
}

public TraceBuilder xAxis(String xAxis) {
Preconditions.checkArgument(xAxis.matches("^x[0-9]*$"));
this.xAxis = xAxis;
Expand Down
Loading

0 comments on commit 41d7753

Please sign in to comment.