Changing Text Color of Chart title, x-axsi, and y-axis

61 views
Skip to first unread message

Francis Finnegan

unread,
Jun 24, 2024, 4:34:31 PM (12 days ago) Jun 24
to openpyxl-users
Does anyone know how to change the color of a charts title, x-axis, and y-axis? I've been hunting around for a while, and diving deep into the source code, but cannot find anything on it.

Charlie Clark

unread,
Jun 25, 2024, 3:52:26 AM (11 days ago) Jun 25
to openpyxl-users

The best thing to do is to use Excel to create what you want and look at the XML of the chart. Openpyxl lets you use most of this, though for the sake of simplicity the API is not 1:1 that of the specification.

Axes are odd things. You probably want to look at spPr and txPr in EG_AxShared. If you can find what you need, you can use the fromstring() trick to copy some existing rather than creating manually, element for element.

Charlie

--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Sengelsweg 34
Düsseldorf
D- 40489
Tel: +49-203-3925-0390
Mobile: +49-178-782-6226

Reply all
Reply to author
Forward
0 new messages