Commit a303cf89 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Add color palettes, Implements #127

parent e4b3fa80
......@@ -32,7 +32,7 @@ d3.boxplot.scale = 1000;
d3.boxplot.content_lines_width = d3.boxplot.scale / 400;
d3.boxplot.break_lines_width = d3.boxplot.scale / 1500;
d3.boxplot.color_idy_theme = "default";
d3.boxplot.color_idy_themes = ["default", "colorblind", "black&white"]
d3.boxplot.color_idy_themes = ["default", "colorblind", "black&white", "r_default", "r_colorblind", "allblack"];
d3.boxplot.color_idy = {
"default": {
"3": "#094b09",
......@@ -54,6 +54,27 @@ d3.boxplot.color_idy = {
"1": "#9c9c9c",
"0": "#DDDCDC",
"-1": "#fff"
},
"r_default": {
"3": "#7fff65",
"2": "#238d31",
"1": "#78410d",
"0": "#3b080a",
"-1": "#fff"
},
"r_colorblind": {
"3": "#8c8c8c",
"2": "#006DDB",
"1": "#783c00",
"0": "#312515",
"-1": "#fff"
},
"allblack": {
"3": "#000",
"2": "#000",
"1": "#000",
"0": "#000",
"-1": "#fff"
}
};
d3.boxplot.limit_idy = null;
......
......@@ -6,7 +6,7 @@ if(!dgenies||!dgenies.result){throw"dgenies.result wasn't included!"}dgenies.res
if(!d3){throw"d3 wasn't included!"}d3.boxplot={};//GLOBAL VARIABLES:
d3.boxplot.svgcontainer=null;d3.boxplot.container=null;d3.boxplot.svgsupercontainer=null;d3.boxplot.name_x=null;d3.boxplot.name_y=null;d3.boxplot.lines=null;d3.boxplot.x_len=null;d3.boxplot.y_len=null;d3.boxplot.x_zones=null;d3.boxplot.y_zones=null;d3.boxplot.zoom_enabled=true;d3.boxplot.all_disabled=false;d3.boxplot.min_idy=0;d3.boxplot.max_idy=0;d3.boxplot.zone_selected=false;d3.boxplot.query_selected=null;//For translations:
d3.boxplot.translate_start=null;d3.boxplot.posX=null;d3.boxplot.posY=null;d3.boxplot.old_translate=null;//Graphical parameters:
d3.boxplot.scale=1000;d3.boxplot.content_lines_width=d3.boxplot.scale/400;d3.boxplot.break_lines_width=d3.boxplot.scale/1500;d3.boxplot.color_idy_theme="default";d3.boxplot.color_idy_themes=["default","colorblind","black&white"];d3.boxplot.color_idy={"default":{"3":"#094b09","2":"#2ebd40","1":"#d5670b","0":"#ffd84b","-1":"#fff"},"colorblind":{"3":"#000","2":"#006DDB","1":"#DB6E00","0":"#FFB677","-1":"#fff"},"black&white":{"3":"#000","2":"#626262","1":"#9c9c9c","0":"#DDDCDC","-1":"#fff"}};d3.boxplot.limit_idy=null;d3.boxplot.min_idy_draw=0;d3.boxplot.min_size=0;d3.boxplot.linecap="round";d3.boxplot.background_axis="#f4f4f4";d3.boxplot.break_lines_color="#7c7c7c";d3.boxplot.break_lines_dash="3, 3";d3.boxplot.break_lines_show=true;d3.boxplot.zoom_scale_lines=1;// Zoom scale used for lines width
d3.boxplot.scale=1000;d3.boxplot.content_lines_width=d3.boxplot.scale/400;d3.boxplot.break_lines_width=d3.boxplot.scale/1500;d3.boxplot.color_idy_theme="default";d3.boxplot.color_idy_themes=["default","colorblind","black&white","r_default","r_colorblind","allblack"];d3.boxplot.color_idy={"default":{"3":"#094b09","2":"#2ebd40","1":"#d5670b","0":"#ffd84b","-1":"#fff"},"colorblind":{"3":"#000","2":"#006DDB","1":"#DB6E00","0":"#FFB677","-1":"#fff"},"black&white":{"3":"#000","2":"#626262","1":"#9c9c9c","0":"#DDDCDC","-1":"#fff"},"r_default":{"3":"#7fff65","2":"#238d31","1":"#78410d","0":"#3b080a","-1":"#fff"},"r_colorblind":{"3":"#8c8c8c","2":"#006DDB","1":"#783c00","0":"#312515","-1":"#fff"},"allblack":{"3":"#000","2":"#000","1":"#000","0":"#000","-1":"#fff"}};d3.boxplot.limit_idy=null;d3.boxplot.min_idy_draw=0;d3.boxplot.min_size=0;d3.boxplot.linecap="round";d3.boxplot.background_axis="#f4f4f4";d3.boxplot.break_lines_color="#7c7c7c";d3.boxplot.break_lines_dash="3, 3";d3.boxplot.break_lines_show=true;d3.boxplot.zoom_scale_lines=1;// Zoom scale used for lines width
d3.boxplot.tick_width=0.5;d3.boxplot.color_mixes="#969696";//Filter sizes:
d3.boxplot.min_sizes=[0,0.01,0.02,0.03,0.05,1,2];d3.boxplot.init=function(id_res=null,from_file=false){if(id_res===null){id_res=dgenies.result.id_res}$("#form-parameters")[0].reset();$("form#select-zone")[0].reset();if(!from_file){dgenies.post("/get_graph",{"id":id_res},function(data){if(data["success"]){d3.boxplot.launch(data)}else{$("#supdraw").html($("<p>").html("message"in data?data["message"]:"This job does not exist!").css("margin-top","15px"));dgenies.result.remove_job_from_cookie(dgenies.result.id_res)}})}else{dgenies.get(id_res,{},function(data){d3.boxplot.launch(data)})}};d3.boxplot.launch=function(res,update=false,noise_change=false){dgenies.fill_select_zones(res["x_order"],res["y_order"]);if(res["sorted"]){$("input#sort-contigs").val("Undo sort");$("#export").find("select option[value=4]").show();$("#export").find("select option[value=8]").show()}else{$("input#sort-contigs").val("Sort contigs");$("#export").find("select option[value=4]").hide();$("#export").find("select option[value=8]").hide()}d3.boxplot.name_x=res["name_x"];d3.boxplot.name_y=res["name_y"];if(d3.boxplot.name_x===d3.boxplot.name_y){$("input#sort-contigs").hide()}else{$("input#sort-contigs").show()}d3.boxplot.lines=res["lines"];d3.boxplot.x_len=res["x_len"];d3.boxplot.y_len=res["y_len"];d3.boxplot.min_idy=res["min_idy"];d3.boxplot.max_idy=res["max_idy"];d3.boxplot.limit_idy=res["limit_idy"];if(!noise_change){dgenies.noise=true}$("#hide-noise").val(dgenies.noise?"Hide noise":"Show noise");d3.boxplot.draw(res["x_contigs"],res["x_order"],res["y_contigs"],res["y_order"]);if(!update){$("div#draw").resizable({aspectRatio:true});d3.boxplot.events.init();dgenies.result.controls.init()}if(res["sampled"]){let max_nb_lines=dgenies.numberWithCommas(res["max_nb_lines"].toString());dgenies.notify(`<div style="text-align: center"><b>There are too much matches.\nOnly the ${max_nb_lines} best matches are displayed</b></div>`)}d3.boxplot.mousetip.init()};d3.boxplot.select_target=function(x){for(let zone in d3.boxplot.x_zones){if(d3.boxplot.x_zones[zone][0]<x&&x<=d3.boxplot.x_zones[zone][1]){return zone}}return null};d3.boxplot.select_query=function(y){for(let zone in d3.boxplot.y_zones){if(d3.boxplot.y_zones[zone][0]<y&&y<=d3.boxplot.y_zones[zone][1]){return zone}}return null};d3.boxplot.select_zone=function(x=null,y=null,x_zone=null,y_zone=null,force=false){d3.boxplot.mousetip.hide();dgenies.show_loading();window.setTimeout(()=>{if(!d3.boxplot.zone_selected||force){if(x_zone===null){//Search zone for X axis:
x_zone=d3.boxplot.select_target(x)}if(y_zone===null){//Search zone for Y axis:
......
Markdown is supported
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