A report is a definition of what data should be shown in the component and how it should be visualized.
Reports are written in JSON. XML reports are also supported for backward compatibility.
Report objects were used to connect to JSON, CSV, SQL databases, MongoDB, Microsoft Analysis Services, Pentaho Mondrian, Elasticsearch, and custom data source API in previous articles of the documentation.
This set of articles focuses on how to configure properties in a report.
A report object has many properties – all possible aspects of pivot table and pivot chart configuration can be set via a report object. The component supports saving and loading reports.
Report properties are logically divided into the parts. Follow the tutorials to configure each part:
If the data contains date and time values, check out the date and time formatting tutorial.
Our Examples page contains a list of examples that demonstrate different ways of working with a report. Check them out.
The simplest report consists of only the data source definition.
Let’s see how the simplest report that defines a connection to a static CSV file looks like in JSON:
{ dataSource: { filename: "data.csv" } }
This is how the above report is set in new Flexmonster()
:
var pivot = new Flexmonster({
container: "pivotContainer",
toolbar: true,
report: {
dataSource: {
filename: "data.csv"
}
}
});
Open on JSFiddle.
If you use an alphabet with special characters, it is necessary to set UTF-8 encoding. There are two ways to do this:
content-type
HTTP header or the corresponding meta
tag: <meta http-equiv="content-type" content="text/html; charset=utf-8" />Content from the database or static report files must also be encoded as UTF-8.
<script src="yourfile.js" charset="UTF-8"></script>