1
1
package tech .tablesaw .plotly .api ;
2
2
3
3
import java .util .List ;
4
+ import tech .tablesaw .api .NumericColumn ;
4
5
import tech .tablesaw .api .Table ;
5
- import tech .tablesaw .columns .Column ;
6
6
import tech .tablesaw .plotly .components .Figure ;
7
7
import tech .tablesaw .plotly .components .Layout ;
8
8
import tech .tablesaw .plotly .components .Marker ;
@@ -40,23 +40,21 @@ public static Figure create(
40
40
return new Figure (layout , traces );
41
41
}
42
42
43
- public static Figure create (
43
+ private static Figure create (
44
44
String title ,
45
- Table table ,
46
- String xCol ,
47
- Column xColumn ,
48
- String yCol ,
49
- Column yColumn ,
50
- String sizeColumn ,
45
+ NumericColumn xColumn ,
46
+ NumericColumn yColumn ,
47
+ NumericColumn sizeColumn ,
51
48
double [] color ,
52
49
SizeMode sizeMode ,
53
50
Double opacity ) {
54
- Layout layout = Layout .builder (title , xCol , yCol ).build ();
51
+
52
+ Layout layout = Layout .builder (title , xColumn .name (), yColumn .name ()).build ();
55
53
56
54
Marker marker = null ;
57
55
MarkerBuilder builder = Marker .builder ();
58
56
if (sizeColumn != null ) {
59
- builder .size (table . numberColumn ( sizeColumn ) );
57
+ builder .size (sizeColumn );
60
58
}
61
59
if (opacity != null ) {
62
60
builder .opacity (opacity );
@@ -69,16 +67,15 @@ public static Figure create(
69
67
}
70
68
marker = builder .build ();
71
69
72
- xColumn = (xColumn == null ) ? table .numberColumn (xCol ) : xColumn ;
73
- yColumn = (yColumn == null ) ? table .numberColumn (yCol ) : yColumn ;
74
-
75
70
ScatterTrace trace = ScatterTrace .builder (xColumn , yColumn ).marker (marker ).build ();
76
71
return new Figure (layout , trace );
77
72
}
78
73
79
- public static Figure create (
80
- String title , Table table , String xCol , String yCol , String sizeColumn ) {
81
- return create (title , table , xCol , null , yCol , null , sizeColumn , null , null , null );
74
+ public static Figure create (String title , Table table , String xCol , String yCol , String sizeCol ) {
75
+ NumericColumn xColumn = table .numberColumn (xCol );
76
+ NumericColumn yColumn = table .numberColumn (yCol );
77
+ NumericColumn sizeColumn = table .numberColumn (sizeCol );
78
+ return create (title , xColumn , yColumn , sizeColumn , null , null , null );
82
79
}
83
80
84
81
public static Figure create (
0 commit comments