Browse Source

fixed warnings of travis check

pull/1355/head
Gökhan Özen 7 years ago
parent
commit
43ba49dd15
  1. 14
      spec/arc-spec.js
  2. 8
      spec/legend-spec.js
  3. 4
      src/arc.js

14
spec/arc-spec.js

@ -212,7 +212,7 @@ describe('c3 chart arc', function () {
values: [30, 80, 95] values: [30, 80, 95]
} }
} }
} };
}); });
var arcColor = ['#60b044', '#f6c600', '#f97600', '#ff0000']; var arcColor = ['#60b044', '#f6c600', '#f97600', '#ff0000'];
@ -220,7 +220,7 @@ describe('c3 chart arc', function () {
it('each data_column should have one arc', function () { it('each data_column should have one arc', function () {
chart.internal.main.selectAll('.c3-chart-arc .c3-arc').each(function (d, i) { chart.internal.main.selectAll('.c3-chart-arc .c3-arc').each(function (d, i) {
expect(d3.select(this).classed('c3-chart-data-' + args.data.columns[i][0])).toBeTruthy(); expect(d3.select(this).classed('c3-chart-data-' + args.data.columns[i][0])).toBeTruthy();
}) });
}); });
it('each arc should have the color from color_pattern if color_treshold is given ', function () { it('each arc should have the color from color_pattern if color_treshold is given ', function () {
@ -234,11 +234,11 @@ describe('c3 chart arc', function () {
it('each data_column should have one background', function () { it('each data_column should have one background', function () {
chart.internal.main.selectAll('.c3-chart-arcs path.c3-chart-arcs-background').each(function (d, i) { chart.internal.main.selectAll('.c3-chart-arcs path.c3-chart-arcs-background').each(function (d, i) {
expect(d3.select(this).classed('c3-chart-arcs-background-'+ i)).toBeTruthy(); expect(d3.select(this).classed('c3-chart-arcs-background-'+ i)).toBeTruthy();
}) });
}); });
it('each background should have tbe same color', function () { it('each background should have tbe same color', function () {
chart.internal.main.selectAll('.c3-chart-arcs path.c3-chart-arcs-background').each(function (d, i) { chart.internal.main.selectAll('.c3-chart-arcs path.c3-chart-arcs-background').each(function () {
expect(d3.select(this).style('fill')).toBe('#e0e0e0'); expect(d3.select(this).style('fill')).toBe('#e0e0e0');
}); });
}); });
@ -248,11 +248,11 @@ describe('c3 chart arc', function () {
it('each data_column should have a label', function () { it('each data_column should have a label', function () {
chart.internal.main.selectAll('.c3-chart-arc .c3-gauge-value').each(function (d, i) { chart.internal.main.selectAll('.c3-chart-arc .c3-gauge-value').each(function (d, i) {
expect(d3.select(this).text()).toBe(args.data.columns[i][1]); expect(d3.select(this).text()).toBe(args.data.columns[i][1]);
}) });
}); });
it('each label should have the same color', function () { it('each label should have the same color', function () {
chart.internal.main.selectAll('.c3-chart-arc .c3-gauge-value').each(function (d, i) { chart.internal.main.selectAll('.c3-chart-arc .c3-gauge-value').each(function () {
expect(d3.select(this).style('fill')).toBe('#000'); expect(d3.select(this).style('fill')).toBe('#000');
}); });
@ -276,7 +276,7 @@ describe('c3 chart arc', function () {
it('each data_column should have a labelline', function () { it('each data_column should have a labelline', function () {
chart.internal.main.selectAll('.c3-chart-arc .c3-arc-label-line').each(function (d, i) { chart.internal.main.selectAll('.c3-chart-arc .c3-arc-label-line').each(function (d, i) {
expect(d3.select(this).classed('c3-data-' + args.data.columns[i][0])).toBeTruthy(); expect(d3.select(this).classed('c3-data-' + args.data.columns[i][0])).toBeTruthy();
}) });
}); });
it('each labelline should have the color from color_pattern if color_treshold is given', function () { it('each labelline should have the color from color_pattern if color_treshold is given', function () {

8
spec/legend-spec.js

@ -292,7 +292,7 @@ describe('c3 chart legend', function () {
values: [30, 80, 95] values: [30, 80, 95]
} }
} }
} };
}); });
// espacially for gauges with multiple arcs to have the same coloring between legend tiles, tooltip tiles and arc // espacially for gauges with multiple arcs to have the same coloring between legend tiles, tooltip tiles and arc
@ -305,7 +305,7 @@ describe('c3 chart legend', function () {
expect(tileColor[1]).toBe('rgb(246, 198, 0)'); expect(tileColor[1]).toBe('rgb(246, 198, 0)');
expect(tileColor[2]).toBe('rgb(249, 118, 0)'); expect(tileColor[2]).toBe('rgb(249, 118, 0)');
expect(tileColor[3]).toBe('rgb(255, 0, 0)'); expect(tileColor[3]).toBe('rgb(255, 0, 0)');
}) });
}); });
describe('legend item tile coloring without color_treshold', function () { describe('legend item tile coloring without color_treshold', function () {
@ -324,7 +324,7 @@ describe('c3 chart legend', function () {
} }
}, },
type: 'gauge' type: 'gauge'
} };
}); });
it('selects the color from data_colors, data_color or default', function () { it('selects the color from data_colors, data_color or default', function () {
@ -336,6 +336,6 @@ describe('c3 chart legend', function () {
expect(tileColor[1]).toBe('rgb(31, 119, 180)'); expect(tileColor[1]).toBe('rgb(31, 119, 180)');
expect(tileColor[2]).toBe('rgb(255, 127, 14)'); expect(tileColor[2]).toBe('rgb(255, 127, 14)');
expect(tileColor[3]).toBe('rgb(139, 0, 139)'); expect(tileColor[3]).toBe('rgb(139, 0, 139)');
}) });
}); });
}); });

4
src/arc.js

@ -105,7 +105,7 @@ c3_chart_internal_fn.getArc = function (d, withoutUpdate, force) {
c3_chart_internal_fn.transformForArcLabel = function (d) { c3_chart_internal_fn.transformForArcLabel = function (d) {
var $$ = this, var $$ = this, config = $$.config,
updated = $$.updateAngle(d), c, x, y, h, ratio, translate = "", hasGauge = $$.hasType('gauge'); updated = $$.updateAngle(d), c, x, y, h, ratio, translate = "", hasGauge = $$.hasType('gauge');
if (updated && !hasGauge) { if (updated && !hasGauge) {
c = this.svgArc.centroid(updated); c = this.svgArc.centroid(updated);
@ -461,7 +461,7 @@ c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransf
backgroundArc = $$.arcs.select('g.' + CLASS.chartArcsBackground).selectAll('path.' + CLASS.chartArcsBackground).data($$.data.targets); backgroundArc = $$.arcs.select('g.' + CLASS.chartArcsBackground).selectAll('path.' + CLASS.chartArcsBackground).data($$.data.targets);
backgroundArc.enter().append("path"); backgroundArc.enter().append("path");
backgroundArc backgroundArc
.attr("class", function (d, i) { return CLASS.chartArcsBackground + ' ' + CLASS.chartArcsBackground +'-'+ i}) .attr("class", function (d, i) { return CLASS.chartArcsBackground + ' ' + CLASS.chartArcsBackground +'-'+ i; })
.attr("d", function (d1) { .attr("d", function (d1) {
if ($$.hiddenTargetIds.indexOf(d1.id) >= 0) { return "M 0 0"; } if ($$.hiddenTargetIds.indexOf(d1.id) >= 0) { return "M 0 0"; }

Loading…
Cancel
Save