MCPcopy Create free account
hub / github.com/scanny/python-pptx / PlotFactory

Function PlotFactory

src/pptx/chart/plot.py:230–250  ·  view source on GitHub ↗

Return an instance of the appropriate subclass of _BasePlot based on the tagname of *xChart*.

(xChart, chart)

Source from the content-addressed store, hash-verified

228
229
230def PlotFactory(xChart, chart):
231 """
232 Return an instance of the appropriate subclass of _BasePlot based on the
233 tagname of *xChart*.
234 """
235 try:
236 PlotCls = {
237 qn("c:areaChart"): AreaPlot,
238 qn("c:area3DChart"): Area3DPlot,
239 qn("c:barChart"): BarPlot,
240 qn("c:bubbleChart"): BubblePlot,
241 qn("c:doughnutChart"): DoughnutPlot,
242 qn("c:lineChart"): LinePlot,
243 qn("c:pieChart"): PiePlot,
244 qn("c:radarChart"): RadarPlot,
245 qn("c:scatterChart"): XyPlot,
246 }[xChart.tag]
247 except KeyError:
248 raise ValueError("unsupported plot type %s" % xChart.tag)
249
250 return PlotCls(xChart, chart)
251
252
253class PlotTypeInspector(object):

Calls 1

qnFunction · 0.90

Used in the wild real call sites across dependent graphs

searching dependent graphs…