1010from highcharts_core .utility_classes .patterns import Pattern
1111from highcharts_core .utility_classes .data_grouping import DataGroupingOptions
1212from highcharts_core .utility_classes .partial_fill import PartialFillOptions
13+ from highcharts_core .utility_classes .border_radius import BorderRadius
1314
1415
1516class BaseBarOptions (SeriesOptions ):
@@ -61,7 +62,7 @@ def border_color(self, value):
6162 self ._border_color = utility_functions .validate_color (value )
6263
6364 @property
64- def border_radius (self ) -> Optional [int | float | Decimal ]:
65+ def border_radius (self ) -> Optional [int | float | Decimal | str | BorderRadius ]:
6566 """The corner radius of the border surrounding each column or bar. Defaults to
6667 ``0``.
6768
@@ -71,9 +72,28 @@ def border_radius(self) -> Optional[int | float | Decimal]:
7172
7273 @border_radius .setter
7374 def border_radius (self , value ):
74- self ._border_radius = validators .numeric (value ,
75- allow_empty = True ,
76- minimum = 0 )
75+ if value is None :
76+ self ._border_radius = None
77+ else :
78+ try :
79+ self ._border_radius = validators .numeric (value ,
80+ allow_empty = True ,
81+ minimum = 0 )
82+ except (ValueError , TypeError ):
83+ try :
84+ self ._border_radius = validate_types (value , BorderRadius )
85+ except (ValueError , TypeError ):
86+ if not isinstance (value , str ):
87+ raise errors .HighchartsValueError (f'border_radius must be a numeric value, '
88+ f'a string, or an instance of BorderRadius. '
89+ f'Received { value .__class__ .__name__ } .' )
90+ if not value .endswith (('%' , 'px' , 'em' )):
91+ raise errors .HighchartsValueError (f'border_radius must be a numeric value, '
92+ f'a percentage string, a pixel measurement, '
93+ f'or an instance of BorderRadius. '
94+ f'Received: "{ value } ".' )
95+
96+ self ._border_radius = value
7797
7898 @property
7999 def border_width (self ) -> Optional [int | float | Decimal ]:
0 commit comments