Another productive afternoon:
This is the start of axes. The internals are getting very, very messy, but I really like the result. Here’s the code used to create this:
(defun line-chart-with-axis-labels () "draws a simple line chart" (let* ((seriesA (make-instance 'series :label "SeriesA" ;data expressed as a list (x y) pairs :data '((-1 -2) (0 4) (1 5) (4 6) (5 -3)))) (seriesB (make-instance 'series :label "SeriesB" :data '((-1 4) (0 -2) (1 6) (5 -2) (6 5)))) (y-axis (make-instance 'axis :label "widgets" :label-formatter #'(lambda (x-val) (format nil "~$" x-val)))) (chart (make-instance 'line-chart :width 400 :height 300 :background '(.7 .7 .7) :series (list seriesA seriesB) :y-axis y-axis))) (render-chart chart "line-chart-with-axis-labels.png")))
I predict adding X axes will be very similar to adding the Y axis, and then I’ll be looking more seriously at spending time to make good docs and releasing this back to the community. The API is getting a little dense, too, but that should be pretty easy to simplify, and I have a few ideas on how to do that.
One Comment