-
Notifications
You must be signed in to change notification settings - Fork 16
invalid default drawing: #f #27
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
Comments
Functions whose name starts with So you have two choices here: 1) provide a drawing parameter, or 2) make sure that This is how approach 1 looks like: (import (lispkit base) (lispkit draw) (lispkit draw chart bar))
(define d (make-drawing))
(draw-bar-chart
(list (bar "Jan" 0) (bar "Feb" 2) (bar "Mar" 6)
(bar "Apr" 9) (bar "May" 14) (bar "Jun" 16)
(bar "Jul" 19) (bar "Aug" 18) (bar "Sep" 15)
(bar "Oct" 11) (bar "Nov" 5) (bar "Dec" 2))
gray 5 "Temperature [C°]" "Month" (point 10 0)
(make-bar-chart-config 'size: (size 500 200))
#f d)
(save-drawing "test.pdf" d (size 520 210))
(open-file "test.pdf") And here's the same example using the (import (lispkit base) (lispkit draw) (lispkit draw chart bar))
(define d
(drawing
(draw-bar-chart
(list (bar "Jan" 0) (bar "Feb" 2) (bar "Mar" 6)
(bar "Apr" 9) (bar "May" 14) (bar "Jun" 16)
(bar "Jul" 19) (bar "Aug" 18) (bar "Sep" 15)
(bar "Oct" 11) (bar "Nov" 5) (bar "Dec" 2))
gray 5 "Temperature [C°]" "Month" (point 10 0)
(make-bar-chart-config 'size: (size 500 200))
#f)))
(save-drawing "test.pdf" d (size 520 210))
(open-file "test.pdf") I hope this helps. |
Many thanks Matthias.The example is very helpful.Perhaps you could include it in the documentation.Le 31 déc. 2024 06:18, Matthias Zenger ***@***.***> a écrit :
Functions whose name starts with draw- typically draw something into a drawing that is provided optionally as the last parameter. If the last parameter is missing (like in your example), the current drawing is used instead. It is implemented via the parameter object current-drawing of library (lispkit draw).
So you have two choices here: 1) provide a drawing parameter, or 2) make sure that current-drawing refers to a valid drawing (vs. #f — which is the default).
This is how approach 1 looks like:
(import (lispkit base) (lispkit draw) (lispkit draw chart bar))
(define d (make-drawing))
(draw-bar-chart
(list (bar "Jan" 0) (bar "Feb" 2) (bar "Mar" 6)
(bar "Apr" 9) (bar "May" 14) (bar "Jun" 16)
(bar "Jul" 19) (bar "Aug" 18) (bar "Sep" 15)
(bar "Oct" 11) (bar "Nov" 5) (bar "Dec" 2))
gray 5 "Temperature [C°]" "Month" (point 10 0)
(make-bar-chart-config 'size: (size 500 200))
#f d)
(save-drawing "test.pdf" d (size 520 210))
(open-file "test.pdf")
And here's the same example using the drawing syntax which creates a new empty drawing, assigns it to current-drawing and then invokes all the statements in the body of drawing:
(import (lispkit base) (lispkit draw) (lispkit draw chart bar))
(define d
(drawing
(draw-bar-chart
(list (bar "Jan" 0) (bar "Feb" 2) (bar "Mar" 6)
(bar "Apr" 9) (bar "May" 14) (bar "Jun" 16)
(bar "Jul" 19) (bar "Aug" 18) (bar "Sep" 15)
(bar "Oct" 11) (bar "Nov" 5) (bar "Dec" 2))
gray 5 "Temperature [C°]" "Month" (point 10 0)
(make-bar-chart-config 'size: (size 500 200))
#f)))
(save-drawing "test.pdf" d (size 520 210))
(open-file "test.pdf")
I hope this helps.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Hello,
thefollowing code generates an « invalid default drawing » error in LispPad 2.1 on IPadOs 18.2:
The text was updated successfully, but these errors were encountered: