יחידה:גרפים: הבדלים בין גרסאות בדף
אופסי |
ניסוי |
||
| שורה 423: | שורה 423: | ||
function drawXlegends() | function drawXlegends() | ||
local setOffset, setWidth | local setOffset, setWidth | ||
local legendDivStyleFormat = "position:absolute;left:%spx;top:20px;min-width:%spx;max-width:%spx;text-align:center;veritical-align:top;padding:0 0.3em;" | |||
local legendDivStyleFormat = "position:absolute;left:%spx;top:20px;min-width:%spx;max-width:%spx;text-align:center;veritical-align:top; | |||
local tickDivstyleFormat = "position:absolute;left:%spx;height:10px;width:1px;border-left:1px solid black;" | local tickDivstyleFormat = "position:absolute;left:%spx;height:10px;width:1px;border-left:1px solid black;" | ||
for i = 1, numValues do | for i = 1, numValues do | ||
if not nulOrWhitespace( xlegends[i] ) then | if not nulOrWhitespace( xlegends[i] ) then | ||
setOffset, setWidth = groupBounds( i ) | setOffset, setWidth = groupBounds( i ) | ||
table.insert( res, mw.text.tag( 'div', | |||
table.insert( res, mw.text.tag( 'div', { style = string.format( legendDivStyleFormat, setOffset, setWidth | { | ||
class = xrotation and 'rot90', -- assigning null to a key means "do not use this key" | |||
style = string.format( legendDivStyleFormat, setOffset, setWidth, setWidth ) | |||
}, xlegends[i] or '' ) | |||
) | |||
table.insert( res, mw.text.tag( 'div', { style = string.format( tickDivstyleFormat, setOffset + setWidth / 2 ) }, '' ) ) | table.insert( res, mw.text.tag( 'div', { style = string.format( tickDivstyleFormat, setOffset + setWidth / 2 ) }, '' ) ) | ||
end | end | ||