Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('transpose labels', function() {
const coord = new Coord.Polar({
start: {
x: 0,
y: 100
},
end: {
x: 100,
y: 0
}
});
coord.transpose();
describe('offset < 0', function() {
let gLabels;
it('init', function() {
gLabels = canvas.addGroup(PolarLabels, {
coord,
it('get coord radius', function() {
const coord = new Coord.Polar({
start: {
x: 0,
y: 0
},
end: {
x: 200,
y: 200
}
});
expect(coord.radius).equal(100);
expect(PathUtil.getPointRadius(coord, { x: 100, y: 100 })).equal(0);
expect(PathUtil.getPointRadius(coord, { x: 100, y: 0 })).equal(100);
});
it('convertPolarPath', function() {
const coord = new Coord.Polar({
start: {
x: 0,
y: 0
},
end: {
x: 200,
y: 200
}
});
const path = [[ 'M', 0, 0 ], [ 'L', 0, 1 ], [ 'L', 0.25, 1 ]];
const toPath = PathUtil.convertPolarPath(coord, path);
expect(toPath).eqls([[ 'M', 100, 100 ], [ 'L', 100, 0 ], [ 'A', 100, 100, 0, 0, 1, 200, 100 ]]);
});
it('get Point Angle', function() {
const coord = new Coord.Polar({
start: {
x: 0,
y: 0
},
end: {
x: 200,
y: 200
}
});
expect(PathUtil.getPointAngle(coord, { x: 100, y: 100 })).equal(0);
expect(PathUtil.getPointAngle(coord, { x: 0, y: 100 })).equal(Math.PI);
});
describe('edge shape test polar', function() {
const canvas2 = canvas;
const coord2 = new Coord.Polar({
start: {
x: 0,
y: 500
},
end: {
x: 500,
y: 0
}
});
it('draw shape arc polar hasWeight', function() {
const shapeObj = Shape.getShapeFactory('edge');
shapeObj._coord = coord2;
const obj = {
x: [ 0.2, 0.4, 0.6, 0.7 ],
y: [ 0.5, 0.5, 0.5, 0.5 ]
it('parse path in circle', function() {
const newCoord = new Coord.Polar({
start: {
x: 0,
y: 0
},
end: {
x: 200,
y: 200
}
});
const testFactory = Shape.getShapeFactory('test');
testFactory.setCoord(newCoord);
const shape = testFactory.getShape('test');
let path = [[ 'M', 0, 0 ], [ 'L', 0, 1 ], [ 'L', 0.5, 1 ]];
let toPath = shape.parsePath(path);
expect(toPath[0]).eqls([ 'M', 100, 100 ]);
expect(toPath[1]).eqls([ 'L', 100, 0 ]);
describe('area shapes Polar', function() {
coord = new Coord.Polar({
start: {
x: 0,
y: 500
},
end: {
x: 500,
y: 0
}
});
it('getShapePoints && drawShape', function() {
const type = 'area';
const points1 = Area.getShapePoints(type, {
x: 0.1,
y: 0.2,
y0: 0,
size: 0.5
it('arc direction', () => {
const coord = new Coord.Polar({
start: { x: 0, y: 500 },
end: { x: 500, y: 0 },
startAngle: 6,
endAngle: 3,
innerRadius: 0.3
});
const shapeObj = Shape.getShapeFactory('edge');
shapeObj._coord = coord;
const obj = {
x: [ 0.2, 0.4, 0.6, 0.7 ],
y: [ 0.5, 0.5, 0.5, 0.5 ]
};
const points = shapeObj.getShapePoints('arc', obj);
const shape = shapeObj.drawShape('arc', {
points,
color: 'green',
describe('polar labels', function() {
const coord = new Coord.Polar({
start: {
x: 0,
y: 100
},
end: {
x: 100,
y: 0
}
});
const labelScale = Scale.cat({
field: 'z',
values: [ '1', '2', '3', '4' ]
});
const points = [
{ x: 50, y: 10, z: 0, _origin: { x: 50, y: 10, z: '1' } },
describe('pie text not stack', function() {
const coord = new Coord.Polar({
start: {
x: 100,
y: 300
},
end: {
x: 200,
y: 200
}
});
coord.transpose();
const points = [];
const values = [];
for (let i = 1; i <= 4; i++) {
const obj = coord.convertPoint({
x: 0.5,