def _get_definitionlookups_bar(datas, width, height, background_color=None, colour=None): max_ = max(max(v[1]) for v in datas) chart = StackedHorizontalBarChart(width, height, x_range=(0, max_ + int(.1*max_))) chart.add_data([x[1][0] for x in datas]) chart.add_data([x[1][1] for x in datas]) # 222 labels = [x[0].encode('utf8') for x in datas][::-1] # 223 import urllib #print [urllib.quote(str(a)) for a in labels] #print list(labels) chart.set_axis_labels(pygooglechart.Axis.LEFT, labels) chart.set_legend(['Looked up','Not looked up']) chart.set_colours(['ff9900','ffebcc']) chart.add_marker(0, '', 'N*f1*%', '000000', 10) if background_color: chart.fill_solid(chart.BACKGROUND, background_color) if colour: chart.set_colours([colour]) return chart.get_url()
def main(argv): nTraducidas = int(argv[0]) nFuzzy = int(argv[1]) nNoTraducidas = int(argv[2]) totalCadenas = nTraducidas + nFuzzy + nNoTraducidas pTraducidas = (nTraducidas * 100) / totalCadenas pNoTraducidas = 100 - pTraducidas #print '% traducidos: ' + str(pTraducidas) + ' - % No Traducidos: ' + str(pNoTraducidas) chart = StackedHorizontalBarChart(settings.width, settings.height, x_range=(0, 100)) # chart.set_bar_width(100) chart.set_colours(['00ff00', 'ff0000']) chart.fill_solid('bg', 'e3d185') chart.set_zero_line(0, 0) chart.add_data([pTraducidas]) chart.add_data([pNoTraducidas]) chart.download(argv[3])