Created
April 30, 2021 18:08
-
-
Save jesuino/2cce4b021ae77fa060915978537af5f3 to your computer and use it in GitHub Desktop.
Sample Pokemon Dashboard
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
var pokemonDs = DataSetDefFactory.newCSVDataSetDef() | |
.uuid("pokemon_data") | |
.fileURL(CSV_URL) | |
.separatorChar(',') | |
.quoteChar('"') | |
.buildDef(); | |
var page = page("Pokemons Example", | |
row("<h1>Pokemon Dashboard</h1>"), | |
row("<hr />"), | |
row("<h3>All Data</h3>"), | |
row(displayer(newTableSettings().tableColumnPickerEnabled(false) | |
.dataset(pokemonDs.getUUID()) | |
.column("name") | |
.column("attack") | |
.column("defense") | |
.column("hp") | |
.column("speed") | |
.column("type1") | |
.column("type2") | |
.column("generation") | |
.buildSettings())), | |
row("<h3>Pokemon by type</h3>"), | |
row(displayer(newPieChartSettings().legendOn(Position.RIGHT) | |
.dataset(pokemonDs.getUUID()) | |
.group("type1") | |
.column("type1") | |
.column("type1", | |
AggregateFunctionType.COUNT) | |
.buildSettings())), | |
row("<hr />"), | |
row("<h3>Average Stats by Type</h3>"), | |
row(displayer(DisplayerSettingsFactory.newBarChartSettings() | |
.width(1200) | |
.subType_Column() | |
.dataset(pokemonDs.getUUID()) | |
.group("type1") | |
.column("type1") | |
.column("attack", | |
AggregateFunctionType.AVERAGE, | |
"Attack") | |
.column("defense", | |
AggregateFunctionType.AVERAGE, | |
"Defense") | |
.column("hp", | |
AggregateFunctionType.AVERAGE, | |
"HP") | |
.column("speed", | |
AggregateFunctionType.AVERAGE, | |
"Speed") | |
.buildSettings())), | |
row(column(html("<em> Generated at " + new Date() + "</em>")))); | |
var dasboard = dashboard(List.of(page), List.of(pokemonDs)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment