{% block extrajs %}
{% endblock %}
\ No newline at end of file
diff --git a/planet/templates/macros/chartjs.html b/planet/templates/macros/chartjs.html
new file mode 100644
index 0000000..47bf2ea
--- /dev/null
+++ b/planet/templates/macros/chartjs.html
@@ -0,0 +1,20 @@
+{% 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: 'single',
+ callbacks: {
+ label: function(tooltipItems, data) {
+ return tooltipItems.yLabel.toFixed(2);
+ }
+ }
+ }
+ console.log(data);
+ var myChart = new Chart(ctx, data);
+ });
+});
+{%- endmacro %}
\ No newline at end of file
diff --git a/planet/templates/modals/expression_profile.html b/planet/templates/modals/expression_profile.html
index cea2fd2..a1fd659 100644
--- a/planet/templates/modals/expression_profile.html
+++ b/planet/templates/modals/expression_profile.html
@@ -14,11 +14,7 @@
Expression profile for: {{ pro
{% endif %}
\ No newline at end of file
diff --git a/planet/templates/sequence.html b/planet/templates/sequence.html
index 3105b7f..80be711 100644
--- a/planet/templates/sequence.html
+++ b/planet/templates/sequence.html
@@ -1,7 +1,7 @@
{% extends 'base.html' %}
{% block container %}
-{% import 'macros/cluster_actions.html' as ca %}
+{% import "macros/cluster_actions.html" as ca %}
{% if sequence %}
@@ -344,17 +344,12 @@
Sequence details
$(".parent_term").toggle();
});
})
+
+{% import "macros/chartjs.html" as chartjs %}
{% if expression_profiles|count > 0 %}
{% for profile in expression_profiles %}
{% if loop.first %}
- Chart.defaults.global.responsive = true;
- Chart.defaults.global.maintainAspectRatio = false;
- $( document ).ready(function() {
- $.getJSON( "{{ url_for('expression_profile.expression_profile_plot_json', profile_id=profile.id) }}", function( data ) {
- var ctx = document.getElementById("expression-profile").getContext("2d");
- var myChart = new Chart(ctx, data);
- });
- });
+ {{ chartjs.expression_profile("expression-profile", url_for('expression_profile.expression_profile_plot_json', profile_id=profile.id)) }}
{% endif %}
{% endfor %}
{% endif %}