Return an instance of the appropriate subclass of _BasePlot based on the tagname of *xChart*.
(xChart, chart)
| 228 | |
| 229 | |
| 230 | def 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 | |
| 253 | class PlotTypeInspector(object): |
searching dependent graphs…