Skip to content
Permalink
5c102fb6cc
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
46 lines (44 sloc) 1.62 KB
{% macro expression_profile(target, url) -%}
$( document ).ready(function() {
$.getJSON( "{{ url}}", function( data ) {
var ctx = document.getElementById("{{ target }}").getContext("2d");
data['options']['responsive'] = true;
data['options']['maintainAspectRatio'] = false;
data['options']['tooltips'] = {
enabled: true,
mode: 'label',
itemSort: function(a, b, data) {
conversion = {'Minimum': 0, 'Mean': 1, 'Maximum': 2}
if (conversion[data.datasets[a.datasetIndex].label] > conversion[data.datasets[b.datasetIndex].label]) {
return -1
} else if (conversion[data.datasets[a.datasetIndex].label] < conversion[data.datasets[b.datasetIndex].label]) {
return 1
} else {
return 0
}
},
callbacks: {
label: function(tooltipItems, data) {
return data.datasets[tooltipItems.datasetIndex].label + ': ' + tooltipItems.yLabel.toFixed(2);
}
}
}
var myChart = new Chart(ctx, data);
});
});
{%- endmacro %}
{% macro pie_chart(target, url) -%}
$( document ).ready(function() {
$.getJSON( "{{ url}}", function( data ) {
var ctx = document.getElementById("{{ target }}").getContext("2d");
data['options'] = {
responsive: true,
maintainAspectRatio: false,
legend: {
position: 'bottom'
}
}
var myChart = new Chart(ctx, data);
});
});
{%- endmacro %}