On Mon, Sep 16, 2013 at 10:20:03AM +0200, Klaus Schilling wrote:
> Would it also be feasible to use (encapsulated?) postscript instead of
> SVG? 

Probably.

But what surely works well is Gnuplot. We used it in the mentioned
project to draw the final data. Code fragments:

In a library file:

   # Draw Gnuplot
   # Data in (tmp "gp.csv")
   # Result in (tmp "gp.{typ}")
   (de gnuplot (Typ SizeX SizeY Flags Col)
      (out (tmp "gp.cmd")
         (if (== Typ 'eps)  # 'eps' or 'png'
            (prinl
               "set terminal postscript eps  size "
               SizeX
               ", "
               SizeY
               " enhanced color" )
            (prinl
               "set terminal png  font helvetica 9  size "
               SizeX
               ", "
               SizeY ) )
         (prinl "set encoding utf8")
         (prinl "set xlabel \"Netzteil [mA]\"")
         (prinl "set y2label \"Drehmoment [Nm]\"")
         (prinl "set ytics")
         (prinl "set ytics nomirror")
         (prinl "set y2tics")
         (prinl "set grid xtics")
         (prinl "set grid y2tics")
         (prinl "set key outside bottom")
         (prinl "set style data lines")
         (prinl "set output \"" (tmp "gp." Typ) "\"")
         (prin "plot \"" (tmp "gp.csv")
            "\" using 1:3  axes x1y2  lc rgb \"red\"  t \"Drehmoment [Nm]\"" )
         (mapc
            '((F L I)
               (and
                  F
                  I
                  (prin ", \"" (tmp "gp.csv")
                     "\" using 1:" I
                     " lc rgb \"" (caddr L)
                     "\" t \"" (cadr L) "\"" ) ) )
            Flags
            Col
            (2 NIL 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18) )
         (prinl) )
      (call 'gnuplot (tmp "gp.cmd")) )

The chart with data in the GUI:

   (gui '(+E/R +Chart) '(sel : home obj) 19)
   (<table> 'chart "Selektion"
      (mapcar
         '((L)
            (list
               (cons 'style (pack "color:" (caddr L)))
               (cadr L) ) )
         (with '*DrawMes
            (cons (: col 1) (: col -2)) ) )
      (do 6
         (<row> (alternating)
            (gui 1 '(+Checkbox))
            (gui 2 '(+Checkbox))
            (gui 3 '(+Checkbox))
            (gui 4 '(+Checkbox))
            (gui 5 '(+Checkbox))
            (gui 6 '(+Checkbox))
            (gui 7 '(+Checkbox))
            (gui 8 '(+Checkbox))
            (gui 9 '(+Checkbox))
            (gui 10 '(+Checkbox))
            (gui 11 '(+Checkbox))
            (gui 12 '(+Checkbox))
            (gui 13 '(+Checkbox))
            (gui 14 '(+Checkbox))
            (gui 15 '(+Checkbox))
            (gui 16 '(+Checkbox))
            (gui 17 '(+Rid +Able +Tiny +Button) '(curr) "Anzeigen"
               '(let (F (cons (curr 1) T (curr -1))  C (get '*DrawMes 'col))
                  (out (tmp "gp.csv")
                     (for L (: home obj lst)
                        (prinl (glue "^I" L)) ) )
                  (gnuplot 'png 1200 600 F C)
                  (call 'mv (tmp "gp.png") (tmp "full.png"))
                  (gnuplot 'png 800 300 F C) ) )
            (gui 18 '(+DelRowButton))
            (gui 19 '(+BubbleButton)) ) ) )
   (scroll 6 T)

and finally the display in the GUI:

   (gui '(+Upd +Img)
      '(let F (tmp "gp.png")
         (and (info F) F) )
      "Grafik"
      '(let F (tmp "full.png")
         (and (info F) (pack "+" F)) ) )
   (--)
   "(Für eine vergrößerte Ansicht in einem neuen Tab bitte auf die Grafik 
klicken)" ) )

Hope this helps
♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to