def __init__(self, draw, legend, data_value, fill_value, options = {}): self.legend = legend self.data_value = data_value self.fill_value = fill_value self.border = options.get('bar_border', 1) self.full_color = options.get('full_color', (255, 0, 0)) self.empty_color = options.get('empty_color', (0, 255, 0)) font_name = "%s.ttf" % options.get('font_name', 'arial_black') self.font_type = get_font(font_name) self.light_font_color = options.get('fontcolor', (255, 255, 255)) self.dark_font_color = options.get('fontcolor', (0, 0, 0)) self.draw = draw
def __init__(self, draw, legend, fill_value, options={}): assert fill_value <= 100, "Invalid fill value - must be <= 100" self.legend = legend self.fill_value = fill_value self.border = options.get("bar_border", 1) self.full_color = options.get("green", (255, 0, 0)) self.empty_color = options.get("red", (0, 255, 0)) self.font_type = options.get("font_type", get_font("arial_black.ttf")) self.light_font_color = options.get("fontcolor", (255, 255, 255)) self.dark_font_color = options.get("fontcolor", (0, 0, 0)) self.draw = draw
def __init__(self, options={}): self.options = options self.width = options.get("width", 500) assert self.width > 0, "width must be > 0" self.bar_area_ratio = options.get("bar_area_ratio", 0.65) assert self.bar_area_ratio <= 1, "bar_area_ration must be <= 1" self.bar_height_ratio = options.get("bar_height_ratio", 0.2) assert self.bar_height_ratio <= 1, "bar_height_ratio must be <= 1" self.font_type = options.get("font_type", get_font("arial_black.ttf")) self.min_font_size = 15 self.img = None self.draw = None self.stack_bars = []
def __init__(self, options={}): self.options = options self.width = options.get('width', 500) assert self.width > 0, "width must be > 0" self.bar_area_ratio = options.get('bar_area_ratio', .65) assert self.bar_area_ratio <= 1, "bar_area_ration must be <= 1" self.bar_height_ratio = options.get('bar_height_ratio', .2) assert self.bar_height_ratio <= 1, "bar_height_ratio must be <= 1" self.font_type = options.get('font_type', get_font('arial_black.ttf')) self.min_font_size = 15 self.img = None self.draw = None self.stack_bars = []
def __init__(self, options={}): self.options = options self.width = options.get('width', 500) assert self.width > 0, "width must be > 0" self.bar_area_ratio = options.get('bar_area_ratio', .65) assert self.bar_area_ratio <= 1, "bar_area_ration must be <= 1" self.bar_height_ratio = options.get('bar_height_ratio', .2) assert self.bar_height_ratio <= 1, "bar_height_ratio must be <= 1" font_name = "%s.ttf" % options.get('font_name', 'arial_black') self.font_type = get_font(font_name) self.min_font_size = 15 self.img = None self.draw = None self.stack_bars = [] self.draw_mode = options.get('draw_mode', 'percentage')
def __init__(self, options = {}): self.options = options self.width = options.get('width', 500) assert self.width > 0, "width must be > 0" self.bar_area_ratio = options.get('bar_area_ratio', .65) assert self.bar_area_ratio <=1, "bar_area_ration must be <= 1" self.bar_height_ratio = options.get('bar_height_ratio', .2) assert self.bar_height_ratio <=1, "bar_height_ratio must be <= 1" font_name = "%s.ttf" % options.get('font_name', 'arial_black') self.font_type = get_font(font_name) self.min_font_size = 15 self.img = None self.draw = None self.stack_bars = [] self.draw_mode = options.get('draw_mode', 'percentage')