"Vertical bar chart with mixed stacked & parallel bars" #Autogenerated by ReportLab guiedit do not edit from reportlab.graphics.charts.barcharts import VerticalBarChart from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin from reportlab.lib.colors import blue from reportlab.graphics.charts.textlabels import Label class VBCMixedStackedParallel(_DrawingEditorMixin,Drawing): """ Chart Features -------------- This is a simple vertical barchart with mixed stacked & parallel bars - The attributes which control the label position in this case are **chart.categoryAxis.style='mixed' and .chart.seriesOrder=((0,),(0,1)) The mixed style uses seriedOrder to determine both sequence and structure, each subtuple indicates a stacked bar, the integers indicate which series is used. Series may be repeated, missing series are added at the end as unstacked bars. This chart was built with our [Diagra](http://www.reportlab.com/software/diagra/) solution. Not the kind of chart you looking for? Go [up](..) for more charts, or to see different types of charts click on [ReportLab Charts Gallery](/chartgallery/). """ def __init__(self,width=400,height=200,*args,**kw): Drawing.__init__(self,width,height,*args,**kw) self._add(self,VerticalBarChart(),name='chart',validate=None,desc=None) self.chart.x = 30 self.chart.y = 20 self.chart.width=self.width - self.chart.x -10 self.chart.height=self.height - self.chart.y -10 self.chart.reversePlotOrder = 0 self.chart.valueAxis.forceZero = 1 self.chart.seriesOrder=((0,),(0,1)) self.chart.categoryAxis.style='mixed' self.chart.barSpacing = 1 self.chart.data =[(10.8,9.6,9,7.9),(0.5,0.7,0.5,0.7)] self.chart.bars[2].fillColor = blue.clone(alpha=0.8) self.chart.data = [(10.8, 9.6, 9, 7.9), (0.5, 0.7, 0.6, 0.9)] self.chart.categoryAxis.categoryNames = ['A','B','C','D'] self._add(self,Label(),name='vaxisl',validate=None,desc=None) self.vaxisl.fontName = 'Helvetica' self.vaxisl._text='Widgets' self.vaxisl.boxAnchor='s' self.vaxisl.angle = 90 self.vaxisl.x = 12 self.vaxisl.y=(self.chart.y+self.chart.height*0.5) if __name__=="__main__": #NORUNTESTS VBCMixedStackedParallel().save(formats=['pdf'],outDir='.',fnRoot=None)