Commit 1426795f authored by Evgeny's avatar Evgeny

Fix tick for category axis

parent 19db15d9
...@@ -2367,6 +2367,7 @@ ...@@ -2367,6 +2367,7 @@
c3_chart_internal_fn.categoryName = function (i) { c3_chart_internal_fn.categoryName = function (i) {
var config = this.config; var config = this.config;
return i < config.axis_x_categories.length ? config.axis_x_categories[i] : i; return i < config.axis_x_categories.length ? config.axis_x_categories[i] : i;
}; };
...@@ -8207,7 +8208,20 @@ ...@@ -8207,7 +8208,20 @@
// this should be called only when category axis // this should be called only when category axis
function splitTickText(d, maxWidth) { function splitTickText(d, maxWidth) {
var tickText = textFormatted(d), var tickText = textFormatted(d),
subtext, spaceIndex, textWidth, splitted = []; subtext, spaceIndex, textWidth, thinOutCoef, splitted = [];
switch(orient){
case "top":
case "bottom":
thinOutCoef = $$.getYThinOutCoef();
case "left":
case "right":
thinOutCoef = $$.getXThinOutCoef();
}
if(d % thinOutCoef !== 0){
return [""];
}
if (Object.prototype.toString.call(tickText) === "[object Array]") { if (Object.prototype.toString.call(tickText) === "[object Array]") {
return tickText; return tickText;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -141,7 +141,20 @@ function c3_axis(d3, params, $$) { ...@@ -141,7 +141,20 @@ function c3_axis(d3, params, $$) {
// this should be called only when category axis // this should be called only when category axis
function splitTickText(d, maxWidth) { function splitTickText(d, maxWidth) {
var tickText = textFormatted(d), var tickText = textFormatted(d),
subtext, spaceIndex, textWidth, splitted = []; subtext, spaceIndex, textWidth, thinOutCoef, splitted = [];
switch(orient){
case "top":
case "bottom":
thinOutCoef = $$.getYThinOutCoef();
case "left":
case "right":
thinOutCoef = $$.getXThinOutCoef();
}
if(d % thinOutCoef !== 0){
return [""];
}
if (Object.prototype.toString.call(tickText) === "[object Array]") { if (Object.prototype.toString.call(tickText) === "[object Array]") {
return tickText; return tickText;
......
c3_chart_internal_fn.categoryName = function (i) { c3_chart_internal_fn.categoryName = function (i) {
var config = this.config; var config = this.config;
return i < config.axis_x_categories.length ? config.axis_x_categories[i] : i; return i < config.axis_x_categories.length ? config.axis_x_categories[i] : i;
}; };
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