Exemple #1
0
 def vars(self, req, data):
     # Sets up the variables for the google charts used in the
     # template
     v = {}
     # 440x220 is the max size
     us_map = MapChart(440, 220)
     us_map.geo_area = 'usa'
     items = data.states.counts()
     us_map.set_codes([state for count, state in items])
     us_map.add_data([count for count, state in items])
     us_map.set_colours(('EEEEEE', '0000FF', '000033'))
     v['us_map_url'] = us_map.get_url()
     country_map = MapChart(440, 220)
     items = data.countries.counts()
     country_map.set_codes([country_code for count, (country_name, country_code) in items])
     country_map.add_data([count for count, (country_name, country_code) in items])
     country_map.set_colours(('EEEEEE', '9999FF', '000033'))
     v['country_map_url'] = country_map.get_url()
     return v
Exemple #2
0
    for k in data_dict.keys():
        for a in acc:
            if a.isocode == k:
                name = 'f%s:+%2.1f' % (a.acronym, a.I)

                if a.offset:
                    chart.add_marker(0, counter, name, '000000', 10,
                                     a.priority, a.offset)
                else:
                    chart.add_marker(0, counter, name, '000000', 10,
                                     a.priority)

                counter = counter + 1
                break

    # european chart
    #chart.add_marker(0,1,'fTest+2','000000',10)
    c1 = chart.get_url()

    chart.zoom = '30,-10,60,45'

    c2 = chart.get_url()

    fout = open('index.html', 'w')

    fout.write(
        '<HEAD><meta http-equiv="refresh" content="300"><BODY><center><img src="%s" border=1 /><p><img src="%s" border=1 /></center><p>%s</BODY></HEAD>'
        % (c1, c2, problems))

    fout.close()
	chart.set_codes(data_dict.keys())
	chart.zoom = '-60,-20,80,-35'

	counter = 0	
	for k in data_dict.keys():	
		for a in acc:
			if a.isocode == k:
				name = 'f%s:+%2.1f'%(a.acronym,a.I)

				if a.offset:
					chart.add_marker(0,counter,name,'000000',10,a.priority,a.offset)
				else:
					chart.add_marker(0,counter,name,'000000',10,a.priority)
						
				counter = counter + 1
				break	

	# european chart
	#chart.add_marker(0,1,'fTest+2','000000',10)
	c1 = chart.get_url()

	chart.zoom = '30,-10,60,45'

	c2 = chart.get_url()

	fout = open('index.html','w')

	fout.write('<HEAD><meta http-equiv="refresh" content="300"><BODY><center><img src="%s" border=1 /><p><img src="%s" border=1 /></center><p>%s</BODY></HEAD>'%(c1,c2,problems))

	fout.close()