A service class providing access to formatting of axis tick mark labels.
| 337 | |
| 338 | |
| 339 | class TickLabels(object): |
| 340 | """A service class providing access to formatting of axis tick mark labels.""" |
| 341 | |
| 342 | def __init__(self, xAx_elm): |
| 343 | super(TickLabels, self).__init__() |
| 344 | self._element = xAx_elm |
| 345 | |
| 346 | @lazyproperty |
| 347 | def font(self): |
| 348 | """ |
| 349 | The |Font| object that provides access to the text properties for |
| 350 | these tick labels, such as bold, italic, etc. |
| 351 | """ |
| 352 | defRPr = self._element.defRPr |
| 353 | font = Font(defRPr) |
| 354 | return font |
| 355 | |
| 356 | @property |
| 357 | def number_format(self): |
| 358 | """ |
| 359 | Read/write string (e.g. "$#,##0.00") specifying the format for the |
| 360 | numbers on this axis. The syntax for these strings is the same as it |
| 361 | appears in the PowerPoint or Excel UI. Returns 'General' if no number |
| 362 | format has been set. Note that this format string has no effect on |
| 363 | rendered tick labels when :meth:`number_format_is_linked` is |True|. |
| 364 | Assigning a format string to this property automatically sets |
| 365 | :meth:`number_format_is_linked` to |False|. |
| 366 | """ |
| 367 | numFmt = self._element.numFmt |
| 368 | if numFmt is None: |
| 369 | return "General" |
| 370 | return numFmt.formatCode |
| 371 | |
| 372 | @number_format.setter |
| 373 | def number_format(self, value): |
| 374 | numFmt = self._element.get_or_add_numFmt() |
| 375 | numFmt.formatCode = value |
| 376 | self.number_format_is_linked = False |
| 377 | |
| 378 | @property |
| 379 | def number_format_is_linked(self): |
| 380 | """ |
| 381 | Read/write boolean specifying whether number formatting should be |
| 382 | taken from the source spreadsheet rather than the value of |
| 383 | :meth:`number_format`. |
| 384 | """ |
| 385 | numFmt = self._element.numFmt |
| 386 | if numFmt is None: |
| 387 | return False |
| 388 | souceLinked = numFmt.sourceLinked |
| 389 | if souceLinked is None: |
| 390 | return True |
| 391 | return numFmt.sourceLinked |
| 392 | |
| 393 | @number_format_is_linked.setter |
| 394 | def number_format_is_linked(self, value): |
| 395 | numFmt = self._element.get_or_add_numFmt() |
| 396 | numFmt.sourceLinked = value |
no outgoing calls
searching dependent graphs…