from pychart import *
import pychart.doc_support
import re

x = 100
y = 500

ar = area.T()

q=30
m=60

def drawerror_bar(e):
    global x, y
    name = pychart.doc_support.stringify_value(e)
    name = re.sub("error_bar\\.", "", name)
    tb = text_box.T(text="/hC" + name, loc=(x, y-m-20), line_style=None)
    tb.draw()
    e.draw((x, y), y-m, y+m, y-q, y+q)
    x = x + 50

xmin = x

drawerror_bar(error_bar.bar1)
drawerror_bar(error_bar.bar2)
drawerror_bar(error_bar.bar3)
drawerror_bar(error_bar.bar4)
drawerror_bar(error_bar.bar5)

xmax = x+20-50

canvas.line(line_style.gray70_dash1, xmin-20, y, xmax, y)

canvas.line(line_style.gray70_dash1, xmin-20, y-q, xmax, y-q)
canvas.line(line_style.gray70_dash1, xmin-20, y+q, xmax, y+q)
tb = text_box.T(text="quartile", loc=(xmax+40, y), line_style=None)
tb.add_arrow(tipLoc=(xmax+55, y+q)) #, tail='tc')
tb.add_arrow(tipLoc=(xmax+55, y-q)) #, tail='bc')
tb.draw()

tb = text_box.T(text="min//\nmax", loc=(xmax+80, y), line_style=None)
tb.add_arrow(tipLoc=(xmax+95, y+m)) #, tail='tc')
tb.add_arrow(tipLoc=(xmax+95, y-m)) #, tail='bc')
tb.draw()

