Browse Source

Fix x axis tick

pull/153/head
Masayuki Tanaka 11 years ago
parent
commit
adbe644efc
  1. 11
      c3.js
  2. 6
      c3.min.js

11
c3.js

@ -1527,6 +1527,7 @@
tickValues.push(end); tickValues.push(end);
} }
} }
if (!isTimeSeries) { tickValues = tickValues.sort(); }
return tickValues; return tickValues;
} }
function addHiddenTargetIds(targetIds) { function addHiddenTargetIds(targetIds) {
@ -3001,7 +3002,7 @@
// update axis tick values according to options, except for scatter plot // update axis tick values according to options, except for scatter plot
if (! hasScatterType(targetsToShow)) { // TODO: fix this if (! hasScatterType(targetsToShow)) { // TODO: fix this
tickValues = generateTickValues(mapTargetsToUniqueXs(targetsToShow)).sort(); tickValues = generateTickValues(mapTargetsToUniqueXs(targetsToShow));
xAxis.tickValues(tickValues); xAxis.tickValues(tickValues);
subXAxis.tickValues(tickValues); subXAxis.tickValues(tickValues);
} }
@ -3029,9 +3030,11 @@
break; break;
} }
} }
d3.selectAll('.' + CLASS.axisX + ' .tick').sort(function (e1, e2) { return e1 - e2; }); d3.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e) {
d3.selectAll('.' + CLASS.axisX + ' .tick text').each(function (e, i) { var index = tickValues.indexOf(e);
d3.select(this).style('display', i % intervalForCulling ? 'none' : 'block'); if (index > 0) {
d3.select(this).style('display', index % intervalForCulling ? 'none' : 'block');
}
}); });
} }

6
c3.min.js vendored

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save