Skip to content

Commit

Permalink
add income / age distr with absolute numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
simei94 committed Dec 2, 2024
1 parent 5a90abd commit ae77cbc
Showing 1 changed file with 53 additions and 26 deletions.
79 changes: 53 additions & 26 deletions src/main/java/org/matsim/dashboards/PtLineDashboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
public class PtLineDashboard implements Dashboard {
private final String basePath;
private static final String SHARE = "share";
private static final String ABSOLUTE = "Count [person]";
private static final String INCOME_GROUP = "incomeGroup";
private static final String DESCRIPTION = "... in base and policy case";

PtLineDashboard(String basePath) {
if (!basePath.endsWith("/")) {
Expand All @@ -40,25 +43,36 @@ public void configure(Header header, Layout layout) {
viz.height = 0.1;
});

layout.row("second")
layout.row("income")
.el(Bar.class, (viz, data) -> {
viz.title = "Agents per income group";
viz.stacked = false;
viz.dataset = data.compute(PtLineAnalysis.class, "pt_persons_income_groups.csv", args);
viz.x = "incomeGroup";
viz.xAxisName = "income group";
viz.x = INCOME_GROUP;
viz.xAxisName = INCOME_GROUP;
viz.yAxisName = SHARE;
viz.columns = List.of(SHARE);
})
.el(Bar.class, (viz, data) -> {
viz.title = "Agents per income group";
viz.stacked = false;
viz.dataset = data.compute(PtLineAnalysis.class, "pt_persons_income_groups.csv", args);
viz.x = INCOME_GROUP;
viz.xAxisName = INCOME_GROUP;
viz.yAxisName = ABSOLUTE;
viz.columns = List.of(ABSOLUTE);
})
.el(Bar.class, (viz, data) -> {
viz.title = "Mean score per income group";
viz.stacked = false;
viz.dataset = data.compute(PtLineAnalysis.class, "pt_persons_mean_score_per_income_group.csv", args);
viz.x = "incomeGroup";
viz.xAxisName = "income group";
viz.x = INCOME_GROUP;
viz.xAxisName = INCOME_GROUP;
viz.yAxisName = "mean score";
viz.columns = List.of("mean_score_base", "mean_score_policy");
})
});

layout.row("age")
.el(Bar.class, (viz, data) -> {
viz.title = "Agents per age group";
viz.stacked = false;
Expand All @@ -67,7 +81,16 @@ public void configure(Header header, Layout layout) {
viz.xAxisName = "age group";
viz.yAxisName = SHARE;
viz.columns = List.of(SHARE);
});
})
.el(Bar.class, (viz, data) -> {
viz.title = "Agents per age group";
viz.stacked = false;
viz.dataset = data.compute(PtLineAnalysis.class, "pt_persons_age_groups.csv", args);
viz.x = "ageGroup";
viz.xAxisName = "age group";
viz.yAxisName = ABSOLUTE;
viz.columns = List.of(ABSOLUTE);
});

layout.row("third")
.el(Plotly.class, (viz, data) -> {
Expand Down Expand Up @@ -103,24 +126,28 @@ public void configure(Header header, Layout layout) {
viz.addAggregation("home locations", "person", "home_x", "home_y");
});

layout.row("fourth")
.el(Table.class, (viz, data) -> {
viz.title = "Executed scores";
viz.description = "... in base and policy case";
viz.dataset = data.compute(PtLineAnalysis.class, "pt_persons_executed_score.csv");
viz.showAllRows = true;
})
.el(Table.class, (viz, data) -> {
viz.title = "Travel times";
viz.description = "... in base and policy case";
viz.dataset = data.compute(PtLineAnalysis.class, "pt_persons_trav_time.csv");
viz.showAllRows = true;
})
.el(Table.class, (viz, data) -> {
viz.title = "Travel distances";
viz.description = "... in base and policy case";
viz.dataset = data.compute(PtLineAnalysis.class, "pt_persons_traveled_distance.csv");
viz.showAllRows = true;
});
createTableLayouts(layout);
}

private static void createTableLayouts(Layout layout) {
layout.row("fourth")
.el(Table.class, (viz, data) -> {
viz.title = "Executed scores";
viz.description = DESCRIPTION;
viz.dataset = data.compute(PtLineAnalysis.class, "pt_persons_executed_score.csv");
viz.showAllRows = true;
})
.el(Table.class, (viz, data) -> {
viz.title = "Travel times";
viz.description = DESCRIPTION;
viz.dataset = data.compute(PtLineAnalysis.class, "pt_persons_trav_time.csv");
viz.showAllRows = true;
})
.el(Table.class, (viz, data) -> {
viz.title = "Travel distances";
viz.description = DESCRIPTION;
viz.dataset = data.compute(PtLineAnalysis.class, "pt_persons_traveled_distance.csv");
viz.showAllRows = true;
});
}
}

0 comments on commit ae77cbc

Please sign in to comment.