Browse Source

Fix conflict in c3.min.js

pull/1207/head
Masayuki Tanaka 10 years ago
parent
commit
5c0edf4f8a
  1. 2
      c3.js
  2. 2
      c3.min.js
  3. 28
      spec/axis-spec.js
  4. 2
      src/axis.js

2
c3.js

@ -4255,7 +4255,7 @@
}, },
axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient); axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient);
if ($$.isTimeSeries() && tickValues) { if ($$.isTimeSeries() && tickValues && typeof tickValues !== "function") {
tickValues = tickValues.map(function (v) { return $$.parseDate(v); }); tickValues = tickValues.map(function (v) { return $$.parseDate(v); });
} }

2
c3.min.js vendored

File diff suppressed because one or more lines are too long

28
spec/axis-spec.js

@ -151,6 +151,34 @@ describe('c3 chart axis', function () {
}); });
}); });
describe('axis.x.tick.values', function () {
describe('function is provided', function () {
var tickGenerator = function (/*domain*/) {
var values = [];
for (var i = 0; i <= 300; i += 50) {
values.push(i);
}
return values;
};
beforeEach(function () {
args.axis.x = {
tick: {
values: tickGenerator
}
};
chart = window.c3.generate(args);
window.generatedTicks = tickGenerator();
});
it('should use function to generate ticks', function () {
d3.select('.c3-axis-x').selectAll('g.tick').each(function (d, i) {
var tick = d3.select(this).select('text').text();
expect(+tick).toBe(window.generatedTicks[i]);
});
});
});
});
describe('axis.x.tick.width', function () { describe('axis.x.tick.width', function () {
describe('indexed x axis and y/y2 axis', function () { describe('indexed x axis and y/y2 axis', function () {

2
src/axis.js

@ -48,7 +48,7 @@ Axis.prototype.getXAxis = function getXAxis(scale, orient, tickFormat, tickValue
}, },
axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient); axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient);
if ($$.isTimeSeries() && tickValues) { if ($$.isTimeSeries() && tickValues && typeof tickValues !== "function") {
tickValues = tickValues.map(function (v) { return $$.parseDate(v); }); tickValues = tickValues.map(function (v) { return $$.parseDate(v); });
} }

Loading…
Cancel
Save