Skip to content

Commit

Permalink
Autodd pie template + overhaul of Autodd grammar (tracyhenry#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
houxinli authored and tracyhenry committed Oct 30, 2019
1 parent 38ccb33 commit 0ce6879
Show file tree
Hide file tree
Showing 22 changed files with 1,492 additions and 953 deletions.
2 changes: 1 addition & 1 deletion back-end/src/main/java/box/BoxandData.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static ArrayList<ArrayList<HashMap<String, String>>> getDictionaryFromDat

// cluster number field for autodd layer
if (curLayer.getIndexerType().equals("AutoDDInMemoryIndexer")) {
rowDict.put("cluster_agg", rowArray.get(numFields));
rowDict.put("clusterAgg", rowArray.get(numFields));
numFields++;
}

Expand Down
424 changes: 220 additions & 204 deletions back-end/src/main/java/index/AutoDDInMemoryIndexer.java

Large diffs are not rendered by default.

28 changes: 13 additions & 15 deletions back-end/src/main/java/project/AutoDD.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ public class AutoDD {
private String query, db;
private String xCol, yCol;
private int bboxW, bboxH;
private String rendering;
private String renderingMode;
private ArrayList<String> columnNames, aggColumns, queriedColumnNames = null;
private String clusterMode;
private ArrayList<String> columnNames, queriedColumnNames = null;
private ArrayList<String> aggDimensionFields, aggMeasureFields;
private int numLevels, topLevelWidth, topLevelHeight;
private boolean overlap;
private double zoomFactor;
Expand Down Expand Up @@ -44,12 +44,8 @@ public int getBboxH() {
return bboxH;
}

public String getRenderingMode() {
return renderingMode;
}

public String getRendering() {
return rendering;
public String getClusterMode() {
return clusterMode;
}

public boolean getOverlap() {
Expand Down Expand Up @@ -95,8 +91,12 @@ public ArrayList<String> getColumnNames() {
return queriedColumnNames;
}

public ArrayList<String> getAggColumns() {
return aggColumns;
public ArrayList<String> getAggDimensionFields() {
return aggDimensionFields;
}

public ArrayList<String> getAggMeasureFields() {
return aggMeasureFields;
}

public int getNumLevels() {
Expand Down Expand Up @@ -168,11 +168,9 @@ public String toString() {
+ bboxW
+ ", bboxH="
+ bboxH
+ ", rendering='"
+ rendering
+ '\''
+ ", renderingMode='"
+ renderingMode
+ ", clusterMode='"
+ clusterMode
+ '\''
+ ", columnNames="
+ columnNames
Expand Down
2 changes: 1 addition & 1 deletion back-end/src/main/java/project/Layer.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public String getColStr(String tableName) {
String colListStr = "";
for (String col : transform.getColumnNames())
colListStr += (tableName.isEmpty() ? "" : tableName + ".") + col + ", ";
if (getIndexerType().equals("AutoDDInMemoryIndexer")) colListStr += "cluster_agg, ";
if (getIndexerType().equals("AutoDDInMemoryIndexer")) colListStr += "clusterAgg, ";
colListStr += "cx, cy, minx, miny, maxx, maxy";
return colListStr;
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/examples/flare/renderers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var renderingParams = {
textwrap: require("../../src/template-api/Renderers").textwrap
textwrap: require("../../src/template-api/Utilities").textwrap
};

var flarePackRendering = function(svg, data, args) {
Expand Down
2 changes: 1 addition & 1 deletion compiler/examples/nba/renderers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var renderingParams = {
teamlogoradius: 24,
avgcharwidth: 20,
shadowrectwidth: 5,
textwrap: require("../../src/template-api/Renderers").textwrap
textwrap: require("../../src/template-api/Utilities").textwrap
};

var teamLogoRendering = function(svg, data) {
Expand Down
37 changes: 23 additions & 14 deletions compiler/examples/template-api-examples/AutoDD_circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,40 @@ p.addStyles("../nba/nba.css");
var query =
"select game_id, year, month, day, team1.abbr as home_team, team2.abbr as away_team, home_score, away_score, team1.rank + team2.rank as agg_rank " +
"from games, teams as team1, teams as team2 " +
"where games.home_team = team1.abbr and games.away_team = team2.abbr " +
"order by agg_rank;";
"where games.home_team = team1.abbr and games.away_team = team2.abbr ";

var autoDD = {
data: {
db: "nba",
query: query
},
x: {
col: "home_score",
range: [69, 149]
field: "home_score",
extent: [69, 149]
},
y: {
col: "away_score",
range: [69, 148]
field: "away_score",
extent: [69, 148]
},
rendering: {
// mode: "circle",
mode: "circle+object",
axis: true,
obj: {
renderer: renderers.teamTimelineRendering,
bboxW: 162,
bboxH: 132
z: {
field: "agg_rank",
order: "asc"
},
marks: {
cluster: {
mode: "circle",
config: {
// circleMinSize: 30,
// circleMaxSize: 70
}
},
hover: {
object: renderers.teamTimelineRendering
// convex: true
}
},
config: {
axis: true
}
};

Expand Down
40 changes: 23 additions & 17 deletions compiler/examples/template-api-examples/AutoDD_contour.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,40 @@ p.addStyles("../nba/nba.css");
var query =
"select game_id, year, month, day, team1.abbr as home_team, team2.abbr as away_team, home_score, away_score, team1.rank + team2.rank as agg_rank " +
"from games, teams as team1, teams as team2 " +
"where games.home_team = team1.abbr and games.away_team = team2.abbr " +
"order by agg_rank;";
"where games.home_team = team1.abbr and games.away_team = team2.abbr ";

var autoDD = {
data: {
db: "nba",
query: query
},
x: {
col: "home_score",
range: [69, 149]
field: "home_score",
extent: [69, 149]
},
y: {
col: "away_score",
range: [69, 148]
field: "away_score",
extent: [69, 148]
},
rendering: {
// mode: "contour",
mode: "contour+object",
axis: true,
// contourColorScheme: "interpolateBlues",
// contourOpacity: 0.5,
// contourBandwidth: 50,
obj: {
renderer: renderers.teamTimelineRendering,
bboxW: 162,
bboxH: 132
z: {
field: "agg_rank",
order: "asc"
},
marks: {
cluster: {
mode: "contour",
config: {
// contourColorScheme: "interpolateBlues",
// contourOpacity: 0.5,
// contourBandwidth: 50,
}
},
hover: {
object: renderers.teamTimelineRendering
}
},
config: {
axis: true
}
};

Expand Down
69 changes: 0 additions & 69 deletions compiler/examples/template-api-examples/AutoDD_glyph_radar.js

This file was deleted.

38 changes: 22 additions & 16 deletions compiler/examples/template-api-examples/AutoDD_heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,39 @@ p.addStyles("../nba/nba.css");
var query =
"select game_id, year, month, day, team1.abbr as home_team, team2.abbr as away_team, home_score, away_score, team1.rank + team2.rank as agg_rank " +
"from games, teams as team1, teams as team2 " +
"where games.home_team = team1.abbr and games.away_team = team2.abbr " +
"order by agg_rank;";
"where games.home_team = team1.abbr and games.away_team = team2.abbr ";

var autoDD = {
data: {
db: "nba",
query: query
},
x: {
col: "home_score",
range: [69, 149]
field: "home_score",
extent: [69, 149]
},
y: {
col: "away_score",
range: [69, 148]
field: "away_score",
extent: [69, 148]
},
rendering: {
// mode: "heatmap",
mode: "heatmap+object",
axis: true,
// heatmapRadius: 90,
// heatmapOpacity: 0.5,
obj: {
renderer: renderers.teamTimelineRendering,
bboxW: 162,
bboxH: 132
z: {
field: "agg_rank",
order: "asc"
},
marks: {
cluster: {
mode: "heatmap",
config: {
// heatmapRadius: 90,
// heatmapOpacity: 0.5,
}
},
hover: {
object: renderers.teamTimelineRendering
}
},
config: {
axis: true
}
};

Expand Down
35 changes: 21 additions & 14 deletions compiler/examples/template-api-examples/AutoDD_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,38 @@ p.addStyles("../nba/nba.css");
var query =
"select game_id, year, month, day, team1.abbr as home_team, team2.abbr as away_team, home_score, away_score, team1.rank + team2.rank as agg_rank " +
"from games, teams as team1, teams as team2 " +
"where games.home_team = team1.abbr and games.away_team = team2.abbr " +
"order by agg_rank;";
"where games.home_team = team1.abbr and games.away_team = team2.abbr ";

var autoDD = {
data: {
db: "nba",
query: query
},
x: {
col: "home_score",
range: [69, 149]
field: "home_score",
extent: [69, 149]
},
y: {
col: "away_score",
range: [69, 148]
field: "away_score",
extent: [69, 148]
},
rendering: {
// mode: "object",
mode: "object+clusternum",
axis: true,
obj: {
renderer: renderers.teamTimelineRendering,
bboxW: 162,
bboxH: 132
z: {
field: "agg_rank",
order: "asc"
},
marks: {
cluster: {
mode: "object",
object: renderers.teamTimelineRendering,
config: {
clusterCount: true,
bboxW: 162,
bboxH: 132
}
}
},
config: {
axis: true
}
};

Expand Down
Loading

0 comments on commit 0ce6879

Please sign in to comment.