Skip to content

Commit aed7d24

Browse files
committed
Fix spec
1 parent 9de34c6 commit aed7d24

File tree

5 files changed

+25
-33
lines changed

5 files changed

+25
-33
lines changed

c3.css

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*-- Chart --*/
22
.c3 svg {
33
font: 10px sans-serif;
4-
-webkit-tap-highlight-color: transparent; }
4+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); }
55

66
.c3 path, .c3 line {
77
fill: none;
@@ -12,11 +12,7 @@
1212
-moz-user-select: none;
1313
user-select: none; }
1414

15-
.c3-legend-item-tile,
16-
.c3-xgrid-focus,
17-
.c3-ygrid,
18-
.c3-event-rect,
19-
.c3-bars path {
15+
.c3-legend-item-tile, .c3-xgrid-focus, .c3-ygrid, .c3-event-rect, .c3-bars path {
2016
shape-rendering: crispEdges; }
2117

2218
.c3-chart-arc path {
@@ -75,11 +71,11 @@
7571
/*-- Region --*/
7672
.c3-region {
7773
fill: steelblue;
78-
fill-opacity: .1; }
74+
fill-opacity: 0.1; }
7975

8076
/*-- Brush --*/
8177
.c3-brush .extent {
82-
fill-opacity: .1; }
78+
fill-opacity: 0.1; }
8379

8480
/*-- Select - Drag --*/
8581
/*-- Legend --*/

c3.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4411,15 +4411,13 @@
44114411
Axis.prototype.getYAxis = function getYAxis(scale, orient, tickFormat, tickValues, withOuterTick, withoutTransition, withoutRotateTickText) {
44124412
var $$ = this.owner, config = $$.config,
44134413
axisParams = {
4414-
withOuterTick: withOuterTick,
4415-
withoutTransition: withoutTransition,
4416-
tickTextRotate: withoutRotateTickText ? 0 : config.axis_y_tick_rotate
4417-
},
4418-
d3 = $$.d3,
4419-
config = $$.config,
4420-
axis = c3_axis(d3, axisParams).scale(scale).orient(orient).tickFormat(tickFormat);
4414+
withOuterTick: withOuterTick,
4415+
withoutTransition: withoutTransition,
4416+
tickTextRotate: withoutRotateTickText ? 0 : config.axis_y_tick_rotate
4417+
},
4418+
axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient).tickFormat(tickFormat);
44214419
if ($$.isTimeSeriesY()) {
4422-
axis.ticks(d3.time[config.axis_y_tick_time_value], config.axis_y_tick_time_interval);
4420+
axis.ticks($$.d3.time[config.axis_y_tick_time_value], config.axis_y_tick_time_interval);
44234421
} else {
44244422
axis.tickValues(tickValues);
44254423
}

c3.min.js

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/axis-spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ describe('c3 chart axis', function () {
153153

154154
describe('axis.x.tick.values', function () {
155155
describe('function is provided', function () {
156-
var tickGenerator = function (/*domain*/) {
156+
var tickGenerator = function () {
157157
var values = [];
158158
for (var i = 0; i <= 300; i += 50) {
159159
values.push(i);
@@ -599,7 +599,6 @@ describe('c3 chart axis', function () {
599599
});
600600
});
601601

602-
603602
describe('axis.y.tick.rotate', function () {
604603

605604
describe('not rotated', function () {
@@ -613,6 +612,7 @@ describe('c3 chart axis', function () {
613612
]
614613
},
615614
axis: {
615+
rotated: true,
616616
y: {
617617
tick: {
618618
rotate: 45
@@ -630,13 +630,13 @@ describe('c3 chart axis', function () {
630630
tspan = text.select('tspan');
631631
expect(text.attr('transform')).toBe('rotate(45)');
632632
expect(text.attr('y')).toBe('4');
633-
expect(tspan.attr('dx')).toBe('5.65685424949238');
633+
expect(tspan.attr('dx')).toBeCloseTo('5.6', 0);
634634
});
635635
});
636636

637637
it('should have automatically calculated y axis width', function () {
638638
var box = chart.internal.main.select('.c3-axis-y').node().getBoundingClientRect();
639-
expect(box.width).toBeLessThan(25);
639+
expect(box.width).toBeCloseTo(590, 1);
640640
});
641641

642642
});

src/axis.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,13 @@ Axis.prototype.updateXAxisTickValues = function updateXAxisTickValues(targets, a
7979
Axis.prototype.getYAxis = function getYAxis(scale, orient, tickFormat, tickValues, withOuterTick, withoutTransition, withoutRotateTickText) {
8080
var $$ = this.owner, config = $$.config,
8181
axisParams = {
82-
withOuterTick: withOuterTick,
83-
withoutTransition: withoutTransition,
84-
tickTextRotate: withoutRotateTickText ? 0 : config.axis_y_tick_rotate
85-
},
86-
d3 = $$.d3,
87-
config = $$.config,
88-
axis = c3_axis(d3, axisParams).scale(scale).orient(orient).tickFormat(tickFormat);
82+
withOuterTick: withOuterTick,
83+
withoutTransition: withoutTransition,
84+
tickTextRotate: withoutRotateTickText ? 0 : config.axis_y_tick_rotate
85+
},
86+
axis = c3_axis($$.d3, axisParams).scale(scale).orient(orient).tickFormat(tickFormat);
8987
if ($$.isTimeSeriesY()) {
90-
axis.ticks(d3.time[config.axis_y_tick_time_value], config.axis_y_tick_time_interval);
88+
axis.ticks($$.d3.time[config.axis_y_tick_time_value], config.axis_y_tick_time_interval);
9189
} else {
9290
axis.tickValues(tickValues);
9391
}

0 commit comments

Comments
 (0)