Commit 594f7514 authored by Evgeny's avatar Evgeny

Add tick turning for 90 degrees in debug mode

parent d049e52c
...@@ -8289,7 +8289,11 @@ ...@@ -8289,7 +8289,11 @@
} }
if(!shouldSplitText){ if(!shouldSplitText){
return [tickText.substr(0, 10)]; var postfix = '';
if(tickText.length > 12){
//postfix = '...';
}
return [tickText.substr(0, 10) + postfix];
} }
if($$.isXAxis(orient)){ if($$.isXAxis(orient)){
...@@ -8351,18 +8355,27 @@ ...@@ -8351,18 +8355,27 @@
text = tick.select("text"); text = tick.select("text");
if(typeof turn_axis_ticks !== 'undefined'){ if(typeof turn_axis_ticks !== 'undefined' || typeof turn_axis_ticks_90 !== 'undefined'){
if($$.isXAxis(orient)){ if($$.isXAxis(orient) && $$.isCategorized){
if($$.isCategorized()){ shouldSplitText = false;
shouldSplitText = false;
if(typeof turn_axis_ticks !== 'undefined'){
text.attr('transform', function(d, i){ text.attr('transform', function(d, i){
var tickText = splitTickText(d)[0]; var tickText = splitTickText(d)[0];
var offset = 15; var offset = 7;
var tickSize = getSizeFor1Char(tickText).w * tickText.length;
return 'rotate(-45) translate(' + (-tickSize / 2 - offset) + ', ' + (-tickOffset / Math.sqrt(2) / 2) + ')';
});
} else {
text.attr('transform', function(d){
var tickText = splitTickText(d)[0];
var offset = 10;
var tickSize = getSizeFor1Char(tickText).w * tickText.length + offset; var tickSize = getSizeFor1Char(tickText).w * tickText.length;
return 'rotate(-45) translate(' + (-tickSize / 2) + ', ' + (-tickOffset / Math.sqrt(2) / 2) + ')'; return 'rotate(-90) translate(' + (-tickSize/2 - offset) + ', ' + (-tickOffset) + ')';
}); });
} }
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -161,7 +161,7 @@ function c3_axis(d3, params, $$) { ...@@ -161,7 +161,7 @@ function c3_axis(d3, params, $$) {
if(!shouldSplitText){ if(!shouldSplitText){
var postfix = ''; var postfix = '';
if(tickText.length > 12){ if(tickText.length > 12){
postfix = '...'; //postfix = '...';
} }
return [tickText.substr(0, 10) + postfix]; return [tickText.substr(0, 10) + postfix];
} }
...@@ -225,18 +225,27 @@ function c3_axis(d3, params, $$) { ...@@ -225,18 +225,27 @@ function c3_axis(d3, params, $$) {
text = tick.select("text"); text = tick.select("text");
if(typeof turn_axis_ticks !== 'undefined'){ if(typeof turn_axis_ticks !== 'undefined' || typeof turn_axis_ticks_90 !== 'undefined'){
if($$.isXAxis(orient)){ if($$.isXAxis(orient) && $$.isCategorized){
if($$.isCategorized()){ shouldSplitText = false;
shouldSplitText = false;
if(typeof turn_axis_ticks !== 'undefined'){
text.attr('transform', function(d, i){ text.attr('transform', function(d, i){
var tickText = splitTickText(d)[0]; var tickText = splitTickText(d)[0];
var offset = 15; var offset = 7;
var tickSize = getSizeFor1Char(tickText).w * tickText.length;
return 'rotate(-45) translate(' + (-tickSize / 2 - offset) + ', ' + (-tickOffset / Math.sqrt(2) / 2) + ')';
});
} else {
text.attr('transform', function(d){
var tickText = splitTickText(d)[0];
var offset = 10;
var tickSize = getSizeFor1Char(tickText).w * tickText.length + offset; var tickSize = getSizeFor1Char(tickText).w * tickText.length;
return 'rotate(-45) translate(' + (-tickSize / 2) + ', ' + (-tickOffset / Math.sqrt(2) / 2) + ')'; return 'rotate(-90) translate(' + (-tickSize/2 - offset) + ', ' + (-tickOffset) + ')';
}); });
} }
} }
......
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