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

Class ChartTitle

src/pptx/chart/chart.py:202–254  ·  view source on GitHub ↗

Provides properties for manipulating a chart title.

Source from the content-addressed store, hash-verified

200
201
202class ChartTitle(ElementProxy):
203 """Provides properties for manipulating a chart title."""
204
205 # This shares functionality with AxisTitle, which could be factored out
206 # into a base class, perhaps pptx.chart.shared.BaseTitle. I suspect they
207 # actually differ in certain fuller behaviors, but at present they're
208 # essentially identical.
209
210 def __init__(self, title):
211 super(ChartTitle, self).__init__(title)
212 self._title = title
213
214 @lazyproperty
215 def format(self):
216 """|ChartFormat| object providing access to line and fill formatting.
217
218 Return the |ChartFormat| object providing shape formatting properties
219 for this chart title, such as its line color and fill.
220 """
221 return ChartFormat(self._title)
222
223 @property
224 def has_text_frame(self):
225 """Read/write Boolean specifying whether this title has a text frame.
226
227 Return |True| if this chart title has a text frame, and |False|
228 otherwise. Assigning |True| causes a text frame to be added if not
229 already present. Assigning |False| causes any existing text frame to
230 be removed along with its text and formatting.
231 """
232 if self._title.tx_rich is None:
233 return False
234 return True
235
236 @has_text_frame.setter
237 def has_text_frame(self, value):
238 if bool(value) is False:
239 self._title._remove_tx()
240 return
241 self._title.get_or_add_tx_rich()
242
243 @property
244 def text_frame(self):
245 """|TextFrame| instance for this chart title.
246
247 Return a |TextFrame| instance allowing read/write access to the text
248 of this chart title and its text formatting properties. Accessing this
249 property is destructive in the sense it adds a text frame if one is
250 not present. Use :attr:`has_text_frame` to test for the presence of
251 a text frame non-destructively.
252 """
253 rich = self._title.get_or_add_tx_rich()
254 return TextFrame(rich, self)
255
256
257class _Plots(Sequence):

Callers 5

format_fixtureMethod · 0.90
has_tf_get_fixtureMethod · 0.90
has_tf_set_fixtureMethod · 0.90
text_frame_fixtureMethod · 0.90
chart_titleMethod · 0.85

Calls

no outgoing calls

Tested by 4

format_fixtureMethod · 0.72
has_tf_get_fixtureMethod · 0.72
has_tf_set_fixtureMethod · 0.72
text_frame_fixtureMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…