本文整理汇总了Python中pygooglechart.SimpleLineChart.fill_linear_gradient方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleLineChart.fill_linear_gradient方法的具体用法?Python SimpleLineChart.fill_linear_gradient怎么用?Python SimpleLineChart.fill_linear_gradient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pygooglechart.SimpleLineChart
的用法示例。
在下文中一共展示了SimpleLineChart.fill_linear_gradient方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: lineGraphFeed
# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import fill_linear_gradient [as 别名]
def lineGraphFeed(feed):
name = feed.getAttribute("name")
observations = feed.getElementsByTagName("observation")
print " Feed %s has %d observations" % (name,len(observations))
data = []
for obs in observations:
value = int(obs.getAttribute("value"))
#print " val:%s (%s)" % (value, type(value))
data.insert(0,value/10)
#data.reverse # remeber the feed is reversed
print "Max Data: %s" % max(data)
max_y = int(math.ceil(max(data)/100.0))*100
print "Max_y : %s" % max_y
chart = SimpleLineChart(180, 120, y_range=[0, max_y])
chart.add_data(data)
lftAxisMax = max_y/100;
print "lftAxisMax %s"%lftAxisMax
#left_axis = range(0, lftAxisMax,(lftAxisMax/4.0))
left_axis = []
right_axis = []
for i in range(0,4+1):
kw = (i*lftAxisMax/4.0)
left_axis.append(kw)
right_axis.append(kw*24)
left_axis[0] = 'kW' # remove the first label
right_axis[0] = 'kWh/d' # remove the first label
chart.set_axis_labels(Axis.LEFT, left_axis)
#chart.set_axis_labels(Axis.RIGHT, right_axis)
chart.set_title(name)
# facebook colors
chart.set_title_style('7f93bc',16)
#chart.set_colours(['7f93bc'])
chart.set_colours(['3b5998']) #darker blue
#Colors
colors=False
if (colors):
# Set the line colour to ...
chart.set_colours(['FFFFFF'])
# 0 here is the axis index ? 0 works for now
chart.set_title_style('FFFFFF',16)
chart.set_axis_style(0,'FFFFFF')
chart.set_axis_style(1,'FFFFFF')
chart.fill_linear_gradient(Chart.BACKGROUND,90,'000000',0.9,'007700',0.1)
print chart.get_url()
chart.download('%s-line.png'%name)