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

Function _SeriesFactory

src/pptx/chart/series.py:237–258  ·  view source on GitHub ↗

Return an instance of the appropriate subclass of _BaseSeries based on the xChart element *ser* appears in.

(ser)

Source from the content-addressed store, hash-verified

235
236
237def _SeriesFactory(ser):
238 """
239 Return an instance of the appropriate subclass of _BaseSeries based on the
240 xChart element *ser* appears in.
241 """
242 xChart_tag = ser.getparent().tag
243
244 try:
245 SeriesCls = {
246 qn("c:areaChart"): AreaSeries,
247 qn("c:barChart"): BarSeries,
248 qn("c:bubbleChart"): BubbleSeries,
249 qn("c:doughnutChart"): PieSeries,
250 qn("c:lineChart"): LineSeries,
251 qn("c:pieChart"): PieSeries,
252 qn("c:radarChart"): RadarSeries,
253 qn("c:scatterChart"): XySeries,
254 }[xChart_tag]
255 except KeyError:
256 raise NotImplementedError("series class for %s not yet implemented" % xChart_tag)
257
258 return SeriesCls(ser)

Calls 1

qnFunction · 0.90

Used in the wild real call sites across dependent graphs

searching dependent graphs…