67 lines
1.5 KiB
JavaScript
67 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
|
||
|
};
|
||
|
|
||
|
runtimeObject.chart = new Chart(ctx, {
|
||
|
type: 'bar',
|
||
|
data: barChartData,
|
||
|
options: {
|
||
|
title: {
|
||
|
display: true,
|
||
|
text: R3.GetComponentName(runtimeObject.query)
|
||
|
},
|
||
|
tooltips: {
|
||
|
mode: 'index',
|
||
|
intersect: false
|
||
|
},
|
||
|
responsive: true,
|
||
|
maintainAspectRatio: false,
|
||
|
scales: {
|
||
|
xAxes: [{
|
||
|
stacked: true,
|
||
|
}],
|
||
|
yAxes: [{
|
||
|
stacked: true
|
||
|
}]
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
return true;
|
||
|
|
||
|
};
|