Short description
This is rather a brainstorming page about how we could use svgfig than a real feature request.
stuff in moin that could use svgfig
- event stats (currently requires outdated gdchart v1)
- maybe a (yet to write) svgfig parser so users can do plots in the wiki
- sstable can be extended for simple graphs
about svgfig
svgfig 1.x is stable and should be used (we can migrate to v2 later when it has been completed and has stabilized). Please use current 1.x SVN version.
We have to be careful with svgfig and not feed it with user data before we reviewed security, there are quite some eval()s in there. So for now, only use it for the stats stuff.
some sample code
Needs SVN version of svgfig.
1 #!/usr/bin/env python2.3
2 # -*- coding: utf-8 -*-
3
4 from svgfig import *
5
6 month_nums = range(1, 13)
7 data = [1, 42, 23, 66, 22, 47, 88, 44, 55, 99, 77, 88, ]
8 ymax = max(data)
9 data = zip(month_nums, data)
10
11 months = [u'Jan', u'Feb', u'Mär', u'Apr', u'Mai', u'Jun', u'Jul', u'Aug', u'Sep', u'Okt', u'Nov', u'Dez', ]
12 months = dict(zip(month_nums, months))
13
14 poly = Poly(data, "lines")
15 f = Frame(1, 12, 0, ymax, poly, xticks=months, xminiticks=False, text_attr={"font-size": 3, })
16
17 svg = f.SVG()
18 svg.firefox()
This svg image is rendered incorrectly on Safari 3.2.1 (Mac OS X 10.5.5). It it rendered correctly in FF3 on WinXP, but not in Opera 9.6.2. No chance for svg on IE (without plugin).
Oliver please show a screendump how it look like, I assume it looks better if one provides a width by EmbedObject. Does this one looks better?
Current configuration does not allow embedding of the file tmp.svg because of its mimetype image/svg+xml.: tmp.svg
For IE users if they weren't able to convince their dealer we may be able to provide server side a png file.
Hi Reimar, attached you can find the screenshots. EmbedObject does a good job with Safari. On Opera, the svg implementation seems to be broken somehow. But see yourself.
Cheers, Oliver.