# label: Make Stack Plot 
# title: break apart current plot by adding plots and moving plot elements
# This demonstrates how additional functionality can be added to Autoplot.

from org.autoplot.layout import LayoutConstants
p= dom.controller.plot
pp= dom.controller.getPlotElementsFor(p)

recycle= [ p ]

n= len(pp)
i= 0
title= p.title

print 'title=', title

for pp1 in pp:
   if ( pp1.isActive() ):
      if ( len(recycle)>0 ): 
         plot= recycle.pop()
      else:
         plot= dom.controller.addPlot( p, LayoutConstants.BELOW )
         p= plot
         pp1.setPlotId( plot.getId() )
      if ( i!=n-1 ): plot.xaxis.drawTickLabels= False
      if ( i!=n-1 ): plot.title=''
   i=i+1

from org.autoplot.dom import DomOps
DomOps.newCanvasLayout( dom )

