MediaWiki:LeadingAndTrailingCells.js: Difference between revisions

Jump to navigation Jump to search
m
Protected "MediaWiki:LeadingAndTrailingCells.js": Executed as JS ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
Miraheze>Marshall
No edit summary
m (Protected "MediaWiki:LeadingAndTrailingCells.js": Executed as JS ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
let div = (a,b) => Math.floor(a/b);
let div = (a,b) => Math.floor(a/b);


const sc = 0.7;
let svg = d3.select('.LeadingAndTrailingCells')
let svg = d3.select('.LeadingAndTrailingCells')
     .append('svg')
     .append('svg').attrs({height:820*sc, width:620*sc})
    .attrs({height:890, width:800}).append('g')
    .append('g')
    .attr('transform',`scale(${sc})`)
     .attr('font-size',46)
     .attr('font-size',46)
     .attr('text-anchor','middle');
     .attr('text-anchor','middle');
Line 22: Line 24:
}
}


let Wo= 160,
let Wo= w/2+10,
     W = (shape[rank-1]-1)*w,
     W = (shape[rank-1]-1)*w,
     Wg= 180,
     Wg= 180,
     H = (shape[0]*(1+shape[1])-1)*h;
     H = (shape[0]*(1+shape[1])-1)*h;
let gs = svg.selectAll().data(['Trailing','Leading']).enter()
let gs = svg.selectAll().data(['Trailing','Leading']).enter()
     .append('g').attr('transform',(_,i)=>`translate(${Wo+(W+Wg)*i},140)`);
     .append('g').attr('transform',(_,i)=>`translate(${Wo+(W+Wg)*i},70)`);
gs.append('rect').attrs({x:-w/2,y:0,width:W+w,height:H,fill:'white'});
gs.append('rect').attrs({x:-w/2,y:0,width:W+w,height:H,fill:'white'});
gs.append('text').text(t=>t).attrs({ x:W/2, y:-40, 'font-size':40, fill:'#8c817a' });
gs.append('text').text(t=>t).attrs({ x:W/2, y:-40, 'font-size':40, fill:'#6b6560' });
svg.append('text').text('Cell axes').attrs({ x:Wo+W+Wg/2, y:h-22, fill:'#5b5754' });
gs.attr('stroke-width',3);
gs.attr('stroke-width',3);


Navigation menu