Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
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
},
position: {
month: 3,
temp: 600
},
describe('test geom line', function() {
let data = [{ a: 4, b: 3, c: '1' }, { a: 2, b: 2, c: '2' }];
const scaleA = Scale.linear({
field: 'a',
min: 0,
max: 10
});
const scaleB = Scale.linear({
field: 'b',
min: 0,
max: 5,
nice: false
});
const group = canvas.addGroup();
const geom = new Geom.Line({
data,
coord,
container: group,
scales: { a: scaleA, b: scaleB, c: scaleC, red: ScaleRed }
});
const shapeContainer = geom.get('shapeContainer');
it('draw path', function() {
expect(geom.get('type')).eql('line');
});
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
},
start: {
month: 0,
temp: 1200
},
});
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 line without text', function() {
const line = new Line({
xScales: {
month: xScale
},
yScales: {
temp: yScale
},
start: {
month: '一月',
temp: 200
},
});
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 text', function() {
const text = new Text({
xScales: {
month: xScale
},
yScales: {
temp: yScale
},
content: '(一月,200)',
position: {
month: '三月',
temp: 'min'
describe('test geom line', function() {
let data = [{ a: 4, b: 3, c: '1' }, { a: 2, b: 2, c: '2' }];
const scaleA = Scale.linear({
field: 'a',
min: 0,
max: 10
});
const scaleB = Scale.linear({
field: 'b',
min: 0,
max: 5,
nice: false
});
const group = canvas.addGroup();
const geom = new Geom.Line({
data,
coord,
container: group,
scales: { a: scaleA, b: scaleB, c: scaleC, red: ScaleRed }
describe('GuideController', function() {
const canvas = new Canvas({
containerId: 'guideTest',
width: 200,
height: 200
});
const frontContainer = canvas.addGroup();
const backContainer = canvas.addGroup();
const xScale = Scale.cat({
range: [ 0.1, 0.9 ],
values: [ 'a', 'b', 'c', 'd', 'e' ],
ticks: [ 'a', 'b', 'c', 'd', 'e' ],
field: 'x'
});
const yScale1 = Scale.linear({
min: 100,
max: 600,
values: [ 250, 350, 150, 450, 550 ],
ticks: [ 250, 350, 150, 450, 550 ],
field: 'y1'
});
const yScale2 = Scale.linear({
min: 0,
max: 100,
values: [ 0, 20, 40, 60, 80, 100 ],
ticks: [ 0, 20, 40, 60, 80, 100 ],
field: 'y2'
});
const xScales = {
_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() {