Skip to content

Commit

Permalink
update table docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cormullion committed Feb 27, 2018
1 parent e210909 commit 89f3884
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions docs/src/polygons.md
Original file line number Diff line number Diff line change
Expand Up @@ -798,18 +798,19 @@ sethue("black")
setline(0.25)
outerframe = Table([500], [400, 200])
total = 30
properties = Table(fill(15, total), [20, 85, 85], Point(200, 0))
radius = 150
text("radius = $radius", outerframe[1], halign=:center)
properties = Table(fill(15, total), [20, 85, 85], outerframe[1, 2])
radius = 55
sethue("grey20")
for i in 3:total
text(string(i), properties[i, 1], halign=:right)
p = ngon(outerframe[1], radius, i, 0, vertices=true)
poly(p, :stroke, close=true)
prettypoly(p, :stroke, close=true, () -> (sethue("red"); circle(O, 2, :fill)))
pa = polyarea(p)
pp = polyperimeter(p)
ppoverradius = pp/radius
text(string(Int(round(pa, 0))), properties[i, 2], halign=:left)
text(string(round(ppoverradius, 6)), properties[i, 3], halign=:left)
radius += 5
end
fontsize(10)
Expand Down
4 changes: 2 additions & 2 deletions src/Table.jl
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ function Table(rowheights::Array{T, 1}, colwidths::Array{T, 1}, center=O) where
ncols = length(colwidths)
currentrow = 1
currentcol = 1
leftmargin = -sum(colwidths)/2
topmargin = -sum(rowheights)/2
leftmargin = center.x - sum(colwidths)/2
topmargin = center.y - sum(rowheights)/2
Table(rowheights, colwidths, nrows, ncols, currentrow, currentcol, leftmargin, topmargin, center)
end

Expand Down

0 comments on commit 89f3884

Please sign in to comment.