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


Python SimpleLineChart.set_grid方法代码示例

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


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

示例1: __init__

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import set_grid [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

示例2: RenderGoogleChart

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import set_grid [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

示例3: simpleChart3

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import set_grid [as 别名]
def simpleChart3(bottom_labels, data1, data2):
    datamin, datamax = min(min(data1, data2)), max(max(data1, data2))
    datamin = int(datamin - 0.5)
    datamax = int(datamax + 0.5)
    chart = SimpleLineChart(200, 125, y_range=[datamin, datamax])
    chart.add_data(data1)
    chart.add_data(data2)
    
    left_axis = [datamin,0,datamax]

    left_axis[0] = '' # no label at 0
    chart.set_axis_labels(Axis.LEFT, left_axis)
    chart.set_axis_labels(Axis.BOTTOM, bottom_labels)
    chart.set_axis_labels(Axis.BOTTOM, ['X Axis']) # second label below first one
    chart.set_axis_positions(2, [50.0]) # position, left is 0., right is 100., 50. is center

    # Set the line colour
    chart.set_colours(['0000FF', 'FF0000'])

    # Set the horizontal dotted lines
    chart.set_grid(0, 25, 5, 5)
    
    # Set vertical stripes
    stripes = ['CCCCCC', 0.2, 'FFFFFF', 0.2]
    chart.fill_linear_stripes(Chart.CHART, 0, *stripes)
    return chart
开发者ID:flyeven,项目名称:scraperwiki-scraper-vault,代码行数:28,代码来源:googlechartswatch.py

示例4: get

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import set_grid [as 别名]
 def get(self):
     list = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep']
     list2 = []
     for title in list:
         list2.append( int(getdata(title,'funds').custom['amount'].text))
     max_y = 10000
     chart = SimpleLineChart(200, 125, y_range=[0, max_y])
     
     chart.add_data([2000,3000,5000,1200,5000,4000,1000,3000,5900])
     
     # 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, list)
     
     url2 = chart.get_url()
     self.response.out.write(template.render('template/donate.html',{
                                             
                                                              'url2' :url2,                }))
开发者ID:mayankgupta022,项目名称:webwizard-optimus,代码行数:35,代码来源:main.py

示例5: getLineGraph

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import set_grid [as 别名]
def getLineGraph(data,line1color,line2color):
    # Set the vertical range based on data values
    tweets = [d[0] for d in data]
    retweets = [d[1] for d in data]
    ratio = [str(int(d[1]/d[0]*100))+'%' for d in data]
    hours = [d[2] for d in data]
    mx = max(tweets)
    mn = min(retweets)
    buffer = (mx - mn)/100 # average retweets have consitently been less
    min_y = mn - buffer
    max_y = mx + buffer

    # Chart size of 750x400 pixels and specifying the range for the Y axis
    chart = SimpleLineChart(750, 400, y_range=[min_y, max_y])
    chart.set_legend(['Tweets','Retweets'])
    chart.set_legend_position('t')
    # Add the chart data
    chart.add_data(tweets)
    chart.add_data(retweets)
    # Set the line colour to blue
    chart.set_colours([line1color,line2color])

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

    #set left axis to values range
    left_axis = range(min_y, max_y, (max_y-min_y)/10)
    chart.set_axis_labels(Axis.BOTTOM, hours)
    chart.set_axis_labels(Axis.BOTTOM, ratio)
    chart.set_axis_labels(Axis.LEFT, left_axis)
    return chart.get_url()
开发者ID:Jlewiswa,项目名称:Twitter100k,代码行数:33,代码来源:graphop.py

示例6: _partyline

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import set_grid [as 别名]
    def _partyline(self, party_results):
        if self.request.GET.get('percentages') == 'true':
            key = 'percentage'
        else:
            key = 'count'

        maxcount = 0
        allcounts = []
        granularity = self.request.GET.get('granularity')
        months = []

        for party, results in party_results.iteritems():
            counts = [x.get(key) for x in results['results']]
            allcounts.append(counts)
            if max(counts) > maxcount:
                maxcount = max(counts)

            if granularity == 'month':
                months = [x['month'] for x in results['results']]
                januaries = [x for x in months if x.endswith('01')]
                january_indexes = [months.index(x) for x in januaries]
                january_percentages = [int((x / float(len(months))) * 100) for x in january_indexes]

            #times = [x.get(granularity) for x in results['results']]

        width = int(self.request.GET.get('width', 575))
        height = int(self.request.GET.get('height', 318))
        chart = SimpleLineChart(width, height, y_range=(0, max(counts)))

        chart.fill_solid('bg', '00000000')  # Make the background transparent
        chart.set_grid(0, 50, 2, 5)  # Set gridlines

        if granularity == 'month':
            index = chart.set_axis_labels(Axis.BOTTOM, [x[:4] for x in januaries[::2]])
            chart.set_axis_positions(index, [x for x in january_percentages[::2]])

        if key == 'percentage':
            label = '%.4f' % maxcount
        else:
            label = int(maxcount)
        index = chart.set_axis_labels(Axis.LEFT, [label, ])
        chart.set_axis_positions(index, [100, ])

        for n, counts in enumerate(allcounts):
            chart.add_data(counts)
            chart.set_line_style(n, thickness=2)  # Set line thickness

        colors = {'R': 'bb3110', 'D': '295e72', }
        chart_colors = []
        chart_legend = []
        for k in party_results.keys():
            chart_colors.append(colors.get(k, '000000'))
            chart_legend.append(k)
            chart.legend_position = 'b'

        chart.set_colours(chart_colors)

        if self.request.GET.get('legend', 'true') != 'false':
            chart.set_legend(chart_legend)
        return chart.get_url()
开发者ID:notthatbreezy,项目名称:Capitol-Words,代码行数:62,代码来源:views.py

示例7: velocity_chart

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import set_grid [as 别名]
    def velocity_chart(self):

        graph_width = 600
        graph_height = 300

        x_max = self.total_iterations
        y_max = max(max(self.estimate_stories_data()),
                    max(self.estimate_tasks_data()),
                    max(self.work_data()))

        chart = SimpleLineChart(graph_width, graph_height,
                                x_range=(1, x_max + 1), y_range=(0, y_max + 1))

        chart.add_data(self.estimate_stories_data())
        chart.add_data(self.estimate_tasks_data())
        chart.add_data(self.work_data())

        chart.set_grid(0, 100.0 / y_max + 1, 5, 5)
        chart.set_colours(['FF0000', '00FF00', '0000FF'])
        chart.set_legend([_('rough story estimates'),
                          _('task estimates'), _('worked')])
        chart.set_legend_position('b')
        chart.set_axis_labels(Axis.LEFT, ['', '', _('days')])
        chart.set_axis_labels(Axis.BOTTOM, range(1, x_max + 1))
        chart.set_axis_range(Axis.LEFT, 0, y_max + 1)

        return chart.get_url(data_class=ExtendedData)
开发者ID:zestsoftware,项目名称:Products.eXtremeManagement,代码行数:29,代码来源:chart.py

示例8: get_chart_image

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import set_grid [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

示例9: report

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import set_grid [as 别名]
def report(request):
    # data report
    if Invoice.objects.all().count() == 0:
        return redirect("/openbook")
    min_year = Invoice.objects.order_by("date")[0].date.year
    max_year = Invoice.objects.order_by("-date")[0].date.year
    report = []
    for year in range(min_year,max_year+1):
        year_report = []
        for month in range(1,13):
            total = get_total(year, month)
            year_report.append(total)
        s = sum(year_report)
        tax = round((s * (0.13 / 1.13)), 2)
        year_report.append(tax)
        year_report.append(s)
        year_report.insert(0, year)
        report.append(year_report)
        
    # graphical data year report
    year_total_data = [i[-1] for i in report]
    max_y = max(year_total_data)
    min_y = min(year_total_data)
    gr = SimpleLineChart(800, 300, y_range=[0,max_y])
    gr.add_data(year_total_data)
    gr.set_grid(0, 25, 5, 5)
    left_axis = range(min_y, max_y + 1, (max_y/10))
    left_axis[0] = ''
    gr.set_axis_labels(Axis.LEFT, left_axis)
    gr.set_axis_labels(Axis.BOTTOM, \
    [str(i) for i in range(min_year, max_year+1)])
    
    # yearly report
    gs = []
    months = ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"]
    for data in report:
        max_y = max(data[1:-2]) # excluding the first and the last 2 entries
        g = SimpleLineChart(800, 300, y_range=[0, max_y])
        g.add_data(data[1:-2]) # excluding the frist and the last 2 entries
        g.set_grid(0, 25, 5, 5)
        left_axis = range(0, max_y + 1, (max_y/10))
        left_axis[0] = ''
        g.set_axis_labels(Axis.LEFT, left_axis)
        g.set_axis_labels(Axis.BOTTOM, \
        months)
        gs.append((data[0], g.get_url()))
    gs.reverse()
    grurl = gr.get_url()
    if max_year == min_year:
        grurl = None
    return render_to_response(
        "admin/invoice/report.html",
        {'report' : report, 'gr': grurl, 'gs':gs},
        RequestContext(request, {}),
    )
开发者ID:maximmai,项目名称:openbook,代码行数:57,代码来源:admin_views.py

示例10: generate_freq_chart_url_from_qset

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import set_grid [as 别名]
def generate_freq_chart_url_from_qset(qset, sizex, sizey):
    ''' returns url for chart from given queryset '''
    
    end_year = qset.order_by('-publication_date')[0].publication_date.year
    start_year = qset.order_by('publication_date')[0].publication_date.year
    #print "start {0}, end {1}".format(start_year, end_year)

    year_range=range(start_year,end_year + 1)
    month_range=range(1, 13)
    count_rules = []
    count_proprules = []
    count_notices = []
    count_presdocs = []
    count_unknown = []
    count_total = []
    today = datetime.date.today()    
        
    for y in year_range:
        start_date=datetime.date(y,1,1)
        end_date=datetime.date(y,12,31)
        year_qset = qset.filter(publication_date__range=(start_date, end_date))
        count_rules.append(year_qset.filter(document_type='Rule').count())
        count_proprules.append(year_qset.filter(document_type='Proposed Rule').count())
        count_notices.append(year_qset.filter(document_type='Notice').count())
        count_presdocs.append(year_qset.filter(document_type='Presidential Document').count())
        count_unknown.append(year_qset.filter(document_type='Document of Unknown Type').count())
        count_total.append(count_unknown[-1] + count_presdocs[-1] + count_rules[-1] + count_proprules[-1] + count_notices[-1])
    #for i in [count_rules, count_proprules, count_notices, count_presdocs, count_unknown, count_total]:
        #print i

    # set up chart axis parameters
    largest_y = max(count_total)
    left_axis_step = int(pow(10, int(log10(largest_y)))) 
    max_y = (int(largest_y / left_axis_step) * left_axis_step) + (left_axis_step * 2)
    left_axis = range(0, max_y + left_axis_step, left_axis_step)
    left_axis[0] = ""
    bottom_axis = year_range

    # generate chart url
    chart = SimpleLineChart(sizex, sizey, y_range=[0, max_y])
    chart.set_axis_labels(Axis.LEFT, left_axis)
    chart.set_axis_labels(Axis.BOTTOM, bottom_axis)
    chart.set_grid(0, max(10, int(left_axis_step / 10)), 5, 5)
    chart.set_colours(['0000FF', '00FF00', 'FF0000', 'FFFF00', '00FFFF', 'aaaaaa'])
    chart.set_legend(['Rules', 'Proposed Rules', 'Notices', 'Presidential Docs', 'Unknown', 'Total'])
    chart.add_data(count_rules)
    chart.add_data(count_proprules)
    chart.add_data(count_notices)
    chart.add_data(count_presdocs)
    chart.add_data(count_unknown)
    chart.add_data(count_total)
    chart_url = chart.get_url()
       
    return chart_url
开发者ID:esbenson,项目名称:pbearfrfeed,代码行数:56,代码来源:charts.py

示例11: plotter

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import set_grid [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

示例12: stripes

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import set_grid [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: ShowChartByGoogle

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import set_grid [as 别名]
def ShowChartByGoogle(handler, data, book, ups):
    oneday = datetime.timedelta(days=1)
    date = ups[0].date
    xlabel = [str(date.day)]
    ylabel = range(0, book.pages + 1, ((book.pages / 8) / 50 + 1) * 50)
    
    for (i, up) in enumerate(ups):
        if i == 0: continue
        days = (up.date - ups[i-1].date).days
        for j in range(days):
            date += oneday
            if date.weekday() == 0: # only records sunday
                if date.day < 7:
                    xlabel.append(str(date.month))
                else:
                    xlabel.append('.')

    chart = SimpleLineChart(600, 320, y_range=[0, ylabel[-1]])

    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 = ylabel
    left_axis[0] = ''
    chart.set_axis_labels(Axis.LEFT, left_axis)
    
    # X axis labels
    chart.set_axis_labels(Axis.BOTTOM, xlabel)

    doRender(handler, 'progress.html', {
            'book': book,
            'imgurl': chart.get_url(),
            'method': 'google'})
开发者ID:wangjun,项目名称:reading-progress,代码行数:46,代码来源:chart.py

示例14: get_chart

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import set_grid [as 别名]
    def get_chart(self, data, date_start, date_end, colours=None):
        # Set the vertical range from max_value plus 10
        if not data:
            return None

        max_y = max([max(l) for l in data])

        if max_y < 10:
            mult = 1
        else:
            y_scale = max_y
            mult = 1
            while y_scale/10 > 1:
                mult = mult*10
                y_scale = y_scale/10
        max_y = max_y + mult

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

        for i in data:
            chart.add_data(i)

        if not colours:
            chart.set_colours(['0000FF']) # Set the line colour to blue
        else:
            chart.set_colours(colours)

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

        # Set the horizontal dotted lines
        chart.set_grid(0, 25, 5, 5)
        
        left_axis = range(0, max_y + 1, mult)
        left_axis[0] = ''
        chart.set_axis_labels(Axis.LEFT, left_axis)

        # X axis labels
        chart.set_axis_labels(Axis.BOTTOM, \
            self.get_chart_x_axis_label(date_start, date_end))
        
        return chart.get_url()
开发者ID:Niets,项目名称:gestorpsi,代码行数:45,代码来源:models.py

示例15: generateGraph

# 需要导入模块: from pygooglechart import SimpleLineChart [as 别名]
# 或者: from pygooglechart.SimpleLineChart import set_grid [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.set_grid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。