@@ -155,8 +155,7 @@ def __init__(self, height, width, fill):
155155
156156class SVG_HeaderBlock :
157157 @staticmethod
158- def build (height , width , label , variant = 'text' , t1text = None , t1size = None , t2text = None , t2size = None , colors = [],
159- values = (0 ,100 )):
158+ def build (height , width , label , variant = 'text' , t1text = None , t1size = None , t2text = None , t2size = None , colors = []):
160159 """
161160 Build a single SVG Header Block object
162161
@@ -168,8 +167,7 @@ def build(height, width, label, variant='text', t1text=None, t1size=None, t2text
168167 :param t1size: upper text size
169168 :param t2text: lower text
170169 :param t2size: lower text size
171- :param colors: colors for the graphic variant
172- :param values: values for the graphic variant's gradient
170+ :param colors: array of tuple (color, score value) for the graphic variant
173171 :return:
174172 """
175173 g = G (ty = 5 )
@@ -215,19 +213,16 @@ def build(height, width, label, variant='text', t1text=None, t1size=None, t2text
215213 cells = G (ctype = "legendCells" )
216214 sub2 .append (cells )
217215 offset = 0
218- span = [values [0 ]]
219- for blah in colors [:- 1 ]:
220- span .append (int (values [1 ]/ (len (colors )- 1 ) * (colors .index (blah ) + 1 )))
221216 for entry in colors :
222217 cell = G (ctype = "cell" , tx = offset )
223- conv = entry
218+ conv = entry [ 0 ]
224219 if conv .startswith ('#' ):
225220 conv = conv [1 :]
226221 block = Swatch (15 , block_width , tuple (int (conv [i :i + 2 ], 16 ) for i in (0 , 2 , 4 )))
227222 offset += block_width
228223 cell .append (block )
229224 cells .append (cell )
230- tblob = str (span [ colors . index ( entry ) ])
225+ tblob = str (entry [ 1 ])
231226 off = (block_width - (5 * (1 + len (tblob ))))/ 2
232227 label = Text (tblob , 12 , ctype = 'label' , ty = 25 , tx = off )
233228 cell .append (label )
0 commit comments