Commit ff29bd92 authored by Marc Duez's avatar Marc Duez Committed by Mathieu Giraud

scatterplot.js : use label rotation to save space if needed

parent 46e101d1
......@@ -273,6 +273,12 @@ max-height: calc(~"100%" - @margin)
text-anchor : middle;
}
.sp_rotated_legend{
fill : @secondary ;
font-weight : bold;
text-anchor : left;
}
.sp_legend_focus{
fill : @select;
font-weight : bold;
......
......@@ -987,8 +987,6 @@ ScatterPlot.prototype = {
axis_x_update: function (data) {
var self = this;
/*
* TODO
//detect label size
var label_width = 0;
......@@ -1007,9 +1005,21 @@ ScatterPlot.prototype = {
}
label_width = (label_width*8)
var space = Math.ceil(label_width/(this.resizeW/line))
var count=space
*/
var space = (this.resizeW/line)/label_width
//var count=space
var className = "sp_legend"
if (space < 1.1){
this.rotation_x = 330
this.text_position_x = 35;
this.sub_text_position_x = 50;
className = "sp_rotated_legend"
}else{
this.rotation_x = 0
className = "sp_legend"
this.text_position_x = 15;
this.sub_text_position_x = 30;
}
//LEGENDE
leg = this.axis_x_container.selectAll("text")
......@@ -1030,7 +1040,7 @@ ScatterPlot.prototype = {
return d.text;
})
.attr("class", function (d) {
return "sp_legend";
return className;
/*
* TODO
if ( d.type=="line" ){
......
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