Chartjs-Using Chart.js client-side in Atlasboard

3๐Ÿ‘

โœ…

  1. Place the javascript library file (such as Chart.min.js) in assets/javascripts/.
  2. In the JSON config for the dashboard(s) which will load the widgets that will rely on the library, add the name of the library to the layout.customJS array:

Example:

{
  "title": "My Dashboard",
  "titleVisible": false,

  "description": "a neat dashboard",

  "layout": {
    "gridSize" : { "columns" : 20, "rows" : 12 },
    "customJS" : ["Chart.min.js"],
    "widgets" : [
        ...
    ]
  },

  "config": {
    ...
  }
}

Nothing special needs to be done in the Widget. You can just use the library:

var graph = new Chart(ctx).Radar(data);

Leave a comment