Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix in preparation for https://github.com/nim-lang/Nim/pull/14447 #74

Merged
merged 2 commits into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/ggplotnim.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2129,8 +2129,9 @@ proc drawAnnotations*(view: var Viewport, p: GgPlot) =
marginH.pos * 2.0,
unit = ukRelative)
# find longest line of annotation to base background on
let font = annot.font # refs https://github.com/nim-lang/Nim/pull/14447
let maxLine = annot.text.strip.splitLines.sortedByIt(
getStrWidth(it, annot.font).val
getStrWidth(it, font).val
)[^1]
let maxWidth = getStrWidth(maxLine, annot.font)
# calculate required width for background rectangle. string width +
Expand Down
3 changes: 3 additions & 0 deletions src/ggplotnim/postprocess_scales.nim
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ proc applyTransformations(df: var DataFrame, scales: seq[Scale]) =
# transformations have been applied!
var fns: seq[FormulaNode]
for s in scales:
let s = s
# refs https://github.com/nim-lang/Nim/pull/14447
# alternative would be to use `sugar.capture(s)` instead of `closureScope`
if s.scKind == scTransformedData:
when defined(defaultBackend):
let col = evaluate(s.col)
Expand Down