Namespace

chartJSUtils

ChartJSModule.chartJSUtils

Methods

# static createColor(red, green, blue, opacityopt) → {string}

function to create rgba colors
Parameters:
Name Type Attributes Default Description
red number number between 0 and 255 that represents the amount of red within the rgba
green number number between 0 and 255 that represents the amount of green within the rgba
blue number number between 0 and 255 that represents the amount of blue within the rgba
opacity number <optional>
1 number between 0 and 1 that represents the amount of opacity within the rgba

View Source modules/chartjs/others/chartjs.utils.js, line 38

value rgba color
string
Example
createColor({
    red: 255,
    green: 150,
    blue: 25,
    opacity: 0.2
})

# static createDatasetColor(backgroundColoropt, borderColoropt, backgroundOpacityopt) → {Object}

function to create colors inside datasets
Parameters:
Name Type Attributes Default Description
backgroundColor string <optional>
null background color for a dataset
borderColor string <optional>
null border color for a dataset
backgroundOpacity boolean <optional>
false background color opacity is true or false

View Source modules/chartjs/others/chartjs.utils.js, line 63

colors to dataset
Object

# static reusableChartBuild(datasets, datasetFunction, htmlElementContainer, idElement, options) → {Object}

function to build a chart reusable
Parameters:
Name Type Description
datasets array array of objects containing the dataset groups, its structure depends of chart
datasetFunction function function for each dataset in datasets
htmlElementContainer HTMLBodyElement container html element, where the chart is inserted
idElement string chart id
options Object object of preferences in chartjs

View Source modules/chartjs/others/chartjs.utils.js, line 111

chart
Object

# static reusableOnClickFunction($event, chart, clickEventForEachElement) → {null|*}

reusable function that allows to use onclick function in different instances
Parameters:
Name Type Description
$event Object description of the event onclick
chart Object constructed chart
clickEventForEachElement function callback function that receives the basic values:
  • value => value of the data that was clicked
  • label => value of the label that was clicked
  • datasetIndex => dataset to which the data belongs
  • index => index of the data within the dataset
  • chart => chart object that contains all the information about it

View Source modules/chartjs/others/chartjs.utils.js, line 9

null | *