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)))
 
(3 intermediate revisions by 2 users not shown)
Line 3: Line 3:
const sc = 0.7;
const sc = 0.7;
let svg = d3.select('.LeadingAndTrailingCells')
let svg = d3.select('.LeadingAndTrailingCells')
     .append('svg').attrs({height:890*sc, width:620*sc})
     .append('svg').attrs({height:820*sc, width:620*sc})
     .append('g')
     .append('g')
     .attr('transform','scale(sc)')
     .attr('transform',`scale(${sc})`)
     .attr('font-size',46)
     .attr('font-size',46)
     .attr('text-anchor','middle');
     .attr('text-anchor','middle');
Line 29: Line 29:
     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