def draw_vote_stat(data): G = HorizontalBarStack(data, encoding='text') G.fill('bg', 'lg', 'ffffff') G.color('4d89f9') G.bar(10) G.size(100, 29) for i in range(len(data)): G.marker('t' + str(data[i]), 'black', 0, i, 11) #for day in : return G.img()
def charts(self, id, type, limit=None, start=None, end=None): user = Session.query(User).get(id) if not user: abort(404) if limit: start_date = datetime.date.today() - \ datetime.timedelta(days=int(limit)) end_date = None elif start and end: start = [int(i) for i in start.split('-')] start_date = datetime.date(start[0], start[1], start[2]) end = [int(i) for i in end.split('-')] end_date = datetime.date(end[0], end[1], end[2]) else: start_date = None end_date = None if type == 'ppdow': data = user.posts_per_dow(start_date=start_date, end_date=end_date) chart = HorizontalBarStack(data) chart.axes.type('xy') chart.axes.label(0, '0', '100') chart.axes.label(1, *reversed([i[1] for i in days])) chart.fill('bg', 's', 'feeebd') chart.grid(10, 0, 10, 0) chart.scale(0, max(data)) chart.size(680, 220) elif type == 'pph': data = user.posts_per_hour(start_date=start_date, end_date=end_date) chart = VerticalBarStack(data) chart.axes.type('yx') chart.axes.label(0, '0', '100') chart.axes.label(1, *range(0, 24)) chart.fill('bg', 's', 'feeebd') chart.grid(0, 10, 10, 0) chart.scale(0, max(data)) chart.size(680, 300) else: abort(400) return chart.img()
def guide_chbh_size(self): G = HorizontalBarStack('hello', encoding='simple') G.color('4d89f9') G.size(200, 125) G.bar_height(10) return G
def guide_chbh_clipped(self): G = HorizontalBarStack('hello', encoding='simple') G.color('4d89f9') G.size(200, 125) return G
def guide_bhs(self): G = HorizontalBarStack('ello', encoding='simple') G.color('4d89f9') G.size(200, 125) return G