What I know: Shapes in python-pptx have functionality to apply transparency. What I want to do : I want my RADAR Chart to have color and transparency both.
if I apply fill to my RADAR chart there is no more support to transparency feature on the other hand applying 'format.fill.background()' remove solid fill. But I need both color and transparency. The error i get = AttributeError: 'GraphicFrame' object has no attribute 'fill'
Code is given below
#################### Transparency portion ###################
def SubElement(parent, tagname, **kwargs):
element = OxmlElement(tagname)
element.attrib.update(kwargs)
parent.append(element)
return element
def _set_shape_transparency(shape, alpha):
""" Set the transparency (alpha) of a shape"""
ts = shape.fill._xPr.solidFill
sF = ts.get_or_change_to_srgbClr()
sE = SubElement(sF, 'a:alpha', val=str(alpha))
###################################
chart_data = ChartData()
chart_data.categories = '1','2','3','4','5'
Matching_matrix=(4, 5, 5, 4, 4)
chart_data.add_series('', Matching_matrix)
x, y, cx, cy = Inches(6.6), Inches(4.8), Inches(2.3), Inches(2.3)
graphic_frame = shapes.add_chart(
XL_CHART_TYPE.RADAR_FILLED, x, y, cx, cy, chart_data
)
chart=graphic_frame.chart
chart_format=chart.plots[0].series[0].format
chart_fill=chart_format.fill
chart_fill.solid()
blueBoxFillColour = chart_fill.fore_color
blueBoxFillColour.rgb = RGBColor(0,176,240)
chart_font=chart.font
chart_font.size=Pt(10)
_set_shape_transparency(graphic_frame,1000)
'''