当前位置: 首页>>代码示例>>Python>>正文


Python SimpleLineChart.download方法代码示例

本文整理汇总了Python中pygooglechart.SimpleLineChart.download方法的典型用法代码示例。如果您正苦于以下问题:Python SimpleLineChart.download方法的具体用法?Python SimpleLineChart.download怎么用?Python SimpleLineChart.download使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pygooglechart.SimpleLineChart的用法示例。


在下文中一共展示了SimpleLineChart.download方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: enterprises_graph

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import download [as 别名]
def enterprises_graph(num_days=14):
	chart_name="enterprises.png"
	# its a beautiful day
	today = datetime.today().date()

	# step for x axis
	step = timedelta(days=1)

	# empties to fill up with data
	counts = []
	dates = []

	# only get last two weeks of entries 
	day_range = timedelta(days=num_days)
	entries = Enterprise.objects.filter(
			created_at__gt=(today	- day_range))
	
	# count entries per day
	for day in range(num_days):
		count = 0
		d = today - (step * day)
		for e in entries:
			if e.created_at.day == d.day:
				count += 1
		dates.append(d.day)
		counts.append(count)
    
    	line = SimpleLineChart(440, 100, y_range=(0, 100))
	line.add_data(counts)
	line.set_axis_labels(Axis.BOTTOM, dates)
	line.set_axis_labels(Axis.BOTTOM, ['','Date', ''])
	line.set_axis_labels(Axis.LEFT, ['', 5, 10])
	line.set_colours(['0091C7'])
	line.download('apps/shabaa/static/graphs/' + chart_name)
	return chart_name
开发者ID:mclabs,项目名称:rapidsms,代码行数:37,代码来源:views.py

示例2: __init__

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import download [as 别名]
class DiceChart:
    chart = None

    def __init__(self, data, iter=0, width=300, height=300):
        self.chart = SimpleLineChart(width, height, y_range=(0, 10))
        legend = []
        colors = ["cc0000", "00cc00", "0000cc", "990000", "009900", "000099", "0099ff", "FF9900", "9900ff", "ff0099"]
        title = "die rolls per objective"
        if iter > 0:
            title = title + " (%s samples)" % iter
        for i in data.keys():
            self.chart.add_data(data[i])
            legend.append(str(i))

        logging.debug(legend)
        logging.debug(colors)
        self.chart.set_colours(colors)
        self.chart.set_legend(legend)

        grid_x_amount = 100 / (len(data[i]) - 1)
        self.chart.set_grid(grid_x_amount, 10, 5, 5)

        left_axis = range(0, 11, 1)
        left_axis[0] = ""
        self.chart.set_axis_labels(Axis.LEFT, left_axis)

        bottom_len = len(data[i]) + 2
        bottom_axis = range(2, bottom_len, 1)
        self.chart.set_axis_labels(Axis.BOTTOM, bottom_axis)

        self.chart.set_title(title)

    def download(self, name="dicechart.png"):
        self.chart.download(name)
开发者ID:winks,项目名称:dicebreaker,代码行数:36,代码来源:dicechart.py

示例3: RenderGoogleChart

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import download [as 别名]
def RenderGoogleChart(data, filename):    
    """
    create a GoogleChart from decoded data under filename (.png)
    """
    print "Rendering GoogleChart [%s]" % filename
    # Retrieve chart data
    elements=[]
    max_y = 0
    min_y = 9999
    for i in range(len(data["time"])):
        if data["cps"][i] > max_y: max_y = data["cps"][i]
        if data["cps"][i] < min_y: min_y = data["cps"][i]
        elements.append(data["cps"][i])

    # Chart size of 600x375 pixels and specifying the range for the Y axis
    chart = SimpleLineChart(600, 375, y_range=[min_y-0.1, max_y+0.1])
    
    # Add the chart data
    chart.add_data(elements)
    
    # Set the line colour to blue
    chart.set_colours(['0000FF'])

    # Set the vertical stripes
    chart.fill_linear_stripes(Chart.CHART, 0, 'CCCCCC', 0.2, 'FFFFFF', 0.2)

    # Set the horizontal dotted lines
    chart.set_grid(0, 25, 5, 5)

    # Define the Y axis labels
    left_axis = [x * 0.1 for x in range(0, int(max_y/0.1))]
    left_axis[0] = 'CPS'
    chart.set_axis_labels(Axis.LEFT, left_axis)

    chart.download(filename)
开发者ID:bidouilles,项目名称:gammascout-decoder,代码行数:37,代码来源:GammaScoutDecode.py

示例4: graph_entries

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import download [as 别名]
def graph_entries(num_days=14):
	# its a beautiful day
	today = datetime.today().date()

	# step for x axis
	step = timedelta(days=1)

	# empties to fill up with data
	counts = []
	dates = []

	# only get last two weeks of entries 
	day_range = timedelta(days=num_days)
	entries = Entry.objects.filter(
			time__gt=(today	- day_range))
	
	# count entries per day
	for day in range(num_days):
		count = 0
		d = today - (step * day)
		for e in entries:
			if e.time.day == d.day:
				count += 1
		dates.append(d.day)
		counts.append(count)
    
    	line = SimpleLineChart(440, 100, y_range=(0, 100))
	line.add_data(counts)
	line.set_axis_labels(Axis.BOTTOM, dates)
	line.set_axis_labels(Axis.BOTTOM, ['','Date', ''])
	line.set_axis_labels(Axis.LEFT, ['', 50, 100])
	line.set_colours(['0091C7'])
	line.download('webui/graphs/entries.png')
	
	return 'saved entries.png' 
开发者ID:adammck,项目名称:plumpynut,代码行数:37,代码来源:views.py

示例5: get_chart_image

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import download [as 别名]
    def get_chart_image(self, data, **kw):
        """Return a image file path

        Arguments::

            data -- a list containing the X,Y data representation
        """
        from pygooglechart import SimpleLineChart, Axis

        # Set the vertical range from 0 to 100
        try:
            max_y = max(data['y'])
            min_y = min(data['y'])
        except:
            min_y = 0
            max_y = 100
        width = int(kw.get('width', 600))
        height = int(kw.get('height', 250))
        # Chart size of widthxheight pixels and specifying the range for the Y axis
        chart = SimpleLineChart(width, height, y_range=[0, max_y])

        # Add the chart data
        chart.add_data(data['y'])

        # Set the line colour to blue
        chart.set_colours(['0000FF'])

        try:
            step_x = int(100/(len(data['x'])-1))
        except:
            step_x = 0
        chart.set_grid(step_x, 10, 5, 5)

        # The Y axis labels contains min_y to max_y spling it into 10 equal parts,
        #but remove the first number because it's obvious and gets in the way
        #of the first X label.
        left_axis = [utils.intcomma(x) for x in range(0, max_y + 1, (max_y)/10)]
        left_axis[0] = ''
        chart.set_axis_labels(Axis.LEFT, left_axis)

        # X axis labels
        chart.set_axis_labels(Axis.BOTTOM, data['x'])

        #Generate an hash from arguments
        kw_hash = hash(tuple(sorted(kw.items())))
        data_hash = hash(tuple(sorted([(k, tuple(v))
            for k, v in data.iteritems()])))
        args_hash = str(kw_hash) + str(data_hash)

        image_path = os.path.join(TARGET_DIR, "%s.png" % args_hash)

        if bool(kw.get('refresh', False)) or args_hash not in self.charts:
            #Get image from google chart api
            chart.download(image_path)
            if args_hash not in self.charts:
                self.charts.append(args_hash)
            self._p_changed = True

        return image_path
开发者ID:eaudeweb,项目名称:naaya.Products.CountryProfile,代码行数:61,代码来源:CountryProfile.py

示例6: simple_random

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import download [as 别名]
def simple_random():
    chart = SimpleLineChart(300, 100, y_range=(0, 100))
    max_y = 100
    list_data = [10, 90, 80, 10, 10, 20, 30, 20, 15, 45, 56, 42, 92]
    chart.add_data(list_data)
    chart.add_data(reversed(list_data))
    chart.set_axis_labels(Axis.LEFT, ['', max_y / 2, max_y])
    chart.set_axis_labels(Axis.BOTTOM, ['Sep', 'Oct', 'Nov', 'Dec'])
    chart.download('line-simple-random.png')
开发者ID:vilts,项目名称:EMHI-temperature,代码行数:11,代码来源:emhi.py

示例7: simple_line

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import download [as 别名]
def simple_line():
    chart = SimpleLineChart(settings.width, settings.height,
                                      x_range=(0, 35))
    chart.set_colours(['00ff00', 'ff0000','ACff0C','B0ffE0','C0ffFF'])
    chart.add_data([1,2,3,4,5])
    chart.add_data([1,4,9,16,25])
    chart.set_title('This is title')
    chart.set_axis_labels('r', 'str')
    chart.set_legend( ['a','b','c','d','e'])
    chart.download('simple-line.png')
开发者ID:iqmaker,项目名称:smalltools,代码行数:12,代码来源:bar.py

示例8: many_labels

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import download [as 别名]
def many_labels():
    chart = SimpleLineChart(settings.width, settings.height)

    for a in xrange(3):
        for axis_type in (Axis.LEFT, Axis.RIGHT, Axis.BOTTOM):
            index = chart.set_axis_range(axis_type, 0, random.random() * 100)
            chart.set_axis_style(index, colour=helper.random_colour(), \
                font_size=random.random() * 10 + 5)

    chart.add_data(helper.random_data())
    chart.download('label-many.png')
开发者ID:Ashwini7,项目名称:La-resumex,代码行数:13,代码来源:labels.py

示例9: lineGraphFeed

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import download [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)
开发者ID:daneroo,项目名称:im-ted1k,代码行数:56,代码来源:getFeed.py

示例10: plotter

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import download [as 别名]
def plotter(fund):
    
    (dates, values) = dataparser("data/%s" % fund)
    left_axis = [int(min(values)), int(max(values) + 1)]
    
    chart = SimpleLineChart(600, 375, y_range=[min(values), max(values) + 1])
    chart.add_data(values)
    chart.add_data([0] * 2)
    chart.set_colours(['76A4FB'] * 5)
    chart.add_fill_range('76A4FB', 0, 1)
    chart.set_grid(0, 5, 1, 25)
    chart.set_axis_labels(Axis.LEFT, left_axis)
    chart.set_axis_labels(Axis.BOTTOM, dates)

    chart.download("charts/%s.png" % fund)
开发者ID:krihal,项目名称:pygchart,代码行数:17,代码来源:pygchart.py

示例11: makechart

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import download [as 别名]
def makechart(aaseq, regions):
    hdph = dict()
    hdph['d'] = -3.5
    hdph['e'] = -3.5
    hdph['k'] = -3.9
    hdph['r'] = -4.5
    hdph['h'] = -3.2
    hdph['y'] = -1.3
    hdph['w'] = -0.9
    hdph['f'] = 2.8
    hdph['c'] = 2.5
    hdph['m'] = 1.9
    hdph['s'] = -0.8
    hdph['t'] = -0.7
    hdph['n'] = -3.5
    hdph['q'] = -3.5
    hdph['g'] = -0.4
    hdph['a'] = 1.8
    hdph['v'] = 4.2
    hdph['l'] = 3.8
    hdph['i'] = 4.5
    hdph['p'] = -1.6
    hdphseq = []
    for i in range(len(aaseq)):
        hdphseq.append(hdph[aaseq[i]])
    
    regionseq = parseregion(regions)
    
    #print regionseq

    min_y = -5
    max_y = 5
    chart = SimpleLineChart(800, 300, y_range=[min_y, max_y])
    
    #chart.add_data([max_y]*2)
    chart.add_data(hdphseq)   
    chart.add_data(regionseq)
    chart.add_data([min_y]*2)
    chart.set_colours(['76A4FB', 'ADFF2F', '000000'])
    chart.add_fill_range('ADFF2F', 1, 2)
    chart.set_axis_labels(Axis.LEFT, [min_y, '', max_y])
    chart.set_axis_labels(Axis.BOTTOM, aaseq)
    
    chart.download('test.png')
    
    #print hdphseq
    return hdphseq
开发者ID:pconerly,项目名称:internet-programming-assignments,代码行数:49,代码来源:betasheetseq.py

示例12: stripes

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import download [as 别名]
def stripes():
    
    # Set the vertical range from 0 to 100
    max_y = 100

    # Chart size of 200x125 pixels and specifying the range for the Y axis
    chart = SimpleLineChart(600, 500, y_range=[0, max_y])

    # Add the chart data
    # data = [
    #     32, 34, 34, 32, 34, 34, 32, 32, 32, 34, 34, 32, 29, 29, 34, 34, 34, 37,
    #     37, 39, 42, 47, 50, 54, 57, 60, 60, 60, 60, 60, 60, 60, 62, 62, 60, 55,
    #     55, 52, 47, 44, 44, 40, 40, 37, 34, 34, 32, 32, 32, 31, 32
    # ]
    # data2 = [
    #     55, 52, 47, 44, 44, 40, 40, 37, 34, 34, 32, 32, 32, 31, 32, 62, 60, 55,
    #     32, 34, 34, 32, 34, 34, 32, 32, 32, 34, 34, 32, 29, 29, 34, 34, 34, 37,        
    #     37, 39, 42, 47, 50, 54, 57, 60, 60, 60, 60, 60, 60, 60, 62
    # ] 
    data = xrange(0, 100, 20)
    data2 = [0, 20, 20, 40, 40, 80, 80, 100, 100]
    chart.add_data(data)
    chart.add_data(data2)
    
    # Set the line colour to blue
    chart.set_colours(['0000FF','00CC00'])

    # Set the vertical stripes
    chart.fill_linear_stripes(Chart.CHART, 0, 'CCCCCC', 0.2, 'FFFFFF', 0.2)

    # Set the horizontal dotted lines
    chart.set_grid(0, 25, 5, 5)

    # The Y axis labels contains 0 to 100 skipping every 25, but remove the
    # first number because it's obvious and gets in the way of the first X
    # label.
    left_axis = range(0, max_y + 1, 25)
    left_axis[0] = ''
    chart.set_axis_labels(Axis.LEFT, left_axis)

    # X axis labels
    chart.set_axis_labels(Axis.BOTTOM, \
        ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'])

    chart.download('line-stripes.png')
开发者ID:cyberyoung,项目名称:sentry,代码行数:47,代码来源:pchart.py

示例13: printGoogleCharts

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import download [as 别名]
    def printGoogleCharts(X, Y, title, min_y, max_y, output):

        # Create a chart object of 750x400 pixels
        chart = SimpleLineChart(750, 400)

        # Add some data
        chart.add_data(Y)

        # Assign the labels to the pie data
#        chart.set_axis_labels(Axis.BOTTOM, X)
        chart.set_axis_labels(Axis.LEFT, range(int(min_y)-1, int(max_y)+1, 5))
        chart.set_title(title)

        # Print the chart URL
        print chart.get_url()

        # Download the chart
        chart.download(output+".png")
开发者ID:MihaiTabara,项目名称:CPU_scheduling,代码行数:20,代码来源:util.py

示例14: linechart

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import download [as 别名]
def linechart(name, dataset, size=(400,400)):
    max_y = maxy(dataset)
    chart = SimpleLineChart(size[0], size[1], y_range=[0, max_y])
    legend = []
    for series_name, s in dataset:
        chart.add_data([y for x, y in s])
        legend.append(series_name)
    
    chart.set_colours(['057D9F', '8106A9', 'E9FB00', 'FF8100'])
    chart.set_legend(legend)
    chart.set_grid(0, 25, 5, 5)
    
    left_axis = range(0, int(max_y + 1), 25)
    left_axis[0] = ''
    chart.set_axis_labels(Axis.LEFT, left_axis)
    
    bottom_axis = [x for x, y in dataset[0][1]]
    chart.set_axis_labels(Axis.BOTTOM, bottom_axis)
    chart.download(name)
开发者ID:amitection,项目名称:hacks,代码行数:21,代码来源:goochart.py

示例15: generateGraph

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import download [as 别名]
def generateGraph(fMesureGlobalPerCent, nbComparison, resPath):
    max_y = 100#Fmesure à 100%
    chart = SimpleLineChart(500, 500, y_range=[0, max_y])
    chart.add_data(fMesureGlobalPerCent)
    chart.set_colours(['0000FF'])
    chart.fill_linear_stripes(Chart.CHART, 0, 'CCCCCC', 0.2, 'FFFFFF', 0.2)
    chart.set_grid(0, 25, 5, 5)
   
    left_axis = range(0, max_y + 1, 25)
    left_axis[0] = ''
    chart.set_axis_labels(Axis.LEFT, left_axis)


    y_axis = []
    for x in range(nbComparison):
        if x%5 == 0:
            y_axis.append(x)
    chart.set_axis_labels(Axis.BOTTOM, y_axis)
    chart.download(resPath)
开发者ID:SamirBoulil,项目名称:pred_experimentation,代码行数:21,代码来源:compare.py


注:本文中的pygooglechart.SimpleLineChart.download方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。