#Autogenerated by ReportLab guiedit do not edit
from rlextra.graphics.quickchart import quickChart, ALLOWED_CHART_TYPES
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin
from reportlab.lib.colors import CMYKColor, PCMYKColor

def QCTestDrawing(**kw):
	return quickChart(**kw)

def makeDrawing(html,msg,**kw):
	L = []
	for k,v in kw.items():
		L.append('%s=%s' % (k,repr(v)))
	if msg and L:
		msg += ' '
	msg2 = 'quickchart(%s)' % ','.join(L)
	try:
		qc = QCTestDrawing(**kw)
		for k,v in kw.items():
			L.append('%s=%s' % (k,repr(v)))
		fnRoot = 'QCTestDrawing%03d' % len(html)
		qc.save(formats=['pdf','gif','eps'],outDir='pmout',fnRoot=fnRoot)
		if not msg:
			print "%s\n"% (msg2)
			html.append('<h2>%s</h2><img src="%s.gif">\n' % (msg2,fnRoot))
		else:
			print "%s\n%s\n"% (msg, msg2)
			html.append('<h2>%s</h2><h3>%s</h3><img src="%s.gif">\n' % (msg,msg2,fnRoot))
	except:
		msg = "!!! FAILED ON CHART '%s' !!!" % msg
		if msg2:
			html.append('<h2><font color="red">%s<br/>%s</font></h2>\n' % (msg, msg2))
			print "%s\n%s\n"% (msg, msg2)
		else:
			html.append('<h2><font color="red">%s</font></h2>\n' % msg)
			print "%s\n%s\n"% (msg)
		import sys
		tbt,tbv,tb = sys.exc_info()
		from rlextra.utils.log import _tb2html
		html.append(_tb2html(tbt,tbv,tb))

def main():
	ALLOWED_CHART_TYPES.sort()
	html = []
	for chartType in ALLOWED_CHART_TYPES:
		makeDrawing(html, '',   chartType=chartType)

	makeDrawing(html,"0.1 Line chart should have both x and y gridlines",chartType='linechart',yAxisVisible=1, yAxisGridLines=1, xAxisVisible=1, xAxisGridLines=1)
	makeDrawing(html,"0.11 Line plot should have both x and y gridlines",chartType='lineplot',yAxisVisible=1, yAxisGridLines=1, xAxisVisible=1, xAxisGridLines=1, data=[[1.5,3,4.5],[1,2,3],[1.5,2.5,3.5]])

	makeDrawing(html,'1.1 Clustered_bar with the yAxisVisible and yAxisGridlines on',chartType='clustered_bar',yAxisVisible=1, yAxisGridLines=1, xAxisVisible=0)
	makeDrawing(html,'1.2 Stacked_bar with the yAxisVisible and yAxisGridlines on',chartType='stacked_bar',yAxisVisible=1, yAxisGridLines=1, xAxisVisible=0)

	makeDrawing(html,'1.3 Clustered_bar with the xAxisVisible and xAxisGridlines on',chartType='clustered_bar',xAxisVisible=1, xAxisGridLines=1, yAxisVisible=0)
	makeDrawing(html,'1.4 Stacked_bar with the xAxisVisible and xAxisGridlines on',chartType='stacked_bar',xAxisVisible=1, xAxisGridLines=1, yAxisVisible=0)

	makeDrawing(html,'2.1 Clustered_bar with both the x Axis and y Axis invisible - should resize correctly',chartType='stacked_bar',xAxisVisible=0, yAxisVisible=0,showBoundaries=1)
	makeDrawing(html,'2.2 Stacked_bar with both the x Axis and y Axis invisible - should resize correctly',chartType='clustered_bar',xAxisVisible=0, yAxisVisible=0,showBoundaries=1)

	makeDrawing(html,'3.1 Stacked_bar with dataLabelsType set to None',chartType='stacked_bar',dataLabelsType=None)
	makeDrawing(html,'3.2 Clustered_bar with dataLabelsType set to None',chartType='clustered_bar',dataLabelsType=None)
	makeDrawing(html,'3.3 Pie with dataLabelsType set to None',chartType='pie',dataLabelsType=None)

	makeDrawing(html,"3.4 Stacked_bar with dataLabelsType set to 'values'",chartType='stacked_bar',dataLabelsType='values')
	makeDrawing(html,"3.5 Clustered_bar with dataLabelsType set to 'values'",chartType='clustered_bar',dataLabelsType='values')
	makeDrawing(html,"3.6 Pie with dataLabelsType set to 'values'",chartType='pie',dataLabelsType='values')

	makeDrawing(html,"3.7 Stacked_bar with dataLabelsType set to 'percent'",chartType='stacked_bar',dataLabelsType='percent')
	makeDrawing(html,"3.8 Clustered_bar with dataLabelsType set to 'percent'",chartType='clustered_bar',dataLabelsType='percent')
	makeDrawing(html,"3.9 Pie with dataLabelsType set to 'percent'",chartType='pie',dataLabelsType='percent')
	makeDrawing(html,"3.71 Stacked_bar with dataLabelsType set to 'percent,2'",chartType='stacked_bar',dataLabelsType='percent,2')
	makeDrawing(html,"3.81 Clustered_bar with dataLabelsType set to 'percent,2'",chartType='clustered_bar',dataLabelsType='percent,2')
	makeDrawing(html,"3.91 Pie with dataLabelsType set to 'percent,2'",chartType='pie',dataLabelsType='percent,2')
	makeDrawing(html,"3.72 Stacked_bar with dataLabelsType set to '%(percent).1f%%'",chartType='stacked_bar',dataLabelsType='%(percent).1f%%')
	makeDrawing(html,"3.82 Clustered_bar with dataLabelsType set to '%(percent).2f%%'",chartType='clustered_bar',dataLabelsType='%(percent).2f%%')
	makeDrawing(html,"3.92 Pie with dataLabelsType set to '%(percent).3f%% per Annum'",chartType='pie',dataLabelsType='%(percent).3f%% per Annum')
	makeDrawing(html,"3.73 Stacked_bar with dataLabelsType set to '$%(decfmt(value*10000,1,'.',''))s'",chartType='stacked_bar',dataLabelsType='$%(decfmt(value*10000,2,\'.\',\'\'))s')
	makeDrawing(html,"3.83 Clustered_bar with dataLabelsType set to '$%(decfmt(value*14000,2,',','.'))s'",chartType='clustered_bar',dataLabelsType='$%(decfmt(value*14000,1,\',\',\'.\'))s')
	makeDrawing(html,"3.93 Pie with dataLabelsType set to '$%(decfmt(value*12000,2))s/Year'",chartType='pie',dataLabelsType='$%(decfmt(value*12000,2))s/Year')

	makeDrawing(html,"4.1 Pie with dataLabelsType unset - no datalabels should be printed",chartType='pie')
	makeDrawing(html,"4.2 Pie with dataLabelsType set to 'values' - values should be used for dataLabels",chartType='pie',dataLabelsType='values')
	makeDrawing(html,"4.3 Pie with dataLabelsType set to 'percent' - percentages should be used for dataLabels",chartType='pie',dataLabelsType='percent')
	makeDrawing(html,"4.4 Pie with with category names - set dataLabelsType '%(categoryNames)s'",chartType='pie',dataLabelsType='%(categoryNames)s')

	makeDrawing(html,"5.1 Title should be (ascent * 1.5) from the font base line ",chartType='pie', titleText="This is the Title")

	makeDrawing(html,"6.1 Bar with integer data - axis should display without decimals",chartType='bar', data=[[100, 200, 300, 400]], xAxisVisible=1, yAxisVisible=1)
	makeDrawing(html,"6.2 Column with integer data - axis should display without decimals",chartType='column', data=[[100, 200, 300, 400]], xAxisVisible=1, yAxisVisible=1)
	makeDrawing(html,"6.3 Bar with floating point data - axis should display with decimals",chartType='bar', data=[[0.01, 0.02, 0.03, 0.04]], xAxisVisible=1, yAxisVisible=1)
	makeDrawing(html,"6.4 Bar with floating point data - axis should display with decimals",chartType='column', data=[[0.01, 0.02, 0.03, 0.04]], xAxisVisible=1, yAxisVisible=1)

	makeDrawing(html,"7.1 x Axis and y Axis gridlines should be the same width",chartType='bar', xAxisVisible=1, yAxisVisible=1, xAxisGridLines=1, yAxisGridLines=1)
	makeDrawing(html,"7.2 x Axis and y Axis gridlines should be the same width",chartType='column', xAxisVisible=1, yAxisVisible=1, xAxisGridLines=1, yAxisGridLines=1)

	makeDrawing(html,"8.1 When using data = [[120,20]], the value axis should no longer show negative values of (-50,0,50,100,150)",chartType='column', data=[[120,20]])
	makeDrawing(html,"8.1a When using data = [[120,20]], the value axis should no longer show negative values of (-50,0,50,100,150)",chartType='bar', data=[[120,20]])
	makeDrawing(html,"8.2 When using negative data the gridline of the category axis should be correctly sized",chartType='column', data=[[-120,-20,20]], xAxisGridLines=1)
	makeDrawing(html,"8.2a When using negative data the gridline of the category axis should be correctly sized",chartType='bar', data=[[-120,-20,20]], yAxisGridLines=1)

	makeDrawing(html,"9.1 Blue border round background, no fill on background",chartType='column', bgColor = None, bgStrokeColor='blue')
	makeDrawing(html,"9.2 Blue border round background, yellow fill on background",chartType='bar', bgColor = 'yellow', bgStrokeColor='blue')

	makeDrawing(html,"10.1 Test piechart with data of '[[230,340]]' and dataLabelsType of 'percent' (as per Nardi's test)", chartType='pie',data=[[230,340]],categoryNames=['category1','category2'],seriesNames=[],bgColor=None,plotColor=CMYKColor(0,0,1,0),legendPos='left',legendFontName='Helvetica',legendFontColor=CMYKColor(0,0,0,2),titleText='This is the main title',titleFontName='Helvetica-Bold',titleFontSize=18,titleFontColor=CMYKColor(0,1,1,1),dataLabelsType='percent',dataLabelsFontName='Helvetica',dataLabelsFontSize=14,dataLabelsFontColor=CMYKColor(0,1,1,0))

	makeDrawing(html,"11.1 Test for black lines in 3D exploded piechart", chartType = 'exploded_pie3d',data = [[27.00000,3.00000,10.00000,5.00000,5.00000,15.00000,35.00000]],categoryNames = ['Category 1','Category 2','Category 3','Category 4','Category 5','Category 6','Category 7'],seriesNames = [],chartColors = [CMYKColor(0.00,1.00,0.00,0.00),CMYKColor(1.00,1.00,0.00,0.00),CMYKColor(0.00,0.00,1.00,0.00),CMYKColor(0.00,1.00,1.00,0.00),CMYKColor(0.00,0.80,1.00,0.00),CMYKColor(0.00,0.40,1.00,0.00),CMYKColor(0.80,0.00,1.00,0.00)],bgColor = None,plotColor = None,legendPos = 'right',legendFontName = 'Helvetica',legendFontSize = 9.00,legendFontColor = CMYKColor(0.05,0.45,1.00,0.00),titleText = '',titleFontName = 'Helvetica-Bold',titleFontSize = 14.00,titleFontColor = CMYKColor(0.00,0.00,0.00,1.00),dataLabelsType = '%.1f',dataLabelsFontName = 'Helvetica',dataLabelsFontSize = 9.00,dataLabelsFontColor = CMYKColor(0.05,0.45,1.00,0.00),width = 401.54384,height = 150.86375)
	makeDrawing(html,"12.1 xAxisLabelAngle=-70",chartType='linechart', dataLabelsType='values', categoryNames=['Oranges','Lemons','Apples','Pears'], xAxisLabelAngle=-70)
	makeDrawing(html,"12.2 yAxisLabelAngle=-70",chartType='linechart', dataLabelsType='values', categoryNames=['Oranges','Lemons','Apples','Pears'], yAxisLabelAngle=-70)
	makeDrawing(html,"12.3 xAxisLabelAngle=70",chartType='linechart', dataLabelsType='values', categoryNames=['Oranges','Lemons','Apples','Pears'], xAxisLabelAngle=70)
	makeDrawing(html,"12.3 yAxisLabelAngle=70",chartType='linechart', dataLabelsType='values', categoryNames=['Oranges','Lemons','Apples','Pears'], yAxisLabelAngle=70)
	makeDrawing(html,"13.1 textData", chartType='linechart', dataLabelsType='values', textData="A B C D\na b c d")
	makeDrawing(html,"13.2 textData", chartType='column', dataLabelsType='values', textData="A B C D\na b c d")
	makeDrawing(html,"13.3 textData", chartType='bar', dataLabelsType='values', textData="A B C D\na b c d")
	makeDrawing(html,"14.1 Ron Error Empty Chart", chartType = 'clustered_column',data =[[0],[0],[0]],categoryNames = ['Oct'],seriesNames = ['Series 1','Series  2','Series 3'],chartColors =  [CMYKColor(0.00,0.20,0.34,0.00),CMYKColor(0.00,0.00,0.40,0.00),CMYKColor (0.20,0.00,0.09,0.00)],bgColor = None,plotColor = None,legendPos =	'right',legendFontName = 'Helvetica',legendFontColor =	CMYKColor(0.00,0.00,0.00,1.00),titleText = 'Banzai!',titleFontName =  'Helvetica-Bold',titleFontColor =  CMYKColor(0.00,0.00,0.00,1.00),xTitleText = '',xTitleFontName =  'Helvetica',xTitleFontColor = CMYKColor(0.00,0.00,0.00,1.00),yTitleText  = '',yTitleFontName = 'Helvetica',yTitleFontColor =	CMYKColor(0.00,0.00,0.00,1.00),xAxisVisible = 1,xAxisLabelAngle =  30,xAxisFontName = 'Helvetica',xAxisFontColor =	CMYKColor(0.00,0.00,0.00,1.00),yAxisVisible = 1,yAxisFontName =  'Helvetica',yAxisFontColor =  CMYKColor(0.00,0.00,0.00,1.00),xAxisGridLines = 0,yAxisGridLines =  1,dataLabelsType = None,width = 366.00000,height = 347.50000)

	import os, sys
	fn = os.path.join('pmout', 'qctests.html')
	open(fn,'w').write('<html><head></head><body>%s</body></html>' % ('<hr width=100%>'.join(html)))
	if sys.platform=='mac':
		from reportlab.lib.utils import markfilename
		markfilename(fn,ext='HTML')

if __name__=="__main__": #NORUNTESTS
	main()
