Skip to content

Instantly share code, notes, and snippets.

@Bastian
Last active May 13, 2021 17:43
Show Gist options
  • Save Bastian/b35de0cfe951f2d7cacabf65762bfb3d to your computer and use it in GitHub Desktop.
Save Bastian/b35de0cfe951f2d7cacabf65762bfb3d to your computer and use it in GitHub Desktop.
Drilldown Pie example
@Override
public void onEnable() {
Metrics metrics = new Metrics(this);
metrics.addCustomChart(new DrilldownPie("java_version", () -> {
Map<String, Map<String, Integer>> map = new HashMap<>();
String javaVersion = System.getProperty("java.version");
Map<String, Integer> entry = new HashMap<>();
entry.put(javaVersion, 1);
if (javaVersion.startsWith("1.7")) {
map.put("Java 1.7", entry);
} else if (javaVersion.startsWith("1.8")) {
map.put("Java 1.8", entry);
} else if (javaVersion.startsWith("1.9")) {
map.put("Java 1.9", entry);
} else {
map.put("Other", entry);
}
return map;
}));
}
// If you use the Copy & Paste Metrics classes, use `Metrics.DrilldownPie` instead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment