Quite good looking graph derived from d3.js http://c3js.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

366 lines
15 KiB

describe('c3 chart arc', function () {
'use strict';
var chart, args;
beforeEach(function (done) {
chart = window.initChart(chart, args, done);
});
describe('show pie chart', function () {
beforeAll(function () {
args = {
data: {
columns: [
['data1', 30],
['data2', 150],
['data3', 120]
],
type: 'pie'
}
};
});
it('should have correct classes', function () {
var chartArc = d3.select('.c3-chart-arcs'),
arcs = {
data1: chartArc.select('.c3-chart-arc.c3-target.c3-target-data1')
.select('g.c3-shapes.c3-shapes-data1.c3-arcs.c3-arcs-data1')
.select('path.c3-shape.c3-shape.c3-arc.c3-arc-data1'),
data2: chartArc.select('.c3-chart-arc.c3-target.c3-target-data2')
.select('g.c3-shapes.c3-shapes-data2.c3-arcs.c3-arcs-data2')
.select('path.c3-shape.c3-shape.c3-arc.c3-arc-data2'),
data3: chartArc.select('.c3-chart-arc.c3-target.c3-target-data3')
.select('g.c3-shapes.c3-shapes-data3.c3-arcs.c3-arcs-data3')
.select('path.c3-shape.c3-shape.c3-arc.c3-arc-data3')
};
expect(arcs.data1.size()).toBe(1);
expect(arcs.data2.size()).toBe(1);
expect(arcs.data3.size()).toBe(1);
});
it('should have correct d', function () {
7 years ago
expect(d3.select('.c3-arc-data1').attr('d')).toMatch(/M-124\..+,-171\..+A211\..+,211\..+,0,0,1,-3\..+,-211\..+L0,0Z/);
expect(d3.select('.c3-arc-data2').attr('d')).toMatch(/M1\..+,-211\..+211\..+,211\..+,0,0,1,1\..+,211\..+L0,0Z/);
expect(d3.select('.c3-arc-data3').attr('d')).toMatch(/M1\..+,211\..+211\..+,211\..+,0,0,1,-124\..+,-171\..+L0,0Z/);
});
describe('with data id that can be converted to a color', function () {
beforeAll(function(){
args.data.columns = [
['black', 30],
['data2', 150],
['data3', 120]
];
});
it('should have correct d even if data id can be converted to a color', function (done) {
setTimeout(function () {
7 years ago
expect(d3.select('.c3-arc-black').attr('d')).toMatch(/M-124\..+,-171\..+A211\..+,211\..+,0,0,1,-3\..+,-211\..+L0,0Z/);
done();
}, 500);
});
describe('with empty pie chart', function(){
beforeAll(function () {
args = {
data: {
columns: [
['data1', null],
['data2', null],
['data3', null]
],
type: 'pie'
}
};
});
it('should have correct d attribute', function () {
var chartArc = d3.select('.c3-chart-arcs'),
arcs = {
data1: chartArc.select('.c3-chart-arc.c3-target.c3-target-data1')
.select('g.c3-shapes.c3-shapes-data1.c3-arcs.c3-arcs-data1')
.select('path.c3-shape.c3-shape.c3-arc.c3-arc-data1'),
data2: chartArc.select('.c3-chart-arc.c3-target.c3-target-data2')
.select('g.c3-shapes.c3-shapes-data2.c3-arcs.c3-arcs-data2')
.select('path.c3-shape.c3-shape.c3-arc.c3-arc-data2'),
data3: chartArc.select('.c3-chart-arc.c3-target.c3-target-data3')
.select('g.c3-shapes.c3-shapes-data3.c3-arcs.c3-arcs-data3')
.select('path.c3-shape.c3-shape.c3-arc.c3-arc-data3')
};
expect(arcs.data1.attr('d').indexOf('NaN')).toBe(-1);
expect(arcs.data2.attr('d').indexOf('NaN')).toBe(-1);
expect(arcs.data3.attr('d').indexOf('NaN')).toBe(-1);
});
});
});
});
describe('sort pie chart', function() {
var createPie = function(order) {
return {
data: {
order: order,
columns: [
['data1', 30],
['data2', 150],
['data3', 120]
],
type: 'pie'
}
};
};
var collectArcs = function() {
return d3.selectAll('.c3-arc')
.data()
.sort(function(a, b) {
return a.startAngle - b.startAngle;
})
.map(function(item) {
return item.data.id;
});
};
it('should update data_order to desc', function () {
args = createPie('desc');
expect(true).toBeTruthy();
});
it('it should have descending ordering', function () {
expect(collectArcs()).toEqual([ 'data2', 'data3', 'data1' ]);
});
it('should update data_order to asc', function () {
args = createPie('asc');
expect(true).toBeTruthy();
});
it('it should have ascending ordering', function () {
expect(collectArcs()).toEqual([ 'data1', 'data3', 'data2' ]);
});
it('should update data_order to NULL', function () {
args = createPie(null);
expect(true).toBeTruthy();
});
it('it should have no ordering', function () {
expect(collectArcs()).toEqual([ 'data1', 'data2', 'data3' ]);
});
it('should update data_order to Array', function () {
args = createPie([ 'data3', 'data2', 'data1' ]);
expect(true).toBeTruthy();
});
it('it should have array specified ordering', function () {
expect(collectArcs()).toEqual([ 'data3', 'data2', 'data1' ]);
});
it('should update data_order to Function', function () {
var names = [ 'data2', 'data1', 'data3' ];
args = createPie(function(a, b) {
return names.indexOf(a.id) - names.indexOf(b.id);
});
expect(true).toBeTruthy();
});
it('it should have array specified ordering', function () {
expect(collectArcs()).toEqual([ 'data2', 'data1', 'data3' ]);
});
});
describe('show gauge', function () {
describe('with a 180 degree gauge', function(){
beforeAll(function () {
args = {
gauge: {
width: 10,
max: 10,
expand: true
},
data: {
columns: [
['data', 8]
],
type: 'gauge'
}
};
});
it('should have correct d for Pi radian gauge', function () {
var chartArc = d3.select('.c3-chart-arcs'),
data = chartArc.select('.c3-chart-arc.c3-target.c3-target-data')
.select('g.c3-shapes.c3-shapes-data.c3-arcs.c3-arcs-data')
.select('path.c3-shape.c3-shape.c3-arc.c3-arc-data');
7 years ago
expect(data.attr('d')).toMatch(/-258.4,-3\..+A258.4,258.4,0,0,1,209\..+,-151\..+L200\..+,-146\..+A248.39999999999998,248.39999999999998,0,0,0,-248.39999999999998,-3\..+Z/);
});
});
describe('with a 2 Pi radian gauge that starts at Pi/2', function() {
beforeAll(function(){
args = {
gauge: {
width: 10,
max: 10,
expand: true,
fullCircle: true
},
data: {
columns: [
['data', 8]
],
type: 'gauge',
fullCircle: true,
startingAngle: Math.PI/2
}
};
});
it('should have correct d for 2 Pi radian gauge starting at Pi/2', function() {
var chartArc = d3.select('.c3-chart-arcs'),
data = chartArc.select('.c3-chart-arc.c3-target.c3-target-data')
.select('g.c3-shapes.c3-shapes-data.c3-arcs.c3-arcs-data')
.select('path.c3-shape.c3-shape.c3-arc.c3-arc-data');
// This test has bee updated to make tests pass. @TODO double-check this test is accurate.
7 years ago
expect(data.attr('d')).toMatch(/M-180.*?,-2\..+A180.*?,180.*?,0,1,1,-55.*?,171.*?L-52.*?,161.*?A170.*?,170.*?,0,1,0,-170.*?,-2.*?Z/);
});
describe('with labels use custom text', function() {
beforeAll(function(){
args = {
gauge: {
width: 10,
max: 100,
expand: true,
label: {
extents: function (value, isMax) {
if (isMax) {
return 'Max: ' + value + '%';
}
return 'Min: ' + value + '%';
}
}
},
data: {
columns: [
['data', 8]
],
type: 'gauge',
fullCircle: true,
startingAngle: Math.PI/2
}
};
});
it('should show custom min/max guage labels', function () {
var chartArc = d3.select('.c3-chart-arcs'),
min = chartArc.select('.c3-chart-arcs-gauge-min'),
max = chartArc.select('.c3-chart-arcs-gauge-max');
expect(min.text()).toMatch('Min: 0%');
expect(max.text()).toMatch('Max: 100%');
});
});
});
Squashed commit of the following: commit 547311d30ca334c4bcd1c51cf13fa20ae28eb740 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 14:35:09 2017 +0200 for multi-arc-gauge the radius has changed to let the label fit in the chart commit 43ba49dd154995bdfac4ac5d756076616824ae8f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 13:00:29 2017 +0200 fixed warnings of travis check commit 7f5a025de45b06683f08866da2e9680dd149422f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 rebased, conflict resolved, bugfixed, refactored and tests added commit 013f0666a7e0583a698667a0b8a6702490804ea0 Merge: ff175d1 c343243 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 12:40:39 2017 +0200 Merge remote-tracking branch 'upstream/master' into feature/multi-arc-gauge # Conflicts: # src/arc.js # src/data.js commit ff175d15ea04786b72303d76d2b74ed28d5731f6 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 optimized position of arc label line commit 0bf2cefff3644852119f5f739208b46779d0db42 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:44:50 2016 +0100 wrong tooltip position for gauges fixed commit 155c08c045421775a9b2c378c3e1e3d83c651091 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:49:25 2016 +0100 also hide arc label line when gauge_label_show is false commit e145b5c2a5878abe60d2b5a68aeca060778917bd Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 draw line from arc end to its label to highlight the relation commit 28616bf8104ec261ae8c7ee76a9240ef84bc9688 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 add background for every single arc commit cb2aaf16721d2e32ce7aec0a3213d382d7842f72 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 label placement for more than one arc commit 6ecc60987826c2d095406a5d26dfdb914b90d5df Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 gauge_arcs_minWidth property to determine the minimal width of gaugearcs until the innerRadius disappears commit 5689dee384e02faf35f5de085a404d0970fdb9dc Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:24:18 2015 +0200 visibleTargetCount for cleaner arc calculation commit 9a2686c37f6dcae833fe32f793280bd77479e564 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:21:13 2015 +0200 more than one arc are possible for gauges commit 0866234001c25ce81a4d7d25804b74e0a9e5d83f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Mon Aug 10 17:07:48 2015 +0200 show legend for gauges which have more than one arc
7 years ago
describe('with more than one data_column ', function () {
beforeAll(function () {
args = {
data: {
columns: [
['padded1', 100],
['padded2', 90],
['padded3', 50],
['padded4', 20]
],
type: 'gauge'
Squashed commit of the following: commit 547311d30ca334c4bcd1c51cf13fa20ae28eb740 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 14:35:09 2017 +0200 for multi-arc-gauge the radius has changed to let the label fit in the chart commit 43ba49dd154995bdfac4ac5d756076616824ae8f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 13:00:29 2017 +0200 fixed warnings of travis check commit 7f5a025de45b06683f08866da2e9680dd149422f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 rebased, conflict resolved, bugfixed, refactored and tests added commit 013f0666a7e0583a698667a0b8a6702490804ea0 Merge: ff175d1 c343243 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 12:40:39 2017 +0200 Merge remote-tracking branch 'upstream/master' into feature/multi-arc-gauge # Conflicts: # src/arc.js # src/data.js commit ff175d15ea04786b72303d76d2b74ed28d5731f6 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 optimized position of arc label line commit 0bf2cefff3644852119f5f739208b46779d0db42 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:44:50 2016 +0100 wrong tooltip position for gauges fixed commit 155c08c045421775a9b2c378c3e1e3d83c651091 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:49:25 2016 +0100 also hide arc label line when gauge_label_show is false commit e145b5c2a5878abe60d2b5a68aeca060778917bd Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 draw line from arc end to its label to highlight the relation commit 28616bf8104ec261ae8c7ee76a9240ef84bc9688 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 add background for every single arc commit cb2aaf16721d2e32ce7aec0a3213d382d7842f72 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 label placement for more than one arc commit 6ecc60987826c2d095406a5d26dfdb914b90d5df Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 gauge_arcs_minWidth property to determine the minimal width of gaugearcs until the innerRadius disappears commit 5689dee384e02faf35f5de085a404d0970fdb9dc Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:24:18 2015 +0200 visibleTargetCount for cleaner arc calculation commit 9a2686c37f6dcae833fe32f793280bd77479e564 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:21:13 2015 +0200 more than one arc are possible for gauges commit 0866234001c25ce81a4d7d25804b74e0a9e5d83f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Mon Aug 10 17:07:48 2015 +0200 show legend for gauges which have more than one arc
7 years ago
},
color: {
pattern: ['#FF0000', '#F97600', '#F6C600', '#60B044'],
threshold: {
values: [30, 80, 95]
}
}
};
});
var arcColor = ['rgb(96, 176, 68)', 'rgb(246, 198, 0)', 'rgb(249, 118, 0)', 'rgb(255, 0, 0)'];
Squashed commit of the following: commit 547311d30ca334c4bcd1c51cf13fa20ae28eb740 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 14:35:09 2017 +0200 for multi-arc-gauge the radius has changed to let the label fit in the chart commit 43ba49dd154995bdfac4ac5d756076616824ae8f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 13:00:29 2017 +0200 fixed warnings of travis check commit 7f5a025de45b06683f08866da2e9680dd149422f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 rebased, conflict resolved, bugfixed, refactored and tests added commit 013f0666a7e0583a698667a0b8a6702490804ea0 Merge: ff175d1 c343243 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 12:40:39 2017 +0200 Merge remote-tracking branch 'upstream/master' into feature/multi-arc-gauge # Conflicts: # src/arc.js # src/data.js commit ff175d15ea04786b72303d76d2b74ed28d5731f6 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 optimized position of arc label line commit 0bf2cefff3644852119f5f739208b46779d0db42 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:44:50 2016 +0100 wrong tooltip position for gauges fixed commit 155c08c045421775a9b2c378c3e1e3d83c651091 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:49:25 2016 +0100 also hide arc label line when gauge_label_show is false commit e145b5c2a5878abe60d2b5a68aeca060778917bd Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 draw line from arc end to its label to highlight the relation commit 28616bf8104ec261ae8c7ee76a9240ef84bc9688 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 add background for every single arc commit cb2aaf16721d2e32ce7aec0a3213d382d7842f72 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 label placement for more than one arc commit 6ecc60987826c2d095406a5d26dfdb914b90d5df Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 gauge_arcs_minWidth property to determine the minimal width of gaugearcs until the innerRadius disappears commit 5689dee384e02faf35f5de085a404d0970fdb9dc Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:24:18 2015 +0200 visibleTargetCount for cleaner arc calculation commit 9a2686c37f6dcae833fe32f793280bd77479e564 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:21:13 2015 +0200 more than one arc are possible for gauges commit 0866234001c25ce81a4d7d25804b74e0a9e5d83f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Mon Aug 10 17:07:48 2015 +0200 show legend for gauges which have more than one arc
7 years ago
describe('should contain arcs ', function () {
it('each data_column should have one arc', function () {
chart.internal.main.selectAll('.c3-chart-arc .c3-arc').each(function (d, i) {
expect(d3.select(this).classed('c3-arc-' + args.data.columns[i][0])).toBeTruthy();
Squashed commit of the following: commit 547311d30ca334c4bcd1c51cf13fa20ae28eb740 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 14:35:09 2017 +0200 for multi-arc-gauge the radius has changed to let the label fit in the chart commit 43ba49dd154995bdfac4ac5d756076616824ae8f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 13:00:29 2017 +0200 fixed warnings of travis check commit 7f5a025de45b06683f08866da2e9680dd149422f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 rebased, conflict resolved, bugfixed, refactored and tests added commit 013f0666a7e0583a698667a0b8a6702490804ea0 Merge: ff175d1 c343243 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 12:40:39 2017 +0200 Merge remote-tracking branch 'upstream/master' into feature/multi-arc-gauge # Conflicts: # src/arc.js # src/data.js commit ff175d15ea04786b72303d76d2b74ed28d5731f6 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 optimized position of arc label line commit 0bf2cefff3644852119f5f739208b46779d0db42 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:44:50 2016 +0100 wrong tooltip position for gauges fixed commit 155c08c045421775a9b2c378c3e1e3d83c651091 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:49:25 2016 +0100 also hide arc label line when gauge_label_show is false commit e145b5c2a5878abe60d2b5a68aeca060778917bd Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 draw line from arc end to its label to highlight the relation commit 28616bf8104ec261ae8c7ee76a9240ef84bc9688 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 add background for every single arc commit cb2aaf16721d2e32ce7aec0a3213d382d7842f72 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 label placement for more than one arc commit 6ecc60987826c2d095406a5d26dfdb914b90d5df Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 gauge_arcs_minWidth property to determine the minimal width of gaugearcs until the innerRadius disappears commit 5689dee384e02faf35f5de085a404d0970fdb9dc Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:24:18 2015 +0200 visibleTargetCount for cleaner arc calculation commit 9a2686c37f6dcae833fe32f793280bd77479e564 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:21:13 2015 +0200 more than one arc are possible for gauges commit 0866234001c25ce81a4d7d25804b74e0a9e5d83f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Mon Aug 10 17:07:48 2015 +0200 show legend for gauges which have more than one arc
7 years ago
});
});
it('each arc should have the color from color_pattern if color_treshold is given ', function () {
chart.internal.main.selectAll('.c3-chart-arc .c3-arc').each(function (d, i) {
expect(d3.select(this).style('fill')).toBe(arcColor[i]);
});
});
});
describe('should contain backgrounds ', 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) {
expect(d3.select(this).classed('c3-chart-arcs-background-'+ i)).toBeTruthy();
});
});
it('each background should have tbe same color', function () {
chart.internal.main.selectAll('.c3-chart-arcs path.c3-chart-arcs-background').each(function () {
expect(d3.select(this).style('fill')).toBe('rgb(224, 224, 224)');
Squashed commit of the following: commit 547311d30ca334c4bcd1c51cf13fa20ae28eb740 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 14:35:09 2017 +0200 for multi-arc-gauge the radius has changed to let the label fit in the chart commit 43ba49dd154995bdfac4ac5d756076616824ae8f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 13:00:29 2017 +0200 fixed warnings of travis check commit 7f5a025de45b06683f08866da2e9680dd149422f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 rebased, conflict resolved, bugfixed, refactored and tests added commit 013f0666a7e0583a698667a0b8a6702490804ea0 Merge: ff175d1 c343243 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 12:40:39 2017 +0200 Merge remote-tracking branch 'upstream/master' into feature/multi-arc-gauge # Conflicts: # src/arc.js # src/data.js commit ff175d15ea04786b72303d76d2b74ed28d5731f6 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 optimized position of arc label line commit 0bf2cefff3644852119f5f739208b46779d0db42 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:44:50 2016 +0100 wrong tooltip position for gauges fixed commit 155c08c045421775a9b2c378c3e1e3d83c651091 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:49:25 2016 +0100 also hide arc label line when gauge_label_show is false commit e145b5c2a5878abe60d2b5a68aeca060778917bd Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 draw line from arc end to its label to highlight the relation commit 28616bf8104ec261ae8c7ee76a9240ef84bc9688 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 add background for every single arc commit cb2aaf16721d2e32ce7aec0a3213d382d7842f72 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 label placement for more than one arc commit 6ecc60987826c2d095406a5d26dfdb914b90d5df Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 gauge_arcs_minWidth property to determine the minimal width of gaugearcs until the innerRadius disappears commit 5689dee384e02faf35f5de085a404d0970fdb9dc Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:24:18 2015 +0200 visibleTargetCount for cleaner arc calculation commit 9a2686c37f6dcae833fe32f793280bd77479e564 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:21:13 2015 +0200 more than one arc are possible for gauges commit 0866234001c25ce81a4d7d25804b74e0a9e5d83f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Mon Aug 10 17:07:48 2015 +0200 show legend for gauges which have more than one arc
7 years ago
});
});
});
describe('should contain labels', function () {
it('each data_column should have a label', function () {
chart.internal.main.selectAll('.c3-chart-arc .c3-gauge-value').each(function (d, i) {
expect(d3.select(this).text()).toBe(chart.internal.defaultArcValueFormat(null, args.data.columns[i][1] / 100));
Squashed commit of the following: commit 547311d30ca334c4bcd1c51cf13fa20ae28eb740 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 14:35:09 2017 +0200 for multi-arc-gauge the radius has changed to let the label fit in the chart commit 43ba49dd154995bdfac4ac5d756076616824ae8f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 13:00:29 2017 +0200 fixed warnings of travis check commit 7f5a025de45b06683f08866da2e9680dd149422f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 rebased, conflict resolved, bugfixed, refactored and tests added commit 013f0666a7e0583a698667a0b8a6702490804ea0 Merge: ff175d1 c343243 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 12:40:39 2017 +0200 Merge remote-tracking branch 'upstream/master' into feature/multi-arc-gauge # Conflicts: # src/arc.js # src/data.js commit ff175d15ea04786b72303d76d2b74ed28d5731f6 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 optimized position of arc label line commit 0bf2cefff3644852119f5f739208b46779d0db42 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:44:50 2016 +0100 wrong tooltip position for gauges fixed commit 155c08c045421775a9b2c378c3e1e3d83c651091 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:49:25 2016 +0100 also hide arc label line when gauge_label_show is false commit e145b5c2a5878abe60d2b5a68aeca060778917bd Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 draw line from arc end to its label to highlight the relation commit 28616bf8104ec261ae8c7ee76a9240ef84bc9688 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 add background for every single arc commit cb2aaf16721d2e32ce7aec0a3213d382d7842f72 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 label placement for more than one arc commit 6ecc60987826c2d095406a5d26dfdb914b90d5df Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 gauge_arcs_minWidth property to determine the minimal width of gaugearcs until the innerRadius disappears commit 5689dee384e02faf35f5de085a404d0970fdb9dc Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:24:18 2015 +0200 visibleTargetCount for cleaner arc calculation commit 9a2686c37f6dcae833fe32f793280bd77479e564 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:21:13 2015 +0200 more than one arc are possible for gauges commit 0866234001c25ce81a4d7d25804b74e0a9e5d83f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Mon Aug 10 17:07:48 2015 +0200 show legend for gauges which have more than one arc
7 years ago
});
});
it('each label should have the same color', function () {
chart.internal.main.selectAll('.c3-chart-arc .c3-gauge-value').each(function () {
expect(d3.select(this).style('fill')).toBe('rgb(0, 0, 0)');
Squashed commit of the following: commit 547311d30ca334c4bcd1c51cf13fa20ae28eb740 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 14:35:09 2017 +0200 for multi-arc-gauge the radius has changed to let the label fit in the chart commit 43ba49dd154995bdfac4ac5d756076616824ae8f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 13:00:29 2017 +0200 fixed warnings of travis check commit 7f5a025de45b06683f08866da2e9680dd149422f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 rebased, conflict resolved, bugfixed, refactored and tests added commit 013f0666a7e0583a698667a0b8a6702490804ea0 Merge: ff175d1 c343243 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 12:40:39 2017 +0200 Merge remote-tracking branch 'upstream/master' into feature/multi-arc-gauge # Conflicts: # src/arc.js # src/data.js commit ff175d15ea04786b72303d76d2b74ed28d5731f6 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 optimized position of arc label line commit 0bf2cefff3644852119f5f739208b46779d0db42 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:44:50 2016 +0100 wrong tooltip position for gauges fixed commit 155c08c045421775a9b2c378c3e1e3d83c651091 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:49:25 2016 +0100 also hide arc label line when gauge_label_show is false commit e145b5c2a5878abe60d2b5a68aeca060778917bd Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 draw line from arc end to its label to highlight the relation commit 28616bf8104ec261ae8c7ee76a9240ef84bc9688 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 add background for every single arc commit cb2aaf16721d2e32ce7aec0a3213d382d7842f72 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 label placement for more than one arc commit 6ecc60987826c2d095406a5d26dfdb914b90d5df Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 gauge_arcs_minWidth property to determine the minimal width of gaugearcs until the innerRadius disappears commit 5689dee384e02faf35f5de085a404d0970fdb9dc Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:24:18 2015 +0200 visibleTargetCount for cleaner arc calculation commit 9a2686c37f6dcae833fe32f793280bd77479e564 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:21:13 2015 +0200 more than one arc are possible for gauges commit 0866234001c25ce81a4d7d25804b74e0a9e5d83f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Mon Aug 10 17:07:48 2015 +0200 show legend for gauges which have more than one arc
7 years ago
});
});
it('if only one data_column is visible the label should have "" for transform', function (done) {
var textBeforeHide = chart.internal.main.select('.c3-chart-arc.c3-target.c3-target-padded4 text');
expect(textBeforeHide.attr('transform')).not.toBe('');
Squashed commit of the following: commit 547311d30ca334c4bcd1c51cf13fa20ae28eb740 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 14:35:09 2017 +0200 for multi-arc-gauge the radius has changed to let the label fit in the chart commit 43ba49dd154995bdfac4ac5d756076616824ae8f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 13:00:29 2017 +0200 fixed warnings of travis check commit 7f5a025de45b06683f08866da2e9680dd149422f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 rebased, conflict resolved, bugfixed, refactored and tests added commit 013f0666a7e0583a698667a0b8a6702490804ea0 Merge: ff175d1 c343243 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 12:40:39 2017 +0200 Merge remote-tracking branch 'upstream/master' into feature/multi-arc-gauge # Conflicts: # src/arc.js # src/data.js commit ff175d15ea04786b72303d76d2b74ed28d5731f6 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 optimized position of arc label line commit 0bf2cefff3644852119f5f739208b46779d0db42 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:44:50 2016 +0100 wrong tooltip position for gauges fixed commit 155c08c045421775a9b2c378c3e1e3d83c651091 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:49:25 2016 +0100 also hide arc label line when gauge_label_show is false commit e145b5c2a5878abe60d2b5a68aeca060778917bd Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 draw line from arc end to its label to highlight the relation commit 28616bf8104ec261ae8c7ee76a9240ef84bc9688 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 add background for every single arc commit cb2aaf16721d2e32ce7aec0a3213d382d7842f72 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 label placement for more than one arc commit 6ecc60987826c2d095406a5d26dfdb914b90d5df Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 gauge_arcs_minWidth property to determine the minimal width of gaugearcs until the innerRadius disappears commit 5689dee384e02faf35f5de085a404d0970fdb9dc Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:24:18 2015 +0200 visibleTargetCount for cleaner arc calculation commit 9a2686c37f6dcae833fe32f793280bd77479e564 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:21:13 2015 +0200 more than one arc are possible for gauges commit 0866234001c25ce81a4d7d25804b74e0a9e5d83f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Mon Aug 10 17:07:48 2015 +0200 show legend for gauges which have more than one arc
7 years ago
chart.hide(['padded1', 'padded2', 'padded3']);
setTimeout(function () {
var textAfterHide = chart.internal.main.select('.c3-chart-arc.c3-target.c3-target-padded4 text');
expect(textAfterHide.attr('transform')).toBe('');
done();
}, 1000);
Squashed commit of the following: commit 547311d30ca334c4bcd1c51cf13fa20ae28eb740 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 14:35:09 2017 +0200 for multi-arc-gauge the radius has changed to let the label fit in the chart commit 43ba49dd154995bdfac4ac5d756076616824ae8f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 13:00:29 2017 +0200 fixed warnings of travis check commit 7f5a025de45b06683f08866da2e9680dd149422f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 rebased, conflict resolved, bugfixed, refactored and tests added commit 013f0666a7e0583a698667a0b8a6702490804ea0 Merge: ff175d1 c343243 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 12:40:39 2017 +0200 Merge remote-tracking branch 'upstream/master' into feature/multi-arc-gauge # Conflicts: # src/arc.js # src/data.js commit ff175d15ea04786b72303d76d2b74ed28d5731f6 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 optimized position of arc label line commit 0bf2cefff3644852119f5f739208b46779d0db42 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:44:50 2016 +0100 wrong tooltip position for gauges fixed commit 155c08c045421775a9b2c378c3e1e3d83c651091 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:49:25 2016 +0100 also hide arc label line when gauge_label_show is false commit e145b5c2a5878abe60d2b5a68aeca060778917bd Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 draw line from arc end to its label to highlight the relation commit 28616bf8104ec261ae8c7ee76a9240ef84bc9688 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 add background for every single arc commit cb2aaf16721d2e32ce7aec0a3213d382d7842f72 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 label placement for more than one arc commit 6ecc60987826c2d095406a5d26dfdb914b90d5df Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 gauge_arcs_minWidth property to determine the minimal width of gaugearcs until the innerRadius disappears commit 5689dee384e02faf35f5de085a404d0970fdb9dc Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:24:18 2015 +0200 visibleTargetCount for cleaner arc calculation commit 9a2686c37f6dcae833fe32f793280bd77479e564 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:21:13 2015 +0200 more than one arc are possible for gauges commit 0866234001c25ce81a4d7d25804b74e0a9e5d83f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Mon Aug 10 17:07:48 2015 +0200 show legend for gauges which have more than one arc
7 years ago
});
});
describe('should contain labellines', 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) {
expect(d3.select(this).classed('c3-target-' + args.data.columns[i][0])).toBeTruthy();
Squashed commit of the following: commit 547311d30ca334c4bcd1c51cf13fa20ae28eb740 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 14:35:09 2017 +0200 for multi-arc-gauge the radius has changed to let the label fit in the chart commit 43ba49dd154995bdfac4ac5d756076616824ae8f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 13:00:29 2017 +0200 fixed warnings of travis check commit 7f5a025de45b06683f08866da2e9680dd149422f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 rebased, conflict resolved, bugfixed, refactored and tests added commit 013f0666a7e0583a698667a0b8a6702490804ea0 Merge: ff175d1 c343243 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Jun 23 12:40:39 2017 +0200 Merge remote-tracking branch 'upstream/master' into feature/multi-arc-gauge # Conflicts: # src/arc.js # src/data.js commit ff175d15ea04786b72303d76d2b74ed28d5731f6 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 15:14:34 2016 +0100 optimized position of arc label line commit 0bf2cefff3644852119f5f739208b46779d0db42 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:44:50 2016 +0100 wrong tooltip position for gauges fixed commit 155c08c045421775a9b2c378c3e1e3d83c651091 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Feb 4 14:49:25 2016 +0100 also hide arc label line when gauge_label_show is false commit e145b5c2a5878abe60d2b5a68aeca060778917bd Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 draw line from arc end to its label to highlight the relation commit 28616bf8104ec261ae8c7ee76a9240ef84bc9688 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 add background for every single arc commit cb2aaf16721d2e32ce7aec0a3213d382d7842f72 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 label placement for more than one arc commit 6ecc60987826c2d095406a5d26dfdb914b90d5df Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Fri Aug 28 09:36:31 2015 +0200 gauge_arcs_minWidth property to determine the minimal width of gaugearcs until the innerRadius disappears commit 5689dee384e02faf35f5de085a404d0970fdb9dc Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:24:18 2015 +0200 visibleTargetCount for cleaner arc calculation commit 9a2686c37f6dcae833fe32f793280bd77479e564 Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Thu Aug 27 10:21:13 2015 +0200 more than one arc are possible for gauges commit 0866234001c25ce81a4d7d25804b74e0a9e5d83f Author: Gökhan Özen <Goekhan.Oezen@hksinformatik.de> Date: Mon Aug 10 17:07:48 2015 +0200 show legend for gauges which have more than one arc
7 years ago
});
});
it('each labelline should have the color from color_pattern if color_treshold is given', function () {
chart.internal.main.selectAll('.c3-chart-arc .c3-arc-label-line').each(function (d, i) {
expect(d3.select(this).style('fill')).toBe(arcColor[i]);
});
});
});
});
});
});