Browse Source

Use real classes for bar styling

pull/8/head
Florian Mounier 13 years ago
parent
commit
b1f21bb03e
  1. 63
      pygal/bar.css
  2. 2
      pygal/bar.py
  3. 21
      pygal/graph.py
  4. 4
      pygal/pie.css

63
pygal/bar.css

@ -1,83 +1,58 @@
/*
$Id$
default fill styles for multiple datasets (probably only use a single
dataset on this graph though)
*/
.key1,.fill1{
fill: #ff0000;
.key, .fill {
fill-opacity: 0.5;
stroke: none;
stroke-width: 0.5;
stroke-width: 1px;
}
.key1,.fill1:hover{
.fill:hover{
fill-opacity: 0.25;
-webkit-transition: 250ms;
}
.key1,.fill1{
fill: #ff0000;
}
.key2,.fill2{
fill: #0000ff;
fill-opacity: 0.5;
stroke: none;
stroke-width: 1px;
}
.key3,.fill3{
fill: #00ff00;
fill-opacity: 0.5;
stroke: none;
stroke-width: 1px;
}
.key4,.fill4{
fill: #ffcc00;
fill-opacity: 0.5;
stroke: none;
stroke-width: 1px;
}
.key5,.fill5{
fill: #00ccff;
fill-opacity: 0.5;
stroke: none;
stroke-width: 1px;
}
.key6,.fill6{
fill: #ff00ff;
fill-opacity: 0.5;
stroke: none;
stroke-width: 1px;
}
.key7,.fill7{
fill: #00ffff;
fill-opacity: 0.5;
stroke: none;
stroke-width: 1px;
}
.key8,.fill8{
fill: #ffff00;
fill-opacity: 0.5;
stroke: none;
stroke-width: 1px;
}
.key9,.fill9{
fill: #cc6666;
fill-opacity: 0.5;
stroke: none;
stroke-width: 1px;
}
.key10,.fill10{
fill: #663399;
fill-opacity: 0.5;
stroke: none;
stroke-width: 1px;
}
.key11,.fill11{
fill: #339900;
fill-opacity: 0.5;
stroke: none;
stroke-width: 1px;
}
.key12,.fill12{
fill: #9966FF;
fill-opacity: 0.5;
stroke: none;
stroke-width: 1px;
}

2
pygal/bar.py

@ -190,7 +190,7 @@ class VerticalBar(Bar):
'y': str(top),
'width': str(bar_width),
'height': str(length),
'class': 'fill%s' % (dataset_count + 1),
'class': 'fill fill%s' % (dataset_count + 1),
})
self.make_datapoint_text(

21
pygal/graph.py

@ -51,8 +51,8 @@ class Graph(object):
* pygal.time_series
"""
width = 500
height = 300
width = 1000
height = 500
show_x_guidelines = False
show_y_guidelines = True
show_data_values = True
@ -575,7 +575,7 @@ class Graph(object):
'y': str(y_offset),
'width': str(self.KEY_BOX_SIZE),
'height': str(self.KEY_BOX_SIZE),
'class': 'key%s' % (key_count + 1),
'class': 'key key%s' % (key_count + 1),
})
text = etree.SubElement(group, 'text', {
'x': str(self.KEY_BOX_SIZE + 5),
@ -644,14 +644,14 @@ class Graph(object):
NSMAP = {
None: SVG_NAMESPACE,
'xlink': 'http://www.w3.org/1999/xlink',
'a3': 'http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/',
# 'a3': 'http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/',
}
self.root = etree.Element(SVG + "svg", attrib={
'width': str(self.width),
'height': str(self.height),
'viewBox': '0 0 %s %s' % (self.width, self.height),
'{http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/}'
'scriptImplementation': 'Adobe',
'viewBox': '0 0 100% 100%',
# '{http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/}'
# 'scriptImplementation': 'Adobe',
}, nsmap=NSMAP)
if hasattr(self, 'style_sheet_href'):
pi = etree.ProcessingInstruction(
@ -661,11 +661,8 @@ class Graph(object):
self.root.addprevious(pi)
comment_strings = (
' Created with SVG.Graph ',
' SVG.Graph by Jason R. Coombs ',
' Based on SVG::Graph by Sean E. Russel ',
' Based on Perl SVG:TT:Graph by Leo Lapworth & Stephan Morgan ',
' ' + '/' * 66,
u'Generatel with pygal ©Kozea 2011',
' Based upon SVG.Graph by Jason R. Coombs ',
)
map(self.root.append, map(etree.Comment, comment_strings))

4
pygal/pie.css

@ -1,7 +1,3 @@
/*
$Id$
*/
.dataPointLabel{
fill: #000000;
text-anchor:middle;

Loading…
Cancel
Save