This plugin integrates Chart.js into your GrapesJS editor 🚀🚀. You can add various types of charts 📊 to your projects and customize them according to your needs.
⭐ Star me on GitHub — it motivates me a lot!
- Plugin name:
grapesjs-chartjs-plugin
- Components
chartjs
- Blocks
chartjs-bar
chartjs-line
chartjs-pie
chartjs-doughnut
chartjs-polarArea
chartjs-radar
chartjs-bubble
chartjs-scatter
Option | Description | Default |
---|---|---|
chartjsOptions |
This object will be passed directly to the underlying Chart.js options . See here for more info. |
{ maintainAspectRatio: false } |
blocks |
Which blocks to add. | [ "chartjs-bar", "chartjs-line", "chartjs-pie", "chartjs-doughnut", "chartjs-polarArea", "chartjs-radar", "chartjs-bubble", "chartjs-scatter" ] |
category |
Category name. By default the category value of the i18n en locale file will be used. |
{ id: 'chartjs', label: "Charts" } |
i18n |
Object used to translate plugin properties. Check the en locale file and follow its inner path. |
en |
- CDN
https://unpkg.com/grapesjs-chartjs-plugin
- NPM
npm i grapesjs-chartjs-plugin
- GIT
git clone https://github.com/fasenderos/grapesjs-chartjs-plugin.git
Directly in the browser
<link
href="https://unpkg.com/grapesjs/dist/css/grapes.min.css"
rel="stylesheet"
/>
<script src="https://unpkg.com/grapesjs"></script>
<script src="https://unpkg.com/grapesjs-chartjs-plugin"></script>
<div id="gjs"></div>
<script type="text/javascript">
var editor = grapesjs.init({
container: "#gjs",
// ...
plugins: ["grapesjs-chartjs-plugin"],
pluginsOpts: {
"grapesjs-chartjs-plugin": {
/* options */
},
},
});
</script>
Modern javascript
import grapesjs from 'grapesjs';
import plugin from 'grapesjs-chartjs-plugin';
import 'grapesjs/dist/css/grapes.min.css';
const editor = grapesjs.init({
container : '#gjs',
// ...
plugins: [plugin],
pluginsOpts: {
[plugin]: { /* options */ }
}
// or
plugins: [
editor => plugin(editor, { /* options */ }),
],
});
Clone the repository
$ git clone https://github.com/fasenderos/grapesjs-chartjs-plugin.git
$ cd grapesjs-chartjs-plugin
Install dependencies
$ npm i
Start the dev server
$ npm start
Build the source
$ npm run build
MIT