Ejemplo n.º 1
0
def pie_example():
    """ Basic Piechart Example """
    chart = Highchart()
    chart.title("Pac Man Highchart")
    chart.add_data_set([["Does Not Resemble Pac Man", 25],
        ["Resembes Pac Man", 75]],
        series_type="pie",
        name="",
        startAngle=45)
    chart.colors(["#99CCFF", "#FFFF66"])
    chart.set_options(EXAMPLE_CONFIG)
    chart.show()
Ejemplo n.º 2
0
	def graph(self,companyname,filename):
		chart = Highchart()
		chart.title(companyname)

		# Create Tweet Count Y-Axis
		Y1 = yAxisOptions(title_text='Tweet Count', 
		opposite=True, 
		gridLineColor=self.colors['Grid Line'], 
		labels_style={"color":self.colors['Purple'],"fontSize":20},
		lineColor=self.colors['Grid Line'], 
		minorGridLineColor=self.colors['Minor Grid Line'],
		tickColor=self.colors['Grid Line'],
		tickWidth=1,
		title_style={"color":self.colors['Purple']}
		)

		# Create Mood Score Y-Axis
		Y2 = yAxisOptions(title_text='Mood Score',
		gridLineColor=self.colors['Grid Line'], 
		labels_style={"color":self.colors['Blue'],"fontSize":20},
		lineColor=self.colors['Grid Line'], 
		minorGridLineColor=self.colors['Minor Grid Line'],
		tickColor=self.colors['Grid Line'],
		tickWidth=1,
		title_style={"color":self.colors['Blue']}
		)

		# Add bar graph
		chart.add_data_set(self.moodbin['good'], series_type="column", name="Good", index=1)
		chart.add_data_set(self.moodbin['bad'], series_type="column", name="Bad", index=1)
		chart.add_data_set(self.moodbin['neutral'], series_type="column", name="Neutral", index=1)

		# Add raw mood score and tweet count lines
		chart.add_data_set(self.moodarray, series_type="line", name=companyname+" net mood", index=1, 
				   lineWidth=4, marker={"lineColor":self.colors['White'],"radius":4,"lineWidth":1}, yAxis=1)
		chart.add_data_set(self.countarray, series_type="line", name=companyname+" tweet count", index=2)
		
		chart.colors([self.colors['Green'],self.colors['Red'],self.colors['Yellow'],self.colors['Blue'],self.colors['Purple']])
		chart.set_start_date(self.START_TIME)
		chart.set_interval(1000 * self.interval)
		chart.set_yAxis(Y1,Y2)
		chart.set_options(self.EXAMPLE_CONFIG)
		chart.show(filename)