Last active
May 13, 2021 17:43
-
-
Save Bastian/b35de0cfe951f2d7cacabf65762bfb3d to your computer and use it in GitHub Desktop.
Drilldown Pie example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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