From a6e0b6fa9c8d2632d1a533a08d532ca2b9dc233c Mon Sep 17 00:00:00 2001 From: sepro Date: Wed, 26 Oct 2016 14:46:13 +0200 Subject: [PATCH] redesign sequence page (expression plots via macro) --- planet/templates/expression_profile.html | 15 +++++--------- planet/templates/macros/chartjs.html | 20 +++++++++++++++++++ .../templates/modals/expression_profile.html | 8 ++------ planet/templates/sequence.html | 13 ++++-------- 4 files changed, 31 insertions(+), 25 deletions(-) create mode 100644 planet/templates/macros/chartjs.html diff --git a/planet/templates/expression_profile.html b/planet/templates/expression_profile.html index a4dfd6b..2ed0f8f 100644 --- a/planet/templates/expression_profile.html +++ b/planet/templates/expression_profile.html @@ -50,15 +50,10 @@

{{t.name}}

{% 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 @@