[cl-pdf-devel] Subclassing charts

Marc Battyani marc.battyani at fractalconcept.com
Wed Feb 1 23:11:57 UTC 2006


"Jonathon McKitrick" <jcm at FreeBSD-uk.eu.org> wrote:
>
> Suppose I want to subclass a chart, and set some defaults for some slots.
> That seems easy:
>
> (defmethod initialize-instance :after ((chart <my-chart>))
> (setf (slot-value chart 'pdf:title) "My title"))
>
> Fine, no problem.  But what if the slot I want to set is in something not yet
> created, like the legend or axis objects?  How can I force the keyword
> parameters for the internal objects not yet created to be certain default
> values?

All the after methods are called in most-specific-last order. So the :after method of your
subclass is called after the predefined one and the axis objects will be already created.

This is why there are x-axis-options and y-axis-options in charts so that you can pass
specific values for the make-instance of the axis. What is lacking is the ability to pass
the class name to use for these axis but it's rather easy to add.

Marc





More information about the cl-pdf-devel mailing list