Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
point.z = 3;
point._origin = { x: point.z, y: point.y, z: '4' };
points.push(point);
const points1 = [{
x: 50,
y: [ 10, 20 ],
z: [ '1', '2' ],
_origin: { x: 50, y: [ 10, 20 ], z: [ '1', '2' ] }
}, {
x: [ 60, 80 ],
y: [ 50, 50 ],
z: [ '3', '4' ],
_origin: { x: [ 60, 80 ], y: [ 50, 50 ], z: [ '3', '4' ] }
}];
const labelScale1 = Scale.cat({
field: 'z',
values: [[ '1', '2' ], [ '3', '4' ]]
});
describe('one point one label', function() {
let gLabels;
it('init', function() {
gLabels = canvas.addGroup(PolarLabels, {
coord,
labelCfg: {
cfg: {
offset: 10
},
scales: [ labelScale ]
},
geomType: 'point'
});
describe('Guide: 辅助 html', function() {
const coord = new Coord.Rect({
start: { x: 60, y: 460 },
end: { x: 460, y: 60 }
});
const canvas = new Canvas({
containerId: 'c1',
width: 500,
height: 500,
pixelRatio: 2
});
const group = canvas.addGroup();
const xScale = Scale.cat({
values: [ '一月', '二月', '三月', '四月', '五月' ]
});
const yScale = Scale.linear({
min: 0,
max: 1200
});
it('guide html, with defaul position(middle, middle)', function() {
const html = new Html({
xScales: {
month: xScale
},
yScales: {
temp: yScale
},
it('create area', function() {
scaleA = Scale.cat({
field: 'a',
values: [ '1', '2', '3' ],
range: [ 0.2, 0.8 ]
});
geom = new Geom.Area({
data,
coord,
container: group,
scales: { a: scaleA, b: scaleB, c: scaleC, red: ScaleRed, 10: ScaleTen }
});
shapeContainer = geom.get('shapeContainer');
expect(geom.get('type')).equal('area');
expect(geom.get('shapeType')).equal('area');
});
start: { x: 60, y: 460 },
end: { x: 460, y: 60 },
startAngle: -9 / 8 * Math.PI,
endAngle: 1 / 8 * Math.PI
});
const canvas = new Canvas({
containerId: 'arc-spec',
width: 500,
height: 500,
pixelRatio: 2
});
const group = canvas.addGroup();
const xScale = Scale.cat({
values: [ '一月', '二月', '三月', '四月', '五月' ]
});
const yScale = Scale.linear({
min: 0,
max: 1200
});
it('guide arc', function() {
const arc = new Arc({
xScales: {
month: xScale
},
yScales: {
temp: yScale
},
describe('test geom interval', function() {
const data = [
{ a: '1', b: 2, c: '1' },
{ a: '2', b: 5, c: '1' },
{ a: '3', b: 4, c: '1' },
{ a: '1', b: 3, c: '2' },
{ a: '2', b: 1, c: '2' },
{ a: '3', b: 2, c: '2' }
];
scaleA = Scale.cat({
field: 'a',
values: [ '1', '2', '3' ],
range: [ 0.2, 0.8 ]
});
const group = canvas.addGroup();
const geom = new Geom.Interval({
data,
coord,
container: group,
scales: { a: scaleA, b: scaleB, c: scaleC, red: ScaleRed, 10: ScaleTen }
});
const shapeContainer = geom.get('shapeContainer');
it('draw interval', function() {
expect(geom.get('type')).eql('interval');
geom.position('a*b').color('c').adjust('dodge');
describe('Guide: 辅助背景框', function() {
const coord = new Coord.Rect({
start: { x: 60, y: 460 },
end: { x: 460, y: 60 }
});
const canvas = new Canvas({
containerId: 'c1',
width: 500,
height: 500,
pixelRatio: 2
});
const group = canvas.addGroup();
const xScale = Scale.cat({
values: [ '一月', '二月', '三月', '四月', '五月' ]
});
const yScale = Scale.linear({
min: 0,
max: 1200
});
it('guide region', function() {
const region = new Region({
xScales: {
month: xScale
},
yScales: {
temp: yScale
},
});
let scaleA = Scale.linear({
field: 'a',
min: 0,
max: 10
});
const scaleB = Scale.linear({
field: 'b',
min: 0,
max: 5,
nice: false
});
const scaleC = Scale.cat({
field: 'c',
values: [ '1', '2' ]
});
const ScaleRed = Scale.identity({
field: 'red',
value: 'red'
});
const ScaleTen = Scale.identity({
field: '10',
value: 10
});
const coord = new Coord.Rect({
start: {
x: 0,
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' } },
{ x: 100, y: 50, z: 1, _origin: { x: 100, y: 50, z: '2' } },
{ x: 10, y: 50, z: 2, _origin: { x: 10, y: 50, z: '3' } }
];
const point = coord.convertPoint({
x: 0.125,
y: 0.8
});
point.z = 3;
point._origin = { x: point.z, y: point.y, z: '4' };
points.push(point);
width: 500,
height: 500
});
const coord = new Coord.Cartesian({
start: {
x: 0,
y: 100
},
end: {
x: 100,
y: 0
}
});
const labelScale = Scale.cat({
field: 'z',
values: [ '1', '2' ]
});
const points = [
{ x: 100, y: 10, z: 0, _origin: { x: 100, y: 10, z: '1' } },
{ x: 100, y: 20, z: 1, _origin: { x: 100, y: 20, z: '2' } }
];
const labelScale1 = Scale.cat({
field: 'z',
values: [[ '1', '2' ], [ '3', '4' ]]
});
const points1 = [
{ x: 100, y: [ 10, 20 ], z: [ '1', '2' ], _origin: { x: 100, y: [ 10, 20 ], z: [ '1', '2' ] } },
{ x: 100, y: [ 30, 40 ], z: [ '3', '4' ], _origin: { x: 100, y: [ 30, 40 ], z: [ '3', '4' ] } }
];
_scaleSelector(type, domain) {
const params = {
min: domain[0],
max: domain[domain.length - 1]
};
switch (type) {
case 'Category':
return Scale.cat({
values: domain
});
default:
return Scale.linear(params);
}
}
destroy() {