A java library to generate self-containing html reports and dashboards
Reporting and data visualization is key in data science. magic-reports
provides a simple template based library to create self-containing html reports.
Add the following dependency to your Maven Project:
<dependency>
<groupId>com.github.lukfor</groupId>
<artifactId>magic-reports</artifactId>
<version>0.0.1</version>
</dependency>
Or include it as a dependency in your Gradle project:
compile 'com.github.lukfor:magic-reports:0.0.1'
List<Person> persons = ...;
HtmlWidgetReport report = new HtmlWidgetReport("/example");
report.set("persons", persons);
report.generate(new File("example.html"));
{{import_widget("data_table")}}
{{
data_table({
columns: [
{data: "firstName", title: "First Name"},
{data: "lastName", title: "Last Name"},
{data: "email", title: "E-Mail"}
],
data: persons
})
}}
{{import_widget("plotly")}}
{{
plotly({
traces: [{
x: array(persons).extract("age"),
y: array(persons).extract("salary"),
mode: "markers",
type: "scatter"
}],
layout: {
plot_bgcolor: "rgba(255,255,255,1)"
}
})
}}
{{import_widget("vega_lite")}}
{{
vega_lite({
$schema: "https://vega.github.io/schema/vega-lite/v4.json",
data: {
values: {{json(persons)}}
},
mark: "point",
encoding: {
x: {
field: "age",
type: "quantitative"
},
y: {
field: "salary",
type: "quantitative"
}
},
width: 1000
})
}}
import_script("path_or_url/to/script.js")
array(object).extract("property")
json(object)
import_style("path_or_url/to/style.css")
import_style("path_or_url/to/style.css")
magic-reports
is MIT Licensed.