3,038
edits
Miraheze>Marshall (Created page with "let div = (a,b) => Math.floor(a/b); let svg = d3.select('.LeadingAndTrailingCells') .attrs({height:890, width:800}).append('g') .attr('font-size',46) .attr('text-...") |
m (Protected "MediaWiki:LeadingAndTrailingCells.js": Executed as JS ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))) |
||
(6 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') | ||
.attrs({height: | .append('svg').attrs({height:820*sc, width:620*sc}) | ||
.append('g') | |||
.attr('transform',`scale(${sc})`) | |||
.attr('font-size',46) | .attr('font-size',46) | ||
.attr('text-anchor','middle'); | .attr('text-anchor','middle'); | ||
Line 21: | Line 24: | ||
} | } | ||
let Wo= | 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}, | .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:'# | gs.append('text').text(t=>t).attrs({ x:W/2, y:-40, 'font-size':40, fill:'#6b6560' }); | ||
gs.attr('stroke-width',3); | gs.attr('stroke-width',3); | ||