This guide will walk you through the process of transitioning from WebDataRocks to Flexmonster.
Let’s break the migration into small steps:
All the possible ways of getting Flexmonster are described in the Get Flexmonster guide.
Next, replace the WebDataRocks initialization API call with Flexmonster’s:
var pivot = new Flexmonster({
container: "pivotContainer",
report: {
dataSource: {
filename: "data.csv"
}
}
});
Notice the differences between the init API calls of Flexmonster and WebDataRocks.
Flexmonster has an additional componentFolder
parameter, which should point to the flexmonster/
folder. Read more about Flexmonster initialization parameters.
In WebDataRocks, we specified which hierarchies to put into the rows, columns, and measures by defining a SliceObject. The structure of the slice in Flexmonster is no different, except that measures should be placed in square brackets:
"slice": {
"rows": [
{ "uniqueName": "Customer" }
],
"columns": [
{ "uniqueName": "Month" },
{ "uniqueName": "[Measures]" }
],
"measures": [
{
"uniqueName": "Revenue",
"aggregation": "sum"
}
]
}
Flexmonster allows you to connect to many more types of data sources. On top of CSV and JSON, you can analyze data from relational or NoSQL databases, MongoDB, Elasticsearch, SSAS, and custom data source API. To learn how to connect to these sources, refer to the following guides:
If you are working on an Angular project, follow these steps:
Step 1. Install Flexmonster CLI — the most convenient way to work with Flexmonster Pivot:
npm install -g flexmonster-cli
A new flexmonster
command is now available in the console.
Step 2. Install the Flexmonster Angular module by running the following Flexmonster CLI command from the folder containing package.json
:
flexmonster add ng-flexmonster
This command installs the ng-flexmonster
package to node_modules/
and adds it as an npm dependency to package.json
.
Step 3. Add CSS and JS references to the angular.json
file:
"styles": [
"styles.css",
"/node_modules/flexmonster/flexmonster.min.css"
],
"scripts": ["/node_modules/flexmonster/flexmonster.full.js"]
Step 4. Replace the WebDataRocksPivot module with FlexmonsterPivotModule in app.module.ts
. app.module.ts
can be found inside the PROJECT-NAME/src/app
folder. It should look as follows:
import { FlexmonsterPivotModule } from 'ng-flexmonster';
@NgModule({
...
imports: [FlexmonsterPivotModule],
... })
Step 5. Find the wbr-pivot
directive that includes the pivot table and replace it with the fm-pivot
directive. Here is an example:
<wbr-pivot
[report]="'https://cdn.flexmonster.com/reports/report.json'">
</wbr-pivot>
should be changed to:
<fm-pivot
[report]="'https://cdn.flexmonster.com/reports/report.json'">
</fm-pivot>
Step 6. Build and run your application from the console:
ng serve
The default port that the application listens to is 4200
. Open http://localhost:4200/
in your browser to see the results.
To find out more about integrating Flexmonster Pivot with Angular, check out the Integration with Angular guide.