Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sample Pokemon Dashboard
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