Flexmonster Software License Agreement (“Agreement”) has been significantly revised and is effective as of September 30, 2024.
The following modifications were made:
The modified version of Flexmonster Software License Agreement is available here.
Downloading, installing, and/or continuing to use Flexmonster Software after September 30, 2024, constitutes Licensee’s acceptance of the terms and conditions of the modified version of Flexmonster Software License Agreement. If Licensee does not agree to any of these terms and conditions, they must cease using Flexmonster Software and must not download, install, use, access, or continue to access Flexmonster Software. By continuing to use Flexmonster Software or renewing the license under License Model or Maintenance after the effective date of any modifications to Agreement, Licensee accepts and agrees to be bound by the terms and conditions of the modified Agreement.
This tutorial will help you integrate the pivot table with webpack. Follow these steps to set up a simple webpack project using Flexmonster Pivot Table & Charts:
To get our sample project, download it as ZIP or clone it with the following commands:
git clone https://github.com/flexmonster/pivot-webpack
cd pivot-webpack
Install the npm dependencies described in package.json
:
npm install
Run in the console:
npm start
After that, the working sample will be available at http://localhost:8080/
.
Let’s take a closer look at the folder structure of this application:
dist/
index.html
– here we add the <div>
container for Flexmonster.src/
index.js
– here we embed our pivot table.package.json
– contains the description of the npm dependencies.webpack.config.js
– the webpack configuration file with standard CSS and font loading.Take a look at the content of the key files:
// ES2015
import 'flexmonster/flexmonster.min.css';
import Flexmonster from 'flexmonster';
// CommonJS
// require('flexmonster/flexmonster.min.css');
// const Flexmonster = require('flexmonster');
new Flexmonster({
container: "#pivot",
toolbar: true,
report: {
dataSource: {
type: "json",
filename: "https://cdn.flexmonster.com/data/retail-data.json",
mapping: {
// Mapping configuration
}
},
slice: {
// Slice configuration
},
conditions: [
// Conditional formatting
],
formats: [
// Number formatting
]
}
})
const path = require('path');
module.exports = {
mode: 'development',
entry: {
app: './src/index.js',
},
devServer: {
static: './dist'
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
]
},
{
test: /\.(woff|woff2|eot|ttf|otf|svg)$/,
type: "asset/inline"
}
]
}
};
<!DOCTYPE html> <html> <head> <title>Flexmonster / Webpack</title> </head> <body> <div id="pivot"></div> <script src="bundle.js"></script> </body> </html>
You may be interested in the following articles: