• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python pygooglechart.SimpleLineChart类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: makeChartOfDay

def makeChartOfDay(data):

    max_user = 150
    chart = SimpleLineChart(400, 325, y_range=[0, max_user])
    dataChart = []
    for ore in range(24):
        ore = str(ore)
        if len(ore) == 1:
            ore = '0'+ore
        try:
            dataChart.append(userList[data]['stats']['online'][ore])
        except:
            dataChart.append(0)
    
    chart.add_data(dataChart)

    chart.set_colours(['0000FF'])

    left_axis = range(0, max_user + 1, 25)
    
    left_axis[0] = ''
    chart.set_axis_labels(Axis.LEFT, left_axis)
    
#    chart.set_axis_labels(Axis.BOTTOM, \
#    ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'])

    chart.set_axis_labels(Axis.BOTTOM, \
    range(0, 24))

    return chart.get_url()
开发者ID:SimoneManduchi,项目名称:forumfreeskin,代码行数:30,代码来源:ffutenza.py


示例2: process

def process (name, date):
    newdate = date[8:10] + "_" + date[5:7] + "_" + date[0:4]
    url = r"http://www.lloydsbankinggroup.com/media/excel/2010/%s_historic_data.xls" % newdate
    print url
    url = r"http://www.lloydsbankinggroup.com/media/excel/2010/04_06_10_historic_data.xls"
    book = xlrd.open_workbook(file_contents=scrape(url))
    sheet = book.sheet_by_name (name)
    months=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']

    data = []
    i = 1
    while i < 500:
        try:
            month = sheet.cell_value (i, 0)
            year  = sheet.cell_value (i, 1)
            level = sheet.cell_value (i, 2)
        except:
            break
        when= "%04d-%02d-01" % (int(year), months.index (month) + 1)
        i = i + 1
        data.append (level)        
        sqlite.save(unique_keys=["Date"], data={"Date":when, "Index":level})

    chart = SimpleLineChart(500, 255, y_range=[0, 700])
    chart.add_data (data)
    metadata.save("chart", chart.get_url())
开发者ID:flyeven,项目名称:scraperwiki-scraper-vault,代码行数:26,代码来源:halifax-hpi.py


示例3: mk_chart

    def mk_chart(self):
        from pygooglechart import SimpleLineChart
        chart =  SimpleLineChart(self.width, self.height, colours=('91CF60', 'FC8D59'))

        all_labels = [d[0] for d in self.cumulative]

        chart.add_data([d[1] for d in self.cumulative])
        chart.add_data([d[1] for d in self.newdata])
        chart.set_axis_labels('y', range(0, self.cmax, (self.cmax / 4)))
        chart.set_axis_labels('x', [all_labels[x] for x in
                                    range(0, len(all_labels), (len(all_labels) / 4))])
        return chart
开发者ID:rosslagerwall,项目名称:bindir,代码行数:12,代码来源:gitaggregates.py


示例4: __init__

    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)
开发者ID:winks,项目名称:dicebreaker,代码行数:28,代码来源:dicechart.py


示例5: taxonLineChart

def taxonLineChart(taxon, site, max_y=None, label_record=None):
    
    min_y = 0
    
    records = taxon.mean_densities.filter(site=site).order_by('year')
    years = [ record.year for record in records ]
    means = [ record.mean for record in records ]
    
    # Set the vertical range from 0 to 100
    max_y = max_y or max(means)
    span = max_y - min_y
    if span == 0:
        max_y = 1
        

    step = pow(10, round(math.log(max_y) / math.log(10)) - 1)
    ticks = frange(min_y, max_y + (step * 1), step)

    chart = SimpleLineChart(300, 100, y_range=[0, max_y])

    # Add the chart data
    chart.add_data(means)

    # Set the line colour to blue
    chart.set_colours(['76A4FB'])
    
    # limit number of ticks to around 4
    n = len(ticks) / 3

    # 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.
    ticks = ticks[::n]
    ticks[0] = ''
    chart.set_axis_labels(Axis.LEFT, ticks)

    # X axis labels
    chart.set_axis_labels(Axis.BOTTOM, years[::4])
    
    url = chart.get_url()
    url.replace('lc', 'ls')
    url += '&chm=B,C3D9FF,0,0,0'
    if label_record:
        url += ('|@a,3366CC,0,%f:%f,4' % (float(years.index(label_record.year)) / float(len(years)), (label_record.mean+(max_y * 0.05))/max_y))
    print url
    return url
开发者ID:underbluewaters,项目名称:pyrifera,代码行数:46,代码来源:__init__.py


示例6: many_labels

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,代码行数:11,代码来源:labels.py


示例7: __init__

 def __init__(self,data):
   x_size=900
   colours=['0000FF']
   y_size=200
   spacer=10
   y_range=[min(data)-spacer, max(data)+spacer]
   left_axis=range(y_range[0],y_range[1],5)
   self.chart=SimpleLineChart(x_size,y_size,y_range=y_range)
   self.chart.set_axis_labels(Axis.LEFT,left_axis)
   self.chart.set_colours(colours)
   self.chart.add_data(data)
开发者ID:carlobifulco,项目名称:Yaic,代码行数:11,代码来源:graph.py


示例8: gchart

def gchart(data, node, check, metric, start=datetime.now()-timedelta(days=1), end=datetime.now()):
  d = []
  ts = []
  for p in  data['metrics'][0]['data']:
    d.append(float(p['avg']))
    ts.append(p['ts'])

  # Chart size of 200x125 pixels and specifying the range for the Y axis
  max_y = int(max(d))
  chart = SimpleLineChart(450, 250, y_range=[0,max_y])
  chart.add_data(d)
  left_axis = range(0, max_y + 1, max_y/5)
  left_axis[0] = ''
  chart.set_axis_labels(Axis.LEFT, left_axis)
  min_dt = datetime.fromtimestamp(min(ts))
  max_dt = datetime.fromtimestamp(max(ts))
  chart.set_axis_labels(Axis.BOTTOM, [ str(min_dt), str(max_dt) ])
  title = '%s.%s.%s' % (node['name'], check['type'], metric)
  chart.set_title(title)
  return chart.get_url()
开发者ID:PeteE,项目名称:cloudkick-py,代码行数:20,代码来源:gcharts.py


示例9: get_pace_chart_url

    def get_pace_chart_url(self, width, height):
        if len(self.positions()) == 0:
            return ''

        pace = []
        int_dist = []
        s = 0
        last_p = None
        for p in self.positions():
            if last_p != None:
                ds = distance.distance((p.latitude, p.longitude), \
                    (last_p.latitude, last_p.longitude)).kilometers
                s = s + int(ds * 1000)
                dt = (p.time - last_p.time).seconds
                if ds > 0:
                    pace.append(dt / ds)
                    int_dist.append(s)

            last_p = p

        int_pace = [int(p) for p in ema(pace, 20)]

        min_pace = int(min(int_pace) * 0.95)
        max_pace = int(max(int_pace) / 0.95)
        mid_pace = (max_pace + min_pace) / 2

        min_pace_str = '%02d:%02d' % (min_pace / 60, min_pace % 60)
        mid_pace_str = '%02d:%02d' % (mid_pace / 60, mid_pace % 60)
        max_pace_str = '%02d:%02d' % (max_pace / 60, max_pace % 60)

        chart = SimpleLineChart(width, height, y_range = (min_pace, max_pace))
        chart.add_data(int_pace)
        chart.set_axis_labels(Axis.LEFT, [min_pace_str, mid_pace_str, max_pace_str])

        return chart.get_url()
开发者ID:patsy,项目名称:gypsum,代码行数:35,代码来源:legacy_models.py


示例10: simpleChart

def simpleChart(bottom_labels, data):
    # round min and max to nearest integers
    datamin = int(min(data) - 0.5)
    datamax = int(max(data) + 0.5)
    chart = SimpleLineChart(200, 125, y_range=[datamin, datamax])
    chart.add_data(data)
    
    left_axis = [datamin,0,datamax]
    chart.set_axis_labels(Axis.LEFT, left_axis)
    chart.set_axis_labels(Axis.BOTTOM, bottom_labels) 
    return chart
开发者ID:flyeven,项目名称:scraperwiki-scraper-vault,代码行数:11,代码来源:googlechartswatch.py


示例11: month_graph

def month_graph(data, start, end):
    """Helper for making graphy graph for a month's worth of data on something."""
    from pygooglechart import SimpleLineChart, Axis
    WIDTH, HEIGHT = 700, 200
    
    y_range = (0, max(max(data), 1)) # todo: have extra room when I figure out how to do labels (set_axis_positions?)
    x_range = (0, 30)
    chart = SimpleLineChart(WIDTH, HEIGHT, y_range=y_range, x_range=x_range)
    chart.add_data(data)
    chart.set_axis_labels(Axis.LEFT, y_range)
    #chart.left.labels = chart.left.label_positions = [0, max(data)]
    chart.set_axis_labels(Axis.BOTTOM, [d.strftime('%D') for d in
                                date_range(start, end, datetime.timedelta(days=10))])
    #chart.bottom.label_positions = [0, 10, 20, 30]
    return chart.get_url()
开发者ID:reverie,项目名称:seddit.com,代码行数:15,代码来源:views.py


示例12: getchart

def getchart(history):
    data = []
    created = []
    for h in history:
        data.append(float(h.average))
        created.append(int(h.created.day))

    max_y = int(math.ceil(max(data))) + 1
    min_y = int(math.floor(min(data))) - 1
    chart = SimpleLineChart(550, 225, y_range=[min_y, max_y])
    chart.add_data(data)
    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(min_y, max_y + 1, 2)
    left_axis[0] = ""
    chart.set_axis_labels(Axis.LEFT, left_axis)
    chart.set_axis_labels(Axis.BOTTOM, created)
    return chart
开发者ID:jness,项目名称:django_tcg_fluctuation,代码行数:19,代码来源:views.py


示例13: group_membership_activity

def group_membership_activity(request, group_slug):
    group = get_object_or_404(BaseGroup, slug=group_slug)
    
    listcount = []
    listdate = []
    currentcount = group.member_users.all().count()
    thedate = date.today()
    skip = False
    while thedate.year != date.today().year - 1 or thedate.month != date.today().month:
        if thedate.month == 1:
            startdate = date(year=thedate.year - 1,
                             month=12, day=1)
        else:
            startdate = date(year=thedate.year,
                             month=thedate.month - 1,
                             day=1)
        joins = GroupMemberRecord.objects.filter(group=group,
                                                 membership_start=True,
                                                 datetime__range=(startdate, thedate)).count()
        unsubs = GroupMemberRecord.objects.filter(group=group,
                                                  membership_end=True,
                                                  datetime__range=(startdate, thedate)).count()
        listcount.append(currentcount - joins + unsubs)
        if not skip:
            listdate.append(thedate.strftime("%B %y"))
        else:
            listdate.append("")
        skip = not skip
        thedate = startdate
        
    listcount.reverse()
    listdate.reverse()

    activity = SimpleLineChart(600, 450, y_range=(min(listcount), max(listcount)))
    activity.add_data(listcount)

    yaxis = range(min(listcount), max(listcount) + 1, max(max(listcount)/10, 1))    # that last number should be 25 or 50.  but for testing...
    if len(yaxis) < 2:  # only for testing...
        yaxis.append(1)
    yaxis[0] = ''
    activity.set_axis_labels(Axis.LEFT, yaxis)
    activity.set_axis_labels(Axis.BOTTOM, listdate)
        
    return activity.get_url()
开发者ID:alexnjoyce,项目名称:myewb2,代码行数:44,代码来源:views.py


示例14: get_elevation_chart_url

    def get_elevation_chart_url(self, width, height):
        if len(self.positions) == 0:
            return ''

        int_elevations = [int(elevation) for elevation in ema([p.altitude for p in self.positions], 30)]

        max_elev = int(max(int_elevations) / 0.95)
        min_elev = int(min(int_elevations) * 0.95)

        chart = SimpleLineChart(width, height, y_range = (min_elev, max_elev))
        chart.add_data(int_elevations)
        chart.set_axis_range(Axis.LEFT, min_elev, max_elev)

        return chart.get_url()
开发者ID:perliedman,项目名称:gypsum,代码行数:14,代码来源:models.py


示例15: get_pace_chart_url

    def get_pace_chart_url(self, width, height):
        def calc_pace_and_dist_from_previous(acc, p):
            last_p = acc[0]
            s = acc[1]
            pace = acc[2]
            int_dist = acc[3]

            ds = distance.distance((p.latitude, p.longitude), \
                (last_p.latitude, last_p.longitude)).kilometers
            s = s + int(ds * 1000)
            dt = (p.time - last_p.time).seconds
            if ds > 0:
                pace.append(dt / ds)
                int_dist.append(s)

            acc[0] = p
            acc[1] = s

            return acc

        if len(self.positions) == 0:
            return ''

        pace = []
        int_dist = []
        s = 0
        last_p = None

        r = reduce(calc_pace_and_dist_from_previous,
            self.positions[1:len(self.positions)],
            [self.positions[0], 0, [], []])
        pace = r[2]
        int_dist = r[3]
        int_pace = [int(p) for p in ema(pace, 30)]

        min_pace = int(min(int_pace) * 0.95)
        max_pace = int(max(int_pace) / 0.95)
        mid_pace = (max_pace + min_pace) / 2

        min_pace_str = '%02d:%02d' % (min_pace / 60, min_pace % 60)
        mid_pace_str = '%02d:%02d' % (mid_pace / 60, mid_pace % 60)
        max_pace_str = '%02d:%02d' % (max_pace / 60, max_pace % 60)

        chart = SimpleLineChart(width, height, y_range = (min_pace, max_pace))
        chart.add_data(int_pace)
        chart.set_axis_labels(Axis.LEFT, [min_pace_str, mid_pace_str, max_pace_str])

        return chart.get_url()
开发者ID:perliedman,项目名称:gypsum,代码行数:48,代码来源:models.py


示例16: makechart

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]])
    
    min_y = -5
    max_y = 5
    chart = SimpleLineChart(2, 2, y_range=[min_y, max_y])
    
    #chart.add_data([max_y]*2)
    chart.add_data(hdphseq)   
    #chart.add_data([min_y]*2)
    chart.set_axis_labels(Axis.BOTTOM, aaseq)
    
    chart.download('test.png')
    
    #print hdphseq
    return hdphseq
开发者ID:pconerly,项目名称:internet-programming-assignments,代码行数:39,代码来源:bioprotein.py


示例17: dict

from pygooglechart import Axis

import timeit
import gc

results = dict()
RANGE = range(0, 100000, 10000)[1:]
for lib in "stacklessb", "fibrab", "kamaeliab":
    results[lib] = eval(open("%s.results"%lib).read())

# Set the vertical range from 0 to 100
max_y = max(max(i) for i in results.values())  * 1.1
print max_y

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

chart.set_colours(['0000FF', "00FF00", "FF0000", "FFFF00"])
print sorted(results.keys())
for k in sorted(results.keys()):
    data = results[k]
    chart.add_data(data)

# 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
开发者ID:simonwittber,项目名称:fibra,代码行数:31,代码来源:chart.py


示例18: stripes

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(200, 125, 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
    ]
    chart.add_data(data)
    
    # 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)

    # 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:Ashwini7,项目名称:La-resumex,代码行数:37,代码来源:line.py


示例19: fill

def fill():

    # Set the vertical range from 0 to 50
    max_y = 50
    chart = SimpleLineChart(200, 125, y_range=[0, max_y])

    # First value is the highest Y value. Two of them are needed to be
    # plottable.
    chart.add_data([max_y] * 2)

    # 3 sets of real data
    chart.add_data([28, 30, 31, 33, 35, 36, 42, 48, 43, 37, 32, 24, 28])
    chart.add_data([16, 18, 18, 21, 23, 23, 29, 36, 31, 25, 20, 12, 17])
    chart.add_data([7, 9, 9, 12, 14, 14, 20, 27, 21, 15, 10, 3, 7])

    # Last value is the lowest in the Y axis.
    chart.add_data([0] * 2)

    # Black lines
    chart.set_colours(['000000'] * 5)

    # Filled colours
    # from the top to the first real data
    chart.add_fill_range('76A4FB', 0, 1)

    # Between the 3 data values
    chart.add_fill_range('224499', 1, 2)
    chart.add_fill_range('FF0000', 2, 3)

    # from the last real data to the
    chart.add_fill_range('80C65A', 3, 4)

    # Some axis 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-fill.png')
开发者ID:Ashwini7,项目名称:La-resumex,代码行数:37,代码来源:line.py


示例20: simple_random

def simple_random():
    chart = SimpleLineChart(settings.width, settings.height, y_range=(0, 100))
    chart.add_data(helper.random_data())
    chart.download('line-simple-random.png')
开发者ID:Ashwini7,项目名称:La-resumex,代码行数:4,代码来源:line.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python pygpu.empty函数代码示例发布时间:2022-05-25
下一篇:
Python pygoogle.pygoogle函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap