Commit 11275488 authored by Evgeny's avatar Evgeny

Fix category axis

parent 3c5f1452
......@@ -8253,9 +8253,16 @@
// this should be called only when category axis
function splitTickText(d, maxWidth) {
var tickText = textFormatted(d),
var tickText,
subtext, spaceIndex, textWidth, thinOutCoef, splitted = [];
if($$.isCategorized()){
tickText = $$.categoryName(d);
tickText = textFormatted(tickText);
} else {
tickText = textFormatted(d);
}
if($$.isXAxis(orient)){
thinOutCoef = $$.getXThinOutCoef();
} else {
......@@ -8282,7 +8289,7 @@
}
subtext = text.substr(0, i + 1);
textWidth = sizeFor1Char.w * subtext.length;
// if text width gets over tick width, split by space index or crrent index
// if text width gets over tick width, split by space index or current index
if (maxWidth < textWidth) {
return split(
splitted.concat(text.substr(0, spaceIndex ? spaceIndex : i)),
......@@ -8357,7 +8364,7 @@
var coef = $$.getYThinOutCoef();
line.style('display', function(d, i){
return (i-indexOfZero)%coef == 0 ? 'block' : 'none';
return (i-indexOfZero)%coef == 0 ? 'none' : 'block';
});
}
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -148,9 +148,16 @@ function c3_axis(d3, params, $$) {
// this should be called only when category axis
function splitTickText(d, maxWidth) {
var tickText = textFormatted(d),
var tickText,
subtext, spaceIndex, textWidth, thinOutCoef, splitted = [];
if($$.isCategorized()){
tickText = $$.categoryName(d);
tickText = textFormatted(tickText);
} else {
tickText = textFormatted(d);
}
if($$.isXAxis(orient)){
thinOutCoef = $$.getXThinOutCoef();
} else {
......@@ -177,7 +184,7 @@ function c3_axis(d3, params, $$) {
}
subtext = text.substr(0, i + 1);
textWidth = sizeFor1Char.w * subtext.length;
// if text width gets over tick width, split by space index or crrent index
// if text width gets over tick width, split by space index or current index
if (maxWidth < textWidth) {
return split(
splitted.concat(text.substr(0, spaceIndex ? spaceIndex : i)),
......@@ -252,7 +259,7 @@ function c3_axis(d3, params, $$) {
var coef = $$.getYThinOutCoef();
line.style('display', function(d, i){
return (i-indexOfZero)%coef == 0 ? 'block' : 'none';
return (i-indexOfZero)%coef == 0 ? 'none' : 'block';
});
}
}
......
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