Fse.buildChart = function( options ) { if (options.legend == undefined) { options.legend = false; }; if (options.yAxisLabels == undefined) { options.yAxisLabels = true; }; if (options.xAxisLabels == undefined) { options.xAxisLabels = true; }; if (options.title == undefined) { options.title = ''; }; if (options.titleDisplay == undefined) { options.titleDisplay = true; }; var ctx = document.getElementById( options.canvas ).getContext('2d'); var myChartObj = new Chart(ctx, { type: options.chartType, data: { labels: options.labels, datasets: [{ label: '', data: options.data, backgroundColor: options.backgroundColor, xborderColor: [ 'rgba(0, 0, 0, 1)', 'rgba(54, 162, 235, 1)' ], borderWidth: 0 }] }, options: { scales: { yAxes: [{ ticks: { beginAtZero:true, display: options.yAxisLabels } }], xAxes: [{ ticks: { beginAtZero:true, display: options.xAxisLabels } }], }, title: { display: options.titleDisplay, text: options.title }, legend: { display: options.legend // this turns off the "label" at the top of the chart }, tooltips: { callbacks: { label: function(tooltipItem, data) { var value = data.datasets[0].data[tooltipItem.index]; if(parseInt(value) >= 1000){ return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } else { return value; } } } }, } }); }