Geolocation bar chart to network page

This commit is contained in:
Rsl1122 2018-07-15 20:42:49 +03:00
parent 376690acc0
commit 7b5588e19a
7 changed files with 33 additions and 5 deletions

View File

@ -16,6 +16,7 @@ import com.djrapitops.plan.system.settings.theme.ThemeVal;
import com.djrapitops.plan.utilities.MiscUtils;
import com.djrapitops.plan.utilities.html.graphs.ActivityStackGraph;
import com.djrapitops.plan.utilities.html.graphs.WorldMap;
import com.djrapitops.plan.utilities.html.graphs.bar.GeolocationBarGraph;
import com.djrapitops.plan.utilities.html.graphs.line.OnlineActivityGraph;
import com.djrapitops.plan.utilities.html.graphs.pie.ActivityPie;
import com.djrapitops.plugin.api.TimeAmount;
@ -99,6 +100,11 @@ public class NetworkContainer extends DataContainer {
putSupplier(NetworkKeys.WORLD_MAP_SERIES, () ->
new WorldMap(PlayersMutator.forContainer(bungeeContainer)).toHighChartsSeries()
);
Key<GeolocationBarGraph> geolocationBarChart = new Key<>(GeolocationBarGraph.class, "GEOLOCATION_BAR_CHART");
putSupplier(geolocationBarChart, () -> new GeolocationBarGraph(getUnsafe(NetworkKeys.PLAYERS_MUTATOR)));
putSupplier(NetworkKeys.COUNTRY_CATEGORIES, () -> getUnsafe(geolocationBarChart).toHighChartsCategories());
putSupplier(NetworkKeys.COUNTRY_SERIES, () -> getUnsafe(geolocationBarChart).toHighChartsSeries());
putSupplier(NetworkKeys.PLAYERS_ONLINE_SERIES, () ->
new OnlineActivityGraph(TPSMutator.forContainer(bungeeContainer)).toHighChartsSeries()
);

View File

@ -129,8 +129,8 @@ public class AnalysisKeys {
public static final PlaceholderKey<String> CALENDAR_SERIES = new PlaceholderKey<>(String.class, "calendarSeries");
public static final PlaceholderKey<String> UNIQUE_PLAYERS_SERIES = new PlaceholderKey<>(String.class, "uniquePlayersSeries");
public static final PlaceholderKey<String> NEW_PLAYERS_SERIES = new PlaceholderKey<>(String.class, "newPlayersSeries");
public static final PlaceholderKey<String> COUNTRY_CATEGORIES = new PlaceholderKey<>(String.class, "countryCategories");
public static final PlaceholderKey<String> COUNTRY_SERIES = new PlaceholderKey<>(String.class, "countrySeries");
public static final PlaceholderKey<String> COUNTRY_CATEGORIES = CommonPlaceholderKeys.COUNTRY_CATEGORIES;
public static final PlaceholderKey<String> COUNTRY_SERIES = CommonPlaceholderKeys.COUNTRY_SERIES;
// Variables used only during analysis
public static final Key<SessionsMutator> SESSIONS_MUTATOR = CommonKeys.SESSIONS_MUTATOR;
public static final Key<TPSMutator> TPS_MUTATOR = CommonKeys.TPS_MUTATOR;

View File

@ -22,7 +22,9 @@ class CommonPlaceholderKeys {
static final PlaceholderKey<String> ACTIVITY_STACK_SERIES = new PlaceholderKey<>(String.class, "activityStackSeries");
static final PlaceholderKey<String> ACTIVITY_STACK_CATEGORIES = new PlaceholderKey<>(String.class, "activityStackCategories");
static final PlaceholderKey<String> ACTIVITY_PIE_SERIES = new PlaceholderKey<>(String.class, "activityPieSeries");
public static final PlaceholderKey<String> COUNTRY_CATEGORIES = new PlaceholderKey<>(String.class, "countryCategories");
public static final PlaceholderKey<String> COUNTRY_SERIES = new PlaceholderKey<>(String.class, "countrySeries");
static final PlaceholderKey<String> HEALTH_NOTES = new PlaceholderKey<>(String.class, "healthNotes");
static final PlaceholderKey<Double> HEALTH_INDEX = new PlaceholderKey<>(Double.class, "healthIndex");

View File

@ -42,6 +42,8 @@ public class NetworkKeys {
public static final PlaceholderKey<String> ACTIVITY_STACK_SERIES = CommonPlaceholderKeys.ACTIVITY_STACK_SERIES;
public static final PlaceholderKey<String> ACTIVITY_STACK_CATEGORIES = CommonPlaceholderKeys.ACTIVITY_STACK_CATEGORIES;
public static final PlaceholderKey<String> ACTIVITY_PIE_SERIES = CommonPlaceholderKeys.ACTIVITY_PIE_SERIES;
public static final PlaceholderKey<String> COUNTRY_CATEGORIES = CommonPlaceholderKeys.COUNTRY_CATEGORIES;
public static final PlaceholderKey<String> COUNTRY_SERIES = CommonPlaceholderKeys.COUNTRY_SERIES;
public static final PlaceholderKey<Double> HEALTH_INDEX = CommonPlaceholderKeys.HEALTH_INDEX;
public static final PlaceholderKey<String> HEALTH_NOTES = CommonPlaceholderKeys.HEALTH_NOTES;

View File

@ -37,6 +37,7 @@ public class NetworkPage implements Page {
PLAYERS_DAY, PLAYERS_WEEK, PLAYERS_MONTH,
PLAYERS_NEW_DAY, PLAYERS_NEW_WEEK, PLAYERS_NEW_MONTH,
WORLD_MAP_SERIES, WORLD_MAP_HIGH_COLOR, WORLD_MAP_LOW_COLOR,
COUNTRY_CATEGORIES, COUNTRY_SERIES,
HEALTH_INDEX, HEALTH_NOTES,
ACTIVITY_PIE_SERIES, ACTIVITY_STACK_SERIES, ACTIVITY_STACK_CATEGORIES
);

View File

@ -122,6 +122,7 @@ public class HtmlExport extends SpecificExport {
"web/js/script.js",
"web/js/charts/activityPie.js",
"web/js/charts/lineGraph.js",
"web/js/charts/horizontalBarGraph.js",
"web/js/charts/stackGraph.js",
"web/js/charts/performanceGraph.js",
"web/js/charts/playerGraph.js",

View File

@ -473,7 +473,14 @@
</div>
</div>
<div class="body">
<div id="worldMap" class="dashboard-flot-chart"></div>
<div class="row clearfix">
<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
<div id="countryBarChart" class="dashboard-flot-chart"></div>
</div>
<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9">
<div id="worldMap" class="dashboard-flot-chart"></div>
</div>
</div>
</div>
</div>
</div>
@ -511,6 +518,7 @@
<script src="../js/charts/activityPie.js"></script>
<script src="../js/charts/stackGraph.js"></script>
<script src="../js/charts/worldMap.js"></script>
<script src="../js/charts/horizontalBarGraph.js"></script>
<!-- Chart Data -->
<script>
@ -533,7 +541,9 @@
geolocations: ${geoMapSeries},
activityStack: ${activityStackSeries},
activityStackCategories: ${activityStackCategories},
healthIndex: ${healthIndex}
healthIndex: ${healthIndex},
countryCategories: ${countryCategories},
country: ${countrySeries}
}
};
// HighCharts Series
@ -559,6 +569,11 @@
colorByPoint: true,
data: v.data.activityPie
},
country: {
color: '#4CAF50',
name: 'Players',
data: v.data.country
},
activityStack: v.data.activityStack,
activityStackCategories: v.data.activityStackCategories
};
@ -590,6 +605,7 @@
stackChart('activityStackGraph', series.activityStackCategories, series.activityStack, 'Players');
healthGauge('healthGauge', [v.data.healthIndex]);
worldMap('worldMap', v.colors.geolocationsLow, v.colors.geolocationsHigh, series.geolocations);
horizontalBarChart('countryBarChart', v.data.countryCategories, [series.country], 'Players');
function openFunc(i) {
return function () {