Closed boloyz closed 10 months ago
Are you able to do that by hand in PowerPoint?
and have you tried Axis.visible = False
?
and have you tried
Axis.visible = False
?
Yes, I 've already tried,when I added Axis.visible = False
, the value axis was not visible,but the value axis's tick_labels was not visable too, I want the value axis only display tick_labels, the line to be hidden. like these screenshots
There is separate ChartFormat
object for the axis and the MajorGridlines
aspects of the chart. It could be that setting the line format for the former to None or whatever the "no-line" value is would turn it off, have you tried that? If it turns all the lines off than maybe MajorGridlines.format.line
can turn it back on for the gridlines.
At this point I would inspect the XML for a chart that looks the way you want and see how it compares with what you produce with python-pptx
so far and then work out how to match them using some aspect of the API. I vaguely remember having done this at least once though.
Thank you for your reply , I tried two tests,
If you look into ChartFormat
here (which is what axis.format
is: https://python-pptx.readthedocs.io/en/latest/api/dml.html#pptx.dml.chtfmt.ChartFormat
you can see it has line and fill attributes.
You can try some things there, drilling down into format.line
, like maybe format.line.width = 0
or format.line.fill = None
and see if you can achieve what you're looking for.
Use the API docs to understand what you're working with and explore what capabilities are there. You don't have to rely on someone having done it before to give you a recipe :)
Thank you for your patient guidance. I was negligent in checking the document. My problem has been solved
chart.value_axis.format.line.color.rgb = RGBColor(255,255,255)
The value_axis line is white, when I run above code, but I want to set the value axis to hide,and I want to display the tick_labels in value_axis. how can do it?