68 lines
1.5 KiB
JavaScript
68 lines
1.5 KiB
JavaScript
/**
|
|
* R3.Runtime.Graphics.Chart
|
|
* @constructor
|
|
*/
|
|
R3.Runtime.Graphics.Chart = function() {
|
|
|
|
R3.Runtime.Graphics.call(
|
|
this
|
|
);
|
|
|
|
this.createInstance();
|
|
};
|
|
|
|
R3.Runtime.Graphics.Chart.prototype = Object.create(R3.Runtime.Graphics.prototype);
|
|
R3.Runtime.Graphics.Chart.prototype.constructor = R3.Runtime.Graphics.Chart;
|
|
|
|
/**
|
|
* Create R3.Runtime.Graphics.Chart Instance
|
|
* @returns {*}
|
|
*/
|
|
R3.Runtime.Graphics.Chart.prototype.createInstance = function() {
|
|
this.instance = Chart;
|
|
};
|
|
|
|
/**
|
|
*
|
|
* @param runtimeObject
|
|
* @constructor
|
|
*/
|
|
R3.Runtime.Graphics.Chart.prototype.BarchartStacked = function(runtimeObject) {
|
|
|
|
var ctx = document.getElementById(runtimeObject.domElement.domElementId).getContext('2d');
|
|
|
|
var barChartData = {
|
|
labels: runtimeObject.query.labels,
|
|
datasets: runtimeObject.query.datasets
|
|
};
|
|
|
|
Chart.defaults.global.defaultFontColor = '#414141ee';
|
|
|
|
runtimeObject.chart = new Chart(ctx, {
|
|
type: 'bar',
|
|
data: barChartData,
|
|
options: {
|
|
title: {
|
|
display: true
|
|
},
|
|
tooltips: {
|
|
mode: 'index',
|
|
intersect: false
|
|
},
|
|
responsive: true,
|
|
maintainAspectRatio: false,
|
|
scales: {
|
|
xAxes: [{
|
|
stacked: true,
|
|
}],
|
|
yAxes: [{
|
|
stacked: true
|
|
}]
|
|
}
|
|
}
|
|
});
|
|
|
|
return true;
|
|
|
|
};
|