Browse Source

Fix spec

pull/1577/merge
Masayuki Tanaka 9 years ago
parent
commit
aed7d243ef
  1. 12
      c3.css
  2. 14
      c3.js
  3. 10
      c3.min.js
  4. 8
      spec/axis-spec.js
  5. 14
      src/axis.js

12
c3.css

@ -1,7 +1,7 @@
/*-- Chart --*/
.c3 svg {
font: 10px sans-serif;
-webkit-tap-highlight-color: transparent; }
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); }
.c3 path, .c3 line {
fill: none;
@ -12,11 +12,7 @@
-moz-user-select: none;
user-select: none; }
.c3-legend-item-tile,
.c3-xgrid-focus,
.c3-ygrid,
.c3-event-rect,
.c3-bars path {
.c3-legend-item-tile, .c3-xgrid-focus, .c3-ygrid, .c3-event-rect, .c3-bars path {
shape-rendering: crispEdges; }
.c3-chart-arc path {
@ -75,11 +71,11 @@
/*-- Region --*/
.c3-region {
fill: steelblue;
fill-opacity: .1; }
fill-opacity: 0.1; }
/*-- Brush --*/
.c3-brush .extent {
fill-opacity: .1; }
fill-opacity: 0.1; }
/*-- Select - Drag --*/
/*-- Legend --*/

14
c3.js

@ -4411,15 +4411,13 @@
Axis.prototype.getYAxis = function getYAxis(scale, orient, tickFormat, tickValues, withOuterTick, withoutTransition, withoutRotateTickText) {
var $$ = this.owner, config = $$.config,
axisParams = {
withOuterTick: withOuterTick,
withoutTransition: withoutTransition,
tickTextRotate: withoutRotateTickText ? 0 : config.axis_y_tick_rotate
},
d3 = $$.d3,
config = $$.config,
axis = c3_axis(d3, axisParams).scale(scale).orient(orient).tickFormat(tickFormat);
withOuterTick: withOuterTick,
withoutTransition: withoutTransition,
tickTextRotate: withoutRotateTickText ? 0 : config.axis_y_tick_rotate
},
axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient).tickFormat(tickFormat);
if ($$.isTimeSeriesY()) {
axis.ticks(d3.time[config.axis_y_tick_time_value], config.axis_y_tick_time_interval);
axis.ticks($$.d3.time[config.axis_y_tick_time_value], config.axis_y_tick_time_interval);
} else {
axis.tickValues(tickValues);
}

10
c3.min.js vendored

File diff suppressed because one or more lines are too long

8
spec/axis-spec.js

@ -153,7 +153,7 @@ describe('c3 chart axis', function () {
describe('axis.x.tick.values', function () {
describe('function is provided', function () {
var tickGenerator = function (/*domain*/) {
var tickGenerator = function () {
var values = [];
for (var i = 0; i <= 300; i += 50) {
values.push(i);
@ -599,7 +599,6 @@ describe('c3 chart axis', function () {
});
});
describe('axis.y.tick.rotate', function () {
describe('not rotated', function () {
@ -613,6 +612,7 @@ describe('c3 chart axis', function () {
]
},
axis: {
rotated: true,
y: {
tick: {
rotate: 45
@ -630,13 +630,13 @@ describe('c3 chart axis', function () {
tspan = text.select('tspan');
expect(text.attr('transform')).toBe('rotate(45)');
expect(text.attr('y')).toBe('4');
expect(tspan.attr('dx')).toBe('5.65685424949238');
expect(tspan.attr('dx')).toBeCloseTo('5.6', 0);
});
});
it('should have automatically calculated y axis width', function () {
var box = chart.internal.main.select('.c3-axis-y').node().getBoundingClientRect();
expect(box.width).toBeLessThan(25);
expect(box.width).toBeCloseTo(590, 1);
});
});

14
src/axis.js

@ -79,15 +79,13 @@ Axis.prototype.updateXAxisTickValues = function updateXAxisTickValues(targets, a
Axis.prototype.getYAxis = function getYAxis(scale, orient, tickFormat, tickValues, withOuterTick, withoutTransition, withoutRotateTickText) {
var $$ = this.owner, config = $$.config,
axisParams = {
withOuterTick: withOuterTick,
withoutTransition: withoutTransition,
tickTextRotate: withoutRotateTickText ? 0 : config.axis_y_tick_rotate
},
d3 = $$.d3,
config = $$.config,
axis = c3_axis(d3, axisParams).scale(scale).orient(orient).tickFormat(tickFormat);
withOuterTick: withOuterTick,
withoutTransition: withoutTransition,
tickTextRotate: withoutRotateTickText ? 0 : config.axis_y_tick_rotate
},
axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient).tickFormat(tickFormat);
if ($$.isTimeSeriesY()) {
axis.ticks(d3.time[config.axis_y_tick_time_value], config.axis_y_tick_time_interval);
axis.ticks($$.d3.time[config.axis_y_tick_time_value], config.axis_y_tick_time_interval);
} else {
axis.tickValues(tickValues);
}

Loading…
Cancel
Save