コード例 #1
0
ファイル: examples.py プロジェクト: rosickey/PyHighcharts
def area_example():
    """ Basic Area Exampls """
    chart = Highchart()
    data = [i**2 for i in range(10)]
    chart.title("Area Example")
    chart.add_data_set(data, series_type="area", name="Area")
    chart.set_options(EXAMPLE_CONFIG)
    chart.show()
コード例 #2
0
ファイル: examples.py プロジェクト: rosickey/PyHighcharts
def spline_example():
    """ Basic Spline Example """
    chart = Highchart()
    data = [math.sin(x/100.0) \
        for x in range(0, int(4*math.pi*100), int(math.pi/16*100))]
    chart.title("Sin Spline")
    chart.add_data_set(data, series_type="spline", name="Sin",)
    chart.set_options(EXAMPLE_CONFIG)
    chart.show()
コード例 #3
0
ファイル: examples.py プロジェクト: rosickey/PyHighcharts
def multiple_example():
    """ Basic Multiple Exampls """
    chart = Highchart()
    revenue = [random.randint(1000, 7000) for i in range(24)]
    spend = [random.randint(2000, 4000) for i in range(24)]
    profit = [r - spend[i] for i, r in enumerate(revenue)]
    cumulative_profit = [sum(profit[:i])+5000 for i in range(len(profit))]
    chart.title("Multiple Example")
    chart.add_data_set(revenue, series_type="line", name="Revenue", index=2)
    chart.add_data_set(spend, series_type="line", name="Spend", index=3)
    chart.add_data_set(cumulative_profit, 
        series_type="area", 
        name="Balance",
        index=1)
    chart.set_options(EXAMPLE_CONFIG)
    chart.show()
コード例 #4
0
ファイル: examples.py プロジェクト: rosickey/PyHighcharts
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()
コード例 #5
0
ファイル: mood.py プロジェクト: jmontalvo15/ImpressionTracker
	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)