Output containers are objects that hold a collection of other objects, and displays all its contents, even when they are complex interactive objects and MIME type. By default the contents are just stacked up on the page, but you can configure them to get tabs, a grid, or cycling.
In [ ]:
from beakerx import *
o = OutputContainer()
o.addItem("simplest example")
o.addItem([2, 3, 5, 7])
o.addItem(HTML("<h1>title</h1>"))
o.addItem(None)
o
In [ ]:
rates = pd.read_csv('../resources/data/interest-rates.csv')
c = Color(120, 120, 120, 100)
plot1 = Plot(initWidth= 300, initHeight= 400)
plot1.add(Points(x= rates.y1, y=rates.y30, size= 3, displayName="y1 vs y30"))
plot1.add(Line(x= rates.y1, y=rates.y30, color= c))
plot1.add(Points(x= rates.m3, y=rates.y5, size= 3, displayName="m3 vs y5"))
plot1.add(Line(x= rates.m3, y=rates.y5, color= c))
plot1.setShowLegend(False)
plot2 = SimpleTimePlot(rates, ["m3", "y1"], showLegend=False, initWidth= 300, initHeight= 400)
plot3 = SimpleTimePlot(rates, ["y5", "y10"], showLegend=False, initWidth= 300, initHeight= 400)
In [ ]:
table = pd.DataFrame({'a' : [1, 2, 1, 5], 'b' : ["a", "ab", "b", "ababa"]})
l = TabbedOutputContainerLayoutManager()
l.setBorderDisplayed(False)
o = OutputContainer()
o.setLayoutManager(l)
o.addItem(plot1, "Scatter with History")
o.addItem(plot2, "Short Term")
o.addItem(plot3, "Long Term")
o.addItem(table, "Pandas Table")
o
In [ ]:
bars = CategoryPlot(initWidth= 300, initHeight= 400)
bars.add(CategoryBars(value= [[1.1, 2.4, 3.8], [1, 3, 4]]))
lg = GridOutputContainerLayoutManager(3)
og = OutputContainer()
og.setLayoutManager(lg)
og.addItem(plot1, "Scatter with History")
og.addItem(plot2, "Short Term")
og.addItem(plot3, "Long Term1")
og.addItem(bars, "Bar Chart")
og.addItem(HTML("<center>some<b>thing</b></center>"))
og.addItem(table, "Pandas Table")
og
In [ ]:
l = CyclingOutputContainerLayoutManager()
l.setPeriod(2345); # milliseconds
l.setBorderDisplayed(False);
o = OutputContainer()
o.setLayoutManager(l)
o.addItem(plot1, "Scatter with History")
o.addItem(plot2, "Short Term")
o.addItem(plot3, "Long Term")
o