def add_line_chart(self, width, height, labels, data, minv=None, maxv=None): pad = 10 _min, _max = self._find_min_max(data) minv = _min if minv is None else minv maxv = _max if maxv is None else maxv lc = HorizontalLineChart() lc.x = pad * mm lc.y = pad * mm lc.width = (width - 2 * pad) * mm lc.height = (height - 2 * pad) * mm lc.categoryAxis.categoryNames = labels lc.data = data lc.valueAxis.valueMin = minv lc.valueAxis.valueMax = maxv lc.joinedLines = 1 lc.categoryAxis.labels.boxAnchor = "n" lc.lines.strokeWidth = 2 drawing = Drawing(width * mm, height * mm) drawing.hAlign = "CENTER" drawing.add(lc) self.story.append(drawing)
def create_performance_chart(self): chartCanvas = Drawing() chartCanvas.hAlign = 'CENTER' chart = SimpleTimeSeriesPlot() chart.height = 150 chart.width = self.width - 100 chart.lines[0].strokeColor = PCMYKColor(100,0,90,50,alpha=100) chart.lines.strokeWidth = 2 chart.lines[1].strokeColor = PCMYKColor(0,100,100,40,alpha=100) chart.xValueAxis.xLabelFormat = '{mm}/{YY}' chart.data = [[('20120101', 100), ('20120102', 100), ('20120103', 101), ('20120104', 101), ('20120105', 102), ('20120106', 101), ('20120107', 101), ('20120108', 101), ('20120109', 102), ('20120110', 103), ('20120111', 103), ('20120112', 104), ('20120113', 103), ('20120114', 103), ('20120115', 103), ('20120116', 103), ('20120117', 103), ('20120118', 105), ('20120119', 106), ('20120120', 106), ('20120121', 106), ('20120122', 106), ('20120123', 106), ('20120124', 107), ('20120125', 108), ('20120126', 107), ('20120127', 107), ('20120128', 107), ('20120129', 107), ('20120130', 107), ('20120131', 107), ('20120201', 109), ('20120202', 109), ('20120203', 111), ('20120204', 111), ('20120205', 111), ('20120206', 111), ('20120207', 111), ('20120208', 111), ('20120209', 110), ('20120210', 109), ('20120211', 109), ('20120212', 109), ('20120213', 110), ('20120214', 110), ('20120215', 109), ('20120216', 111), ('20120217', 111), ('20120218', 111), ('20120219', 111), ('20120220', 111), ('20120221', 111), ('20120222', 111), ('20120223', 112), ('20120224', 111), ('20120225', 111), ('20120226', 111), ('20120227', 111), ('20120228', 111), ('20120229', 110), ('20120301', 111), ('20120302', 109), ('20120303', 109), ('20120304', 109), ('20120305', 109), ('20120306', 106), ('20120307', 108), ('20120308', 109), ('20120309', 111), ('20120310', 111), ('20120311', 111), ('20120312', 110), ('20120313', 113), ('20120314', 112), ('20120315', 113), ('20120316', 112), ('20120317', 112), ('20120318', 112), ('20120319', 113), ('20120320', 112), ('20120321', 112), ('20120322', 110), ('20120323', 111), ('20120324', 111), ('20120325', 111), ('20120326', 113), ('20120327', 113), ('20120328', 112), ('20120329', 112), ('20120330', 112), ('20120331', 112), ('20120401', 112), ('20120402', 113), ('20120403', 112), ('20120404', 110), ('20120405', 110), ('20120406', 110), ('20120407', 110), ('20120408', 110), ('20120409', 108), ('20120410', 106), ('20120411', 107), ('20120412', 109), ('20120413', 107), ('20120414', 107), ('20120415', 107), ('20120416', 107), ('20120417', 109), ('20120418', 108), ('20120419', 108), ('20120420', 108), ('20120421', 108), ('20120422', 108), ('20120423', 106), ('20120424', 107), ('20120425', 109), ('20120426', 110), ('20120427', 111), ('20120428', 111), ('20120429', 111), ('20120430', 110), ('20120501', 110), ('20120502', 110), ('20120503', 108), ('20120504', 106), ('20120505', 106), ('20120506', 106), ('20120507', 106), ('20120508', 106), ('20120509', 105), ('20120510', 106), ('20120511', 105), ('20120512', 105), ('20120513', 105), ('20120514', 104), ('20120515', 103), ('20120516', 103), ('20120517', 101), ('20120518', 100), ('20120519', 100), ('20120520', 100), ('20120521', 102), ('20120522', 102), ('20120523', 102), ('20120524', 102), ('20120525', 102), ('20120526', 102), ('20120527', 102), ('20120528', 102), ('20120529', 104), ('20120530', 102), ('20120531', 101), ('20120601', 98), ('20120602', 98), ('20120603', 98), ('20120604', 98), ('20120605', 99), ('20120606', 102), ('20120607', 101), ('20120608', 102), ('20120609', 102), ('20120610', 102), ('20120611', 100), ('20120612', 101), ('20120613', 99), ('20120614', 100), ('20120615', 101), ('20120616', 101), ('20120617', 101), ('20120618', 102), ('20120619', 103), ('20120620', 103), ('20120621', 100), ('20120622', 101), ('20120623', 101), ('20120624', 101), ('20120625', 99), ('20120626', 99), ('20120627', 100), ('20120628', 100), ('20120629', 103), ('20120630', 103), ('20120701', 103), ('20120702', 104), ('20120703', 106), ('20120704', 106), ('20120705', 106), ('20120706', 104), ('20120707', 104), ('20120708', 104), ('20120709', 104), ('20120710', 102), ('20120711', 102), ('20120712', 102), ('20120713', 103), ('20120714', 103), ('20120715', 103), ('20120716', 102), ('20120717', 103), ('20120718', 104), ('20120719', 104), ('20120720', 102), ('20120721', 102), ('20120722', 102), ('20120723', 101), ('20120724', 99), ('20120725', 100), ('20120726', 101), ('20120727', 104), ('20120728', 104), ('20120729', 104), ('20120730', 103), ('20120731', 103), ('20120801', 101), ('20120802', 101), ('20120803', 103), ('20120804', 103), ('20120805', 103), ('20120806', 104), ('20120807', 105), ('20120808', 105), ('20120809', 106), ('20120810', 106), ('20120811', 106), ('20120812', 106), ('20120813', 105), ('20120814', 105), ('20120815', 106), ('20120816', 107), ('20120817', 108), ('20120818', 108), ('20120819', 108), ('20120820', 107), ('20120821', 107), ('20120822', 107), ('20120823', 106), ('20120824', 106), ('20120825', 106), ('20120826', 106), ('20120827', 106), ('20120828', 107), ('20120829', 107), ('20120830', 106), ('20120831', 106), ('20120901', 106), ('20120902', 106), ('20120903', 106), ('20120904', 107), ('20120905', 107), ('20120906', 110), ('20120907', 110), ('20120908', 110), ('20120909', 110), ('20120910', 110), ('20120911', 110), ('20120912', 111), ('20120913', 112), ('20120914', 114), ('20120915', 114), ('20120916', 114), ('20120917', 113), ('20120918', 112), ('20120919', 112), ('20120920', 111), ('20120921', 111), ('20120922', 111), ('20120923', 111), ('20120924', 111), ('20120925', 109), ('20120926', 108), ('20120927', 110), ('20120928', 109), ('20120929', 109), ('20120930', 109), ('20121001', 109), ('20121002', 109), ('20121003', 109), ('20121004', 110), ('20121005', 110), ('20121006', 110), ('20121007', 110), ('20121008', 109), ('20121009', 108), ('20121010', 108), ('20121011', 108), ('20121012', 107), ('20121013', 107), ('20121014', 107), ('20121015', 108), ('20121016', 109), ('20121017', 110), ('20121018', 110), ('20121019', 108), ('20121020', 108), ('20121021', 108), ('20121022', 108), ('20121023', 107), ('20121024', 107), ('20121025', 107), ('20121026', 107), ('20121027', 107), ('20121028', 107), ('20121029', 107), ('20121030', 107), ('20121031', 109), ('20121101', 111), ('20121102', 109), ('20121103', 109), ('20121104', 109), ('20121105', 110), ('20121106', 111), ('20121107', 108), ('20121108', 107), ('20121109', 107), ('20121110', 107), ('20121111', 107), ('20121112', 107), ('20121113', 106), ('20121114', 104), ('20121115', 104), ('20121116', 105), ('20121117', 105), ('20121118', 105), ('20121119', 107), ('20121120', 107), ('20121121', 108), ('20121122', 108), ('20121123', 109), ('20121124', 109), ('20121125', 109), ('20121126', 109), ('20121127', 109), ('20121128', 109), ('20121129', 110), ('20121130', 110), ('20121201', 110), ('20121202', 110), ('20121203', 110), ('20121204', 110), ('20121205', 110), ('20121206', 110), ('20121207', 110), ('20121208', 110), ('20121209', 110), ('20121210', 111), ('20121211', 112), ('20121212', 112), ('20121213', 111), ('20121214', 111), ('20121215', 111), ('20121216', 111), ('20121217', 112), ('20121218', 114), ('20121219', 114), ('20121220', 114), ('20121221', 113), ('20121222', 113), ('20121223', 113), ('20121224', 113), ('20121225', 113), ('20121226', 112), ('20121227', 112), ('20121228', 112), ('20121229', 112), ('20121230', 112), ('20121231', 114)], [('20120101', 100), ('20120102', 100), ('20120103', 101), ('20120104', 100), ('20120105', 101), ('20120106', 101), ('20120107', 101), ('20120108', 101), ('20120109', 101), ('20120110', 103), ('20120111', 103), ('20120112', 104), ('20120113', 103), ('20120114', 103), ('20120115', 103), ('20120116', 103), ('20120117', 103), ('20120118', 105), ('20120119', 105), ('20120120', 105), ('20120121', 105), ('20120122', 105), ('20120123', 105), ('20120124', 106), ('20120125', 107), ('20120126', 107), ('20120127', 107), ('20120128', 107), ('20120129', 107), ('20120130', 107), ('20120131', 107), ('20120201', 109), ('20120202', 109), ('20120203', 112), ('20120204', 112), ('20120205', 112), ('20120206', 111), ('20120207', 111), ('20120208', 111), ('20120209', 111), ('20120210', 109), ('20120211', 109), ('20120212', 109), ('20120213', 111), ('20120214', 110), ('20120215', 109), ('20120216', 112), ('20120217', 111), ('20120218', 111), ('20120219', 111), ('20120220', 111), ('20120221', 111), ('20120222', 110), ('20120223', 112), ('20120224', 111), ('20120225', 111), ('20120226', 111), ('20120227', 111), ('20120228', 111), ('20120229', 109), ('20120301', 110), ('20120302', 108), ('20120303', 108), ('20120304', 108), ('20120305', 108), ('20120306', 106), ('20120307', 107), ('20120308', 109), ('20120309', 110), ('20120310', 110), ('20120311', 110), ('20120312', 110), ('20120313', 112), ('20120314', 111), ('20120315', 112), ('20120316', 112), ('20120317', 112), ('20120318', 112), ('20120319', 113), ('20120320', 112), ('20120321', 112), ('20120322', 111), ('20120323', 112), ('20120324', 112), ('20120325', 112), ('20120326', 114), ('20120327', 113), ('20120328', 112), ('20120329', 112), ('20120330', 112), ('20120331', 112), ('20120401', 112), ('20120402', 113), ('20120403', 113), ('20120404', 111), ('20120405', 110), ('20120406', 110), ('20120407', 110), ('20120408', 110), ('20120409', 108), ('20120410', 106), ('20120411', 107), ('20120412', 109), ('20120413', 107), ('20120414', 107), ('20120415', 107), ('20120416', 108), ('20120417', 109), ('20120418', 108), ('20120419', 108), ('20120420', 108), ('20120421', 108), ('20120422', 108), ('20120423', 107), ('20120424', 108), ('20120425', 110), ('20120426', 110), ('20120427', 111), ('20120428', 111), ('20120429', 111), ('20120430', 110), ('20120501', 110), ('20120502', 110), ('20120503', 109), ('20120504', 107), ('20120505', 107), ('20120506', 107), ('20120507', 107), ('20120508', 107), ('20120509', 106), ('20120510', 107), ('20120511', 107), ('20120512', 107), ('20120513', 107), ('20120514', 105), ('20120515', 105), ('20120516', 104), ('20120517', 102), ('20120518', 101), ('20120519', 101), ('20120520', 101), ('20120521', 103), ('20120522', 103), ('20120523', 103), ('20120524', 103), ('20120525', 103), ('20120526', 103), ('20120527', 103), ('20120528', 103), ('20120529', 105), ('20120530', 103), ('20120531', 103), ('20120601', 100), ('20120602', 100), ('20120603', 100), ('20120604', 100), ('20120605', 101), ('20120606', 103), ('20120607', 103), ('20120608', 104), ('20120609', 104), ('20120610', 104), ('20120611', 101), ('20120612', 103), ('20120613', 102), ('20120614', 103), ('20120615', 104), ('20120616', 104), ('20120617', 104), ('20120618', 104), ('20120619', 106), ('20120620', 106), ('20120621', 103), ('20120622', 105), ('20120623', 105), ('20120624', 105), ('20120625', 103), ('20120626', 103), ('20120627', 105), ('20120628', 105), ('20120629', 108), ('20120630', 108), ('20120701', 108), ('20120702', 109), ('20120703', 111), ('20120704', 111), ('20120705', 111), ('20120706', 109), ('20120707', 109), ('20120708', 109), ('20120709', 109), ('20120710', 108), ('20120711', 107), ('20120712', 107), ('20120713', 108), ('20120714', 108), ('20120715', 108), ('20120716', 108), ('20120717', 108), ('20120718', 109), ('20120719', 109), ('20120720', 107), ('20120721', 107), ('20120722', 107), ('20120723', 105), ('20120724', 104), ('20120725', 104), ('20120726', 105), ('20120727', 108), ('20120728', 108), ('20120729', 108), ('20120730', 107), ('20120731', 107), ('20120801', 104), ('20120802', 104), ('20120803', 107), ('20120804', 107), ('20120805', 107), ('20120806', 108), ('20120807', 109), ('20120808', 108), ('20120809', 109), ('20120810', 109), ('20120811', 109), ('20120812', 109), ('20120813', 108), ('20120814', 108), ('20120815', 109), ('20120816', 110), ('20120817', 111), ('20120818', 111), ('20120819', 111), ('20120820', 111), ('20120821', 110), ('20120822', 110), ('20120823', 109), ('20120824', 110), ('20120825', 110), ('20120826', 110), ('20120827', 110), ('20120828', 110), ('20120829', 111), ('20120830', 110), ('20120831', 110), ('20120901', 110), ('20120902', 110), ('20120903', 110), ('20120904', 111), ('20120905', 111), ('20120906', 114), ('20120907', 114), ('20120908', 114), ('20120909', 114), ('20120910', 114), ('20120911', 114), ('20120912', 115), ('20120913', 116), ('20120914', 117), ('20120915', 117), ('20120916', 117), ('20120917', 117), ('20120918', 116), ('20120919', 116), ('20120920', 116), ('20120921', 116), ('20120922', 116), ('20120923', 116), ('20120924', 116), ('20120925', 114), ('20120926', 113), ('20120927', 115), ('20120928', 114), ('20120929', 114), ('20120930', 114), ('20121001', 114), ('20121002', 114), ('20121003', 114), ('20121004', 115), ('20121005', 114), ('20121006', 114), ('20121007', 114), ('20121008', 114), ('20121009', 112), ('20121010', 112), ('20121011', 113), ('20121012', 112), ('20121013', 112), ('20121014', 112), ('20121015', 113), ('20121016', 113), ('20121017', 114), ('20121018', 114), ('20121019', 112), ('20121020', 112), ('20121021', 112), ('20121022', 111), ('20121023', 111), ('20121024', 111), ('20121025', 111), ('20121026', 110), ('20121027', 110), ('20121028', 110), ('20121029', 110), ('20121030', 110), ('20121031', 111), ('20121101', 113), ('20121102', 111), ('20121103', 111), ('20121104', 111), ('20121105', 111), ('20121106', 112), ('20121107', 109), ('20121108', 108), ('20121109', 108), ('20121110', 108), ('20121111', 108), ('20121112', 108), ('20121113', 107), ('20121114', 105), ('20121115', 105), ('20121116', 106), ('20121117', 106), ('20121118', 106), ('20121119', 108), ('20121120', 108), ('20121121', 109), ('20121122', 109), ('20121123', 110), ('20121124', 110), ('20121125', 110), ('20121126', 110), ('20121127', 110), ('20121128', 111), ('20121129', 112), ('20121130', 112), ('20121201', 112), ('20121202', 112), ('20121203', 112), ('20121204', 112), ('20121205', 112), ('20121206', 112), ('20121207', 112), ('20121208', 112), ('20121209', 112), ('20121210', 112), ('20121211', 114), ('20121212', 113), ('20121213', 112), ('20121214', 112), ('20121215', 112), ('20121216', 112), ('20121217', 114), ('20121218', 115), ('20121219', 116), ('20121220', 116), ('20121221', 116), ('20121222', 116), ('20121223', 116), ('20121224', 115), ('20121225', 115), ('20121226', 114), ('20121227', 114), ('20121228', 113), ('20121229', 113), ('20121230', 113), ('20121231', 116)]] chartCanvas.add(chart) renderPDF.draw(chartCanvas, self.c, 40, self.height - 400)
def add_pie_chart(self, width, height, labels, data, side_labels=False): pad = 15 pc = Pie() pc.x = pad * mm pc.y = pad * mm pc.width = (width - 2 * pad) * mm pc.height = (height - 2 * pad) * mm pc.labels = labels pc.data = data pc.sideLabels = side_labels drawing = Drawing(width * mm, height * mm) drawing.hAlign = "CENTER" drawing.add(pc) self.story.append(drawing)
def add_bar_chart(self, width, height, labels, data, minv=None, maxv=None): pad = 10 _min, _max = self._find_min_max(data) minv = _min if minv is None else minv maxv = _max if maxv is None else maxv bc = VerticalBarChart() bc.x = pad * mm bc.y = pad * mm bc.width = (width - 2 * pad) * mm bc.height = (height - 2 * pad) * mm bc.categoryAxis.categoryNames = labels bc.data = data bc.valueAxis.valueMin = minv bc.valueAxis.valueMax = maxv drawing = Drawing(width * mm, height * mm) drawing.hAlign = "CENTER" drawing.add(bc) self.story.append(drawing)
headerCanvas = Drawing() headerRect = Rect(0, 0, width=650, height=50) headerRect.fillColor = HexColor("#607D8B") headerRect.strokeColor = HexColor("#607D8B") headerCanvas.add(headerRect) renderPDF.draw(headerCanvas, c, 0, 750) c.drawImage("kit-logo.png", 50, 650, width=100, height=100) headerText = c.beginText(200, 750) headerText.textLine("Header Test Text") c.drawText(headerText) chartCanvas = Drawing() chartCanvas.hAlign = 'CENTER' chart = SimpleTimeSeriesPlot() chart.height = 150 chart.width = 500 chart.lines[0].strokeColor = PCMYKColor(100,0,90,50,alpha=100) chart.lines.strokeWidth = 2 chart.lines[1].strokeColor = PCMYKColor(0,100,100,40,alpha=100) chart.xValueAxis.xLabelFormat = '{mm}/{YY}' chart.data = [[('20120101', 100), ('20120102', 100), ('20120103', 101), ('20120104', 101), ('20120105', 102), ('20120106', 101), ('20120107', 101), ('20120108', 101), ('20120109', 102), ('20120110', 103), ('20120111', 103), ('20120112', 104), ('20120113', 103), ('20120114', 103), ('20120115', 103), ('20120116', 103), ('20120117', 103), ('20120118', 105), ('20120119', 106), ('20120120', 106), ('20120121', 106), ('20120122', 106), ('20120123', 106), ('20120124', 107), ('20120125', 108), ('20120126', 107), ('20120127', 107), ('20120128', 107), ('20120129', 107), ('20120130', 107), ('20120131', 107), ('20120201', 109), ('20120202', 109), ('20120203', 111), ('20120204', 111), ('20120205', 111), ('20120206', 111), ('20120207', 111), ('20120208', 111), ('20120209', 110), ('20120210', 109), ('20120211', 109), ('20120212', 109), ('20120213', 110), ('20120214', 110), ('20120215', 109), ('20120216', 111), ('20120217', 111), ('20120218', 111), ('20120219', 111), ('20120220', 111), ('20120221', 111), ('20120222', 111), ('20120223', 112), ('20120224', 111), ('20120225', 111), ('20120226', 111), ('20120227', 111), ('20120228', 111), ('20120229', 110), ('20120301', 111), ('20120302', 109), ('20120303', 109), ('20120304', 109), ('20120305', 109), ('20120306', 106), ('20120307', 108), ('20120308', 109), ('20120309', 111), ('20120310', 111), ('20120311', 111), ('20120312', 110), ('20120313', 113), ('20120314', 112), ('20120315', 113), ('20120316', 112), ('20120317', 112), ('20120318', 112), ('20120319', 113), ('20120320', 112), ('20120321', 112), ('20120322', 110), ('20120323', 111), ('20120324', 111), ('20120325', 111), ('20120326', 113), ('20120327', 113), ('20120328', 112), ('20120329', 112), ('20120330', 112), ('20120331', 112), ('20120401', 112), ('20120402', 113), ('20120403', 112), ('20120404', 110), ('20120405', 110), ('20120406', 110), ('20120407', 110), ('20120408', 110), ('20120409', 108), ('20120410', 106), ('20120411', 107), ('20120412', 109), ('20120413', 107), ('20120414', 107), ('20120415', 107), ('20120416', 107), ('20120417', 109), ('20120418', 108), ('20120419', 108), ('20120420', 108), ('20120421', 108), ('20120422', 108), ('20120423', 106), ('20120424', 107), ('20120425', 109), ('20120426', 110), ('20120427', 111), ('20120428', 111), ('20120429', 111), ('20120430', 110), ('20120501', 110), ('20120502', 110), ('20120503', 108), ('20120504', 106), ('20120505', 106), ('20120506', 106), ('20120507', 106), ('20120508', 106), ('20120509', 105), ('20120510', 106), ('20120511', 105), ('20120512', 105), ('20120513', 105), ('20120514', 104), ('20120515', 103), ('20120516', 103), ('20120517', 101), ('20120518', 100), ('20120519', 100), ('20120520', 100), ('20120521', 102), ('20120522', 102), ('20120523', 102), ('20120524', 102), ('20120525', 102), ('20120526', 102), ('20120527', 102), ('20120528', 102), ('20120529', 104), ('20120530', 102), ('20120531', 101), ('20120601', 98), ('20120602', 98), ('20120603', 98), ('20120604', 98), ('20120605', 99), ('20120606', 102), ('20120607', 101), ('20120608', 102), ('20120609', 102), ('20120610', 102), ('20120611', 100), ('20120612', 101), ('20120613', 99), ('20120614', 100), ('20120615', 101), ('20120616', 101), ('20120617', 101), ('20120618', 102), ('20120619', 103), ('20120620', 103), ('20120621', 100), ('20120622', 101), ('20120623', 101), ('20120624', 101), ('20120625', 99), ('20120626', 99), ('20120627', 100), ('20120628', 100), ('20120629', 103), ('20120630', 103), ('20120701', 103), ('20120702', 104), ('20120703', 106), ('20120704', 106), ('20120705', 106), ('20120706', 104), ('20120707', 104), ('20120708', 104), ('20120709', 104), ('20120710', 102), ('20120711', 102), ('20120712', 102), ('20120713', 103), ('20120714', 103), ('20120715', 103), ('20120716', 102), ('20120717', 103), ('20120718', 104), ('20120719', 104), ('20120720', 102), ('20120721', 102), ('20120722', 102), ('20120723', 101), ('20120724', 99), ('20120725', 100), ('20120726', 101), ('20120727', 104), ('20120728', 104), ('20120729', 104), ('20120730', 103), ('20120731', 103), ('20120801', 101), ('20120802', 101), ('20120803', 103), ('20120804', 103), ('20120805', 103), ('20120806', 104), ('20120807', 105), ('20120808', 105), ('20120809', 106), ('20120810', 106), ('20120811', 106), ('20120812', 106), ('20120813', 105), ('20120814', 105), ('20120815', 106), ('20120816', 107), ('20120817', 108), ('20120818', 108), ('20120819', 108), ('20120820', 107), ('20120821', 107), ('20120822', 107), ('20120823', 106), ('20120824', 106), ('20120825', 106), ('20120826', 106), ('20120827', 106), ('20120828', 107), ('20120829', 107), ('20120830', 106), ('20120831', 106), ('20120901', 106), ('20120902', 106), ('20120903', 106), ('20120904', 107), ('20120905', 107), ('20120906', 110), ('20120907', 110), ('20120908', 110), ('20120909', 110), ('20120910', 110), ('20120911', 110), ('20120912', 111), ('20120913', 112), ('20120914', 114), ('20120915', 114), ('20120916', 114), ('20120917', 113), ('20120918', 112), ('20120919', 112), ('20120920', 111), ('20120921', 111), ('20120922', 111), ('20120923', 111), ('20120924', 111), ('20120925', 109), ('20120926', 108), ('20120927', 110), ('20120928', 109), ('20120929', 109), ('20120930', 109), ('20121001', 109), ('20121002', 109), ('20121003', 109), ('20121004', 110), ('20121005', 110), ('20121006', 110), ('20121007', 110), ('20121008', 109), ('20121009', 108), ('20121010', 108), ('20121011', 108), ('20121012', 107), ('20121013', 107), ('20121014', 107), ('20121015', 108), ('20121016', 109), ('20121017', 110), ('20121018', 110), ('20121019', 108), ('20121020', 108), ('20121021', 108), ('20121022', 108), ('20121023', 107), ('20121024', 107), ('20121025', 107), ('20121026', 107), ('20121027', 107), ('20121028', 107), ('20121029', 107), ('20121030', 107), ('20121031', 109), ('20121101', 111), ('20121102', 109), ('20121103', 109), ('20121104', 109), ('20121105', 110), ('20121106', 111), ('20121107', 108), ('20121108', 107), ('20121109', 107), ('20121110', 107), ('20121111', 107), ('20121112', 107), ('20121113', 106), ('20121114', 104), ('20121115', 104), ('20121116', 105), ('20121117', 105), ('20121118', 105), ('20121119', 107), ('20121120', 107), ('20121121', 108), ('20121122', 108), ('20121123', 109), ('20121124', 109), ('20121125', 109), ('20121126', 109), ('20121127', 109), ('20121128', 109), ('20121129', 110), ('20121130', 110), ('20121201', 110), ('20121202', 110), ('20121203', 110), ('20121204', 110), ('20121205', 110), ('20121206', 110), ('20121207', 110), ('20121208', 110), ('20121209', 110), ('20121210', 111), ('20121211', 112), ('20121212', 112), ('20121213', 111), ('20121214', 111), ('20121215', 111), ('20121216', 111), ('20121217', 112), ('20121218', 114), ('20121219', 114), ('20121220', 114), ('20121221', 113), ('20121222', 113), ('20121223', 113), ('20121224', 113), ('20121225', 113), ('20121226', 112), ('20121227', 112), ('20121228', 112), ('20121229', 112), ('20121230', 112), ('20121231', 114)], [('20120101', 100), ('20120102', 100), ('20120103', 101), ('20120104', 100), ('20120105', 101), ('20120106', 101), ('20120107', 101), ('20120108', 101), ('20120109', 101), ('20120110', 103), ('20120111', 103), ('20120112', 104), ('20120113', 103), ('20120114', 103), ('20120115', 103), ('20120116', 103), ('20120117', 103), ('20120118', 105), ('20120119', 105), ('20120120', 105), ('20120121', 105), ('20120122', 105), ('20120123', 105), ('20120124', 106), ('20120125', 107), ('20120126', 107), ('20120127', 107), ('20120128', 107), ('20120129', 107), ('20120130', 107), ('20120131', 107), ('20120201', 109), ('20120202', 109), ('20120203', 112), ('20120204', 112), ('20120205', 112), ('20120206', 111), ('20120207', 111), ('20120208', 111), ('20120209', 111), ('20120210', 109), ('20120211', 109), ('20120212', 109), ('20120213', 111), ('20120214', 110), ('20120215', 109), ('20120216', 112), ('20120217', 111), ('20120218', 111), ('20120219', 111), ('20120220', 111), ('20120221', 111), ('20120222', 110), ('20120223', 112), ('20120224', 111), ('20120225', 111), ('20120226', 111), ('20120227', 111), ('20120228', 111), ('20120229', 109), ('20120301', 110), ('20120302', 108), ('20120303', 108), ('20120304', 108), ('20120305', 108), ('20120306', 106), ('20120307', 107), ('20120308', 109), ('20120309', 110), ('20120310', 110), ('20120311', 110), ('20120312', 110), ('20120313', 112), ('20120314', 111), ('20120315', 112), ('20120316', 112), ('20120317', 112), ('20120318', 112), ('20120319', 113), ('20120320', 112), ('20120321', 112), ('20120322', 111), ('20120323', 112), ('20120324', 112), ('20120325', 112), ('20120326', 114), ('20120327', 113), ('20120328', 112), ('20120329', 112), ('20120330', 112), ('20120331', 112), ('20120401', 112), ('20120402', 113), ('20120403', 113), ('20120404', 111), ('20120405', 110), ('20120406', 110), ('20120407', 110), ('20120408', 110), ('20120409', 108), ('20120410', 106), ('20120411', 107), ('20120412', 109), ('20120413', 107), ('20120414', 107), ('20120415', 107), ('20120416', 108), ('20120417', 109), ('20120418', 108), ('20120419', 108), ('20120420', 108), ('20120421', 108), ('20120422', 108), ('20120423', 107), ('20120424', 108), ('20120425', 110), ('20120426', 110), ('20120427', 111), ('20120428', 111), ('20120429', 111), ('20120430', 110), ('20120501', 110), ('20120502', 110), ('20120503', 109), ('20120504', 107), ('20120505', 107), ('20120506', 107), ('20120507', 107), ('20120508', 107), ('20120509', 106), ('20120510', 107), ('20120511', 107), ('20120512', 107), ('20120513', 107), ('20120514', 105), ('20120515', 105), ('20120516', 104), ('20120517', 102), ('20120518', 101), ('20120519', 101), ('20120520', 101), ('20120521', 103), ('20120522', 103), ('20120523', 103), ('20120524', 103), ('20120525', 103), ('20120526', 103), ('20120527', 103), ('20120528', 103), ('20120529', 105), ('20120530', 103), ('20120531', 103), ('20120601', 100), ('20120602', 100), ('20120603', 100), ('20120604', 100), ('20120605', 101), ('20120606', 103), ('20120607', 103), ('20120608', 104), ('20120609', 104), ('20120610', 104), ('20120611', 101), ('20120612', 103), ('20120613', 102), ('20120614', 103), ('20120615', 104), ('20120616', 104), ('20120617', 104), ('20120618', 104), ('20120619', 106), ('20120620', 106), ('20120621', 103), ('20120622', 105), ('20120623', 105), ('20120624', 105), ('20120625', 103), ('20120626', 103), ('20120627', 105), ('20120628', 105), ('20120629', 108), ('20120630', 108), ('20120701', 108), ('20120702', 109), ('20120703', 111), ('20120704', 111), ('20120705', 111), ('20120706', 109), ('20120707', 109), ('20120708', 109), ('20120709', 109), ('20120710', 108), ('20120711', 107), ('20120712', 107), ('20120713', 108), ('20120714', 108), ('20120715', 108), ('20120716', 108), ('20120717', 108), ('20120718', 109), ('20120719', 109), ('20120720', 107), ('20120721', 107), ('20120722', 107), ('20120723', 105), ('20120724', 104), ('20120725', 104), ('20120726', 105), ('20120727', 108), ('20120728', 108), ('20120729', 108), ('20120730', 107), ('20120731', 107), ('20120801', 104), ('20120802', 104), ('20120803', 107), ('20120804', 107), ('20120805', 107), ('20120806', 108), ('20120807', 109), ('20120808', 108), ('20120809', 109), ('20120810', 109), ('20120811', 109), ('20120812', 109), ('20120813', 108), ('20120814', 108), ('20120815', 109), ('20120816', 110), ('20120817', 111), ('20120818', 111), ('20120819', 111), ('20120820', 111), ('20120821', 110), ('20120822', 110), ('20120823', 109), ('20120824', 110), ('20120825', 110), ('20120826', 110), ('20120827', 110), ('20120828', 110), ('20120829', 111), ('20120830', 110), ('20120831', 110), ('20120901', 110), ('20120902', 110), ('20120903', 110), ('20120904', 111), ('20120905', 111), ('20120906', 114), ('20120907', 114), ('20120908', 114), ('20120909', 114), ('20120910', 114), ('20120911', 114), ('20120912', 115), ('20120913', 116), ('20120914', 117), ('20120915', 117), ('20120916', 117), ('20120917', 117), ('20120918', 116), ('20120919', 116), ('20120920', 116), ('20120921', 116), ('20120922', 116), ('20120923', 116), ('20120924', 116), ('20120925', 114), ('20120926', 113), ('20120927', 115), ('20120928', 114), ('20120929', 114), ('20120930', 114), ('20121001', 114), ('20121002', 114), ('20121003', 114), ('20121004', 115), ('20121005', 114), ('20121006', 114), ('20121007', 114), ('20121008', 114), ('20121009', 112), ('20121010', 112), ('20121011', 113), ('20121012', 112), ('20121013', 112), ('20121014', 112), ('20121015', 113), ('20121016', 113), ('20121017', 114), ('20121018', 114), ('20121019', 112), ('20121020', 112), ('20121021', 112), ('20121022', 111), ('20121023', 111), ('20121024', 111), ('20121025', 111), ('20121026', 110), ('20121027', 110), ('20121028', 110), ('20121029', 110), ('20121030', 110), ('20121031', 111), ('20121101', 113), ('20121102', 111), ('20121103', 111), ('20121104', 111), ('20121105', 111), ('20121106', 112), ('20121107', 109), ('20121108', 108), ('20121109', 108), ('20121110', 108), ('20121111', 108), ('20121112', 108), ('20121113', 107), ('20121114', 105), ('20121115', 105), ('20121116', 106), ('20121117', 106), ('20121118', 106), ('20121119', 108), ('20121120', 108), ('20121121', 109), ('20121122', 109), ('20121123', 110), ('20121124', 110), ('20121125', 110), ('20121126', 110), ('20121127', 110), ('20121128', 111), ('20121129', 112), ('20121130', 112), ('20121201', 112), ('20121202', 112), ('20121203', 112), ('20121204', 112), ('20121205', 112), ('20121206', 112), ('20121207', 112), ('20121208', 112), ('20121209', 112), ('20121210', 112), ('20121211', 114), ('20121212', 113), ('20121213', 112), ('20121214', 112), ('20121215', 112), ('20121216', 112), ('20121217', 114), ('20121218', 115), ('20121219', 116), ('20121220', 116), ('20121221', 116), ('20121222', 116), ('20121223', 116), ('20121224', 115), ('20121225', 115), ('20121226', 114), ('20121227', 114), ('20121228', 113), ('20121229', 113), ('20121230', 113), ('20121231', 116)]] chartCanvas.add(chart) renderPDF.draw(chartCanvas, c, 50, 400) pieChartCanvas = Drawing() pieChart = Pie() pieChart.data = [30.0, 21.0, 21.0, 14.0, 14.0] pieChart.slices[0].fillColor = PCMYKColor(100,0,90,50,alpha=85)
def isometric_view(job): """Return a Drawing with an isometric view of a single cabinet.""" # Determine the width and height required for the drawing. The distances # below are all in points, unless noted otherwise. top_margin = 10 # Extra width added so long vdim text doesn't go past right edge. long_vdimtxt_margin = 30 # The length of the dimension bounds lines. boundsln_len = 14 # If the bounds line is angled, half of its vertical projection. half_boundsln_vert = math.sqrt((boundsln_len / 2)**2 / 2) # The separation of the arrowhead from the nearest cabinet corner. arrow_sep = 18 # If the arrow separation is angled, its vertical projection. arrow_sep_vert = math.sqrt(arrow_sep**2 / 2) # The horizontal projection is the same, since the angle is 45 degrees. arrow_sep_horiz = arrow_sep_vert # The horizontal (or vertical, since they are equal) projection of the # angled cabinet depth lines -- in inches, unscaled. iso45 = math.sin(math.radians(45)) * job.cabs.cabinet_depth / 2 # Overall drawing width and height d_width = ((job.cabs.cabinet_width + iso45) * inch * DEFAULT_ISO_SCALE + arrow_sep + boundsln_len / 2 + long_vdimtxt_margin) d_ht = ((job.cabs.cabinet_height + iso45) * inch * DEFAULT_ISO_SCALE + arrow_sep_vert + half_boundsln_vert + top_margin) result = Drawing(d_width, d_ht) result.hAlign = 'CENTER' # The horizontal (or vertical, since they are equal) projection of the # angled topnailer depth lines -- in inches, unscaled. isoNlr45 = job.cabs.topnailer_depth * math.sin(math.radians(45)) / 2 # Construct a list of the lines that make up the isometric view. Each line # is a tuple in (x1, y1, x2, y2) format, and all coordinates are in inches, # unscaled. These are converted to points and then scaled, below. isoLines = [ # horizontal lines----------------------------------------------------- # horizontal bottom inner line (job.cabs.side_thickness, job.cabs.bottom_thickness, job.cabs.cabinet_width - job.cabs.side_thickness, job.cabs.bottom_thickness), # Front nailer - front edge bottom (job.cabs.side_thickness, job.cabs.cabinet_height - job.cabs.topnailer_thickness, job.cabs.cabinet_width - job.cabs.side_thickness, job.cabs.cabinet_height - job.cabs.topnailer_thickness), # Back panel top rear edge (iso45, job.cabs.cabinet_height + iso45, iso45 + job.cabs.cabinet_width, iso45 + job.cabs.cabinet_height), # Back panel top front edge (iso45 - job.cabs.back_thickness * math.sin(math.radians(45)), job.cabs.cabinet_height + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)), job.cabs.cabinet_width + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)), job.cabs.cabinet_height + iso45 - job.cabs.back_thickness * math.sin(math.radians(45))), # horizontal inside at bottom back (iso45, iso45, job.cabs.cabinet_width - job.cabs.side_thickness, iso45 ), # Front nailer - top rear edge (job.cabs.side_thickness + isoNlr45, job.cabs.cabinet_height + isoNlr45, job.cabs.cabinet_width - job.cabs.side_thickness + isoNlr45, job.cabs.cabinet_height + isoNlr45), # Back nailer - top front edge (job.cabs.side_thickness + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)) - isoNlr45, job.cabs.cabinet_height + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)) - isoNlr45, job.cabs.cabinet_width - job.cabs.side_thickness + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)) - isoNlr45, job.cabs.cabinet_height + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)) - isoNlr45), # Back nailer - bottom front edge (job.cabs.side_thickness + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)) - isoNlr45, job.cabs.cabinet_height + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)) - isoNlr45 - job.cabs.topnailer_thickness, job.cabs.cabinet_width - job.cabs.side_thickness + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)) - isoNlr45 - job.cabs.topnailer_thickness, job.cabs.cabinet_height + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)) - isoNlr45 - job.cabs.topnailer_thickness), # Vertical lines------------------------------------------------------- # Vertical left inner line (job.cabs.side_thickness, 0, job.cabs.side_thickness, job.cabs.cabinet_height), # Vertical right inner line (job.cabs.cabinet_width - job.cabs.side_thickness, 0, job.cabs.cabinet_width - job.cabs.side_thickness, job.cabs.cabinet_height), # Vertical right back (job.cabs.cabinet_width + iso45, iso45, job.cabs.cabinet_width + iso45, job.cabs.cabinet_height + iso45), # Vertical right back inner (job.cabs.cabinet_width + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)), iso45 - job.cabs.back_thickness * math.sin(math.radians(45)), job.cabs.cabinet_width + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)), job.cabs.cabinet_height + iso45 - job.cabs.back_thickness * math.sin(math.radians(45))), # Back nailer - front left edge (job.cabs.side_thickness + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)) - isoNlr45, job.cabs.cabinet_height + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)) - isoNlr45 - job.cabs.topnailer_thickness, job.cabs.side_thickness + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)) - isoNlr45, job.cabs.cabinet_height + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)) - isoNlr45), # Vertical inside line between nailers (iso45, job.cabs.cabinet_height + isoNlr45, iso45, job.cabs.cabinet_height + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)) - isoNlr45 - job.cabs.topnailer_thickness), # Vertical inside line at back of left side (iso45, iso45, iso45, job.cabs.cabinet_height - job.cabs.topnailer_thickness), # Angled lines--------------------------------------------------------- # Iso bottom left inner angle (job.cabs.side_thickness, job.cabs.bottom_thickness, iso45, iso45), # Iso upper left angle (0, job.cabs.cabinet_height, iso45, job.cabs.cabinet_height + iso45), # Iso upper left angle inner (job.cabs.side_thickness, job.cabs.cabinet_height, job.cabs.side_thickness + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)), job.cabs.cabinet_height + iso45 - job.cabs.back_thickness * math.sin(math.radians(45))), # Iso upper right angle (job.cabs.cabinet_width, job.cabs.cabinet_height, job.cabs.cabinet_width + iso45, job.cabs.cabinet_height + iso45), # Iso upper right angle inner (job.cabs.cabinet_width - job.cabs.side_thickness, job.cabs.cabinet_height, job.cabs.cabinet_width - job.cabs.side_thickness + iso45 - job.cabs.back_thickness * math.sin(math.radians(45)), job.cabs.cabinet_height + iso45 - job.cabs.back_thickness * math.sin(math.radians(45))), # Iso lower right angle (job.cabs.cabinet_width, 0, job.cabs.cabinet_width + iso45, iso45), # Front cabinet rectangle lines (originally drawn as a Rect) # Horizontal bottom line (0, 0, job.cabs.cabinet_width, 0), # Horizontal top line (0, job.cabs.cabinet_height, job.cabs.cabinet_width, job.cabs.cabinet_height), # Vertical left line (0, 0, 0, job.cabs.cabinet_height), # Vertical right line (job.cabs.cabinet_width, 0, job.cabs.cabinet_width, job.cabs.cabinet_height) ] isoLines_pts = [inches_to_pts(line) for line in isoLines] isoLines_scaled = [(coord * DEFAULT_ISO_SCALE for coord in line) for line in isoLines_pts] for line in isoLines_scaled: result.add(Line(*line, strokeWidth=0.5)) # Height dimension arrow vdim = job.cabs.cabinet_height # (x,y) of back right bottom of cabinet, scaled brb_x_scaled = (job.cabs.cabinet_width + iso45) * inch * DEFAULT_ISO_SCALE brb_y_scaled = iso45 * inch * DEFAULT_ISO_SCALE arr = vdimarrow_iso_str(vdim, DEFAULT_ISO_SCALE, brb_x_scaled + arrow_sep_horiz, brb_y_scaled + arrow_sep_vert, 0.67, boundsln_len) result.add(arr) # Width dimension arrow hdim = job.cabs.cabinet_width # (x,y) of back left top of cabinet, scaled blt_x_scaled = iso45 * inch * DEFAULT_ISO_SCALE blt_y_scaled = (job.cabs.cabinet_height + iso45) * inch * DEFAULT_ISO_SCALE arr = hdimarrow_iso_str(hdim, DEFAULT_ISO_SCALE, blt_x_scaled + arrow_sep_horiz, blt_y_scaled + arrow_sep_vert, 0.67, boundsln_len) result.add(arr) # Depth dimension arrow ddim = job.cabs.cabinet_depth - job.cabs.door_thickness - DOOR_HINGE_GAP cabwidth_scaled = job.cabs.cabinet_width * inch * DEFAULT_ISO_SCALE arr = ddimarrow_iso_str(ddim, DEFAULT_ISO_SCALE, cabwidth_scaled + arrow_sep, 0, 0.67, boundsln_len) result.add(arr) return result