|
|
|
@ -25,6 +25,7 @@ from __future__ import division
|
|
|
|
|
import io |
|
|
|
|
import os |
|
|
|
|
import json |
|
|
|
|
from datetime import date |
|
|
|
|
from lxml import etree |
|
|
|
|
from math import cos, sin, pi |
|
|
|
|
from urlparse import urlparse |
|
|
|
@ -40,19 +41,16 @@ class Svg(object):
|
|
|
|
|
self.graph = graph |
|
|
|
|
self.processing_instructions = [ |
|
|
|
|
etree.PI(u'xml', u"version='1.0' encoding='utf-8'")] |
|
|
|
|
self.root = None |
|
|
|
|
self.defs = None |
|
|
|
|
|
|
|
|
|
def reinit(self): |
|
|
|
|
"""(Re-)initialization""" |
|
|
|
|
self.root = etree.Element( |
|
|
|
|
"{%s}svg" % self.ns, |
|
|
|
|
nsmap={ |
|
|
|
|
None: self.ns, |
|
|
|
|
'xlink': 'http://www.w3.org/1999/xlink', |
|
|
|
|
}) |
|
|
|
|
self.root.append(etree.Comment( |
|
|
|
|
u'Generated with pygal %s ©Kozea 2012' % __version__)) |
|
|
|
|
self.root.append( |
|
|
|
|
etree.Comment(u'Generated with pygal %s ©Kozea 2012 on %s' % ( |
|
|
|
|
__version__, date.today().isoformat()))) |
|
|
|
|
self.root.append(etree.Comment(u'http://pygal.org')) |
|
|
|
|
self.root.append(etree.Comment(u'http://github.com/Kozea/pygal')) |
|
|
|
|
self.defs = self.node(tag='defs') |
|
|
|
|
|
|
|
|
@ -135,7 +133,8 @@ class Svg(object):
|
|
|
|
|
self.node(node, 'path', |
|
|
|
|
d=root % (origin, line), **kwargs) |
|
|
|
|
|
|
|
|
|
def slice(self, serie_node, node, radius, small_radius, |
|
|
|
|
def slice( |
|
|
|
|
self, serie_node, node, radius, small_radius, |
|
|
|
|
angle, start_angle, center, val): |
|
|
|
|
"""Draw a pie slice""" |
|
|
|
|
project = lambda rho, alpha: ( |
|
|
|
|