Commit 816b1886 authored by Penom Nom's avatar Penom Nom
Browse files

Add possibility to change scale type.

parent f46045a0
......@@ -91,11 +91,85 @@ $(function () {
//Set dialog window
$("#modal-label-tmpl").html("NG6 <small> " + $("#analyse_name").val() + "</small>");
$("#modal-body-tmpl").html('<div id="highcharts_container"></div>');
$("#modal-foot-tmpl").html('<button class="btn" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i> Close</button>');
$("#modal-foot-tmpl").html(
'<button id="linear_scale" class="btn" aria-hidden="true">Linear scale</button>' +
'<button id="log_scale" class="btn btn-primary disabled" aria-hidden="true">Log scale</button>' +
'<button class="btn" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i> Close</button>'
);
$("#highcharts_container").css('width', '845px');
$("#ng6modal").css('width', 'auto');
$("#ng6modal").css('margin-left', '-435px');
// Build graph
build_depth_histogram( 'highcharts_container', 'logarithmic' );
// Add listeners
$("#linear_scale").click(function() {
$("#modal-body-tmpl").html('<div id="highcharts_container"></div>');
$("#highcharts_container").css('width', '845px');
build_depth_histogram( 'highcharts_container', 'linear' );
$("#linear_scale").attr("class", "btn btn-primary disabled");
$("#log_scale").attr("class", "btn");
$("#ng6modal").modal();
});
$("#log_scale").click(function() {
$("#modal-body-tmpl").html('<div id="highcharts_container"></div>');
$("#highcharts_container").css('width', '845px');
build_depth_histogram( 'highcharts_container', 'logarithmic' );
$("#linear_scale").attr("class", "btn");
$("#log_scale").attr("class", "btn btn-primary disabled");
$("#ng6modal").modal();
});
//Display
$("#ng6modal").modal();
});
$(".tree-view-btn").click(function() {
//Set dialog window
$("#modal-label-tmpl").html("NG6 <small> " + $("#analyse_name").val() + "</small>");
$("#modal-body-tmpl").html("");
$("#modal-foot-tmpl").html('<button class="btn" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i> Close</button>');
$("#ng6modal").css('width', 'auto');
$("#ng6modal").css('margin-left', '-435px');
//Retrieve values
linkage_data = null ;
$(":checked[id^=chk_sample_]").each(function(){
var index = $(this).attr("id").split("_")[2];
linkage_data = $.parseJSON( $("#linkage_"+index).val() );
});
//Build chart
var width = "800" ;
var height = "550" ;
tree = null ;
diagonal = null ;
svg_layout = null ;
i = 0 ;
tree = d3.layout.tree()
.size([height, width]);
diagonal = d3.svg.diagonal()
.projection(function(d) { return [d.y, d.x]; });
svg_layout = d3.select("#modal-body-tmpl").append("svg:svg")
.attr("width", width)
.attr("height", height)
.append("svg:g")
.attr("transform", "translate(20,20)");
linkage_data.x0 = height / 2;
linkage_data.y0 = 0;
update_linkage_nodes(linkage_data);
//Display
$("#ng6modal").modal();
});
function build_depth_histogram( container, scale_type ) {
//Retrieve values
sum_data = new Array();
var max_depth = 0 ;
......@@ -124,7 +198,7 @@ $(function () {
var chart = new Highcharts.Chart({
chart: {
type: 'column',
renderTo: 'highcharts_container',
renderTo: container,
},
title: {
text: 'Depths by cluster count'
......@@ -139,7 +213,7 @@ $(function () {
title: {
text: 'Clusters count'
},
type: 'logarithmic',
type: scale_type,
minorTickInterval: 0.1
},
tooltip: {
......@@ -171,56 +245,8 @@ $(function () {
enabled: false
},
});
//Display
$("#ng6modal").modal();
});
$(".tree-view-btn").click(function() {
//Set dialog window
$("#modal-label-tmpl").html("NG6 <small> " + $("#analyse_name").val() + "</small>");
$("#modal-body-tmpl").html("");
$("#modal-foot-tmpl").html('<button class="btn" data-dismiss="modal" aria-hidden="true"><i class="icon-remove"></i> Close</button>');
$("#ng6modal").css('width', 'auto');
$("#ng6modal").css('margin-left', '-435px');
//Retrieve values
linkage_data = null ;
$(":checked[id^=chk_sample_]").each(function(){
var index = $(this).attr("id").split("_")[2];
linkage_data = $.parseJSON( $("#linkage_"+index).val() );
});
//Build chart
var width = "800" ;
var height = "550" ;
tree = null ;
diagonal = null ;
svg_layout = null ;
i = 0 ;
tree = d3.layout.tree()
.size([height, width]);
diagonal = d3.svg.diagonal()
.projection(function(d) { return [d.y, d.x]; });
}
svg_layout = d3.select("#modal-body-tmpl").append("svg:svg")
.attr("width", width)
.attr("height", height)
.append("svg:g")
.attr("transform", "translate(20,20)");
linkage_data.x0 = height / 2;
linkage_data.y0 = 0;
update_linkage_nodes(linkage_data);
//Display
$("#ng6modal").modal();
});
/**
* Draw/update linkage tree.
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment