MCPcopy
hub / github.com/jmcnamara/XlsxWriter / _get_marker_properties

Method _get_marker_properties

xlsxwriter/chart.py:964–1026  ·  view source on GitHub ↗
(self, marker)

Source from the content-addressed store, hash-verified

962 return formula_id
963
964 def _get_marker_properties(self, marker):
965 # Convert user marker properties to the structure required internally.
966
967 if not marker:
968 return None
969
970 # Copy the user defined properties since they will be modified.
971 marker = copy.deepcopy(marker)
972
973 types = {
974 "automatic": "automatic",
975 "none": "none",
976 "square": "square",
977 "diamond": "diamond",
978 "triangle": "triangle",
979 "x": "x",
980 "star": "star",
981 "dot": "dot",
982 "short_dash": "dot",
983 "dash": "dash",
984 "long_dash": "dash",
985 "circle": "circle",
986 "plus": "plus",
987 "picture": "picture",
988 }
989
990 # Check for valid types.
991 marker_type = marker.get("type")
992
993 if marker_type is not None:
994 if marker_type in types:
995 marker["type"] = types[marker_type]
996 else:
997 warn(f"Unknown marker type '{marker_type}")
998 return None
999
1000 # Set the line properties for the marker.
1001 line = Shape._get_line_properties(marker)
1002
1003 # Set the fill properties for the marker.
1004 fill = Shape._get_fill_properties(marker.get("fill"))
1005
1006 # Set the pattern fill properties for the series.
1007 pattern = Shape._get_pattern_properties(marker.get("pattern"))
1008
1009 # Set the gradient fill properties for the series.
1010 gradient = Shape._get_gradient_properties(marker.get("gradient"))
1011
1012 # Pattern fill overrides solid fill.
1013 if pattern:
1014 self.fill = None
1015
1016 # Gradient fill overrides the solid and pattern fill.
1017 if gradient:
1018 pattern = None
1019 fill = None
1020
1021 marker["line"] = line

Callers 1

add_seriesMethod · 0.95

Calls 5

getMethod · 0.80
_get_line_propertiesMethod · 0.80
_get_fill_propertiesMethod · 0.80

Tested by

no test coverage detected