@@ -39,10 +39,12 @@ def __init__(self, **kwargs):
3939 self ._url = None
4040 self ._port = None
4141 self ._path = None
42+
4243 self ._options = None
4344 self ._format_ = None
4445 self ._scale = None
4546 self ._width = None
47+ self ._height = None
4648 self ._callback = None
4749 self ._constructor = None
4850 self ._use_base64 = None
@@ -61,12 +63,14 @@ def __init__(self, **kwargs):
6163 '' ))
6264 self .path = kwargs .get ('path' , os .getenv ('HIGHCHARTS_EXPORT_SERVER_PATH' ,
6365 '' ))
66+
6467 self .options = kwargs .get ('options' , None )
6568 self .format_ = kwargs .get ('format_' , kwargs .get ('type' , 'png' ))
6669 self .scale = kwargs .get ('scale' , 1 )
6770 self .width = kwargs .get ('width' , None )
71+ self .height = kwargs .get ('height' , None )
6872 self .callback = kwargs .get ('callback' , None )
69- self .constructor = kwargs .get ('constructor' , 'Chart ' )
73+ self .constructor = kwargs .get ('constructor' , 'chart ' )
7074 self .use_base64 = kwargs .get ('use_base64' , False )
7175 self .no_download = kwargs .get ('no_download' , False )
7276 self .async_rendering = kwargs .get ('async_rendering' , False )
@@ -404,6 +408,28 @@ def width(self, value):
404408
405409 self ._width = value
406410
411+ @property
412+ def height (self ) -> Optional [int | float ]:
413+ """The height that the exported chart should have. Defaults to
414+ :obj:`None <python:None>`.
415+
416+ .. warning::
417+
418+ If explicitly set, this setting will override
419+ :meth:`scale <ExportServer.scale>`.
420+
421+ :rtype: numeric or :obj:`None <python:None>`
422+ """
423+ return self ._height
424+
425+ @height .setter
426+ def height (self , value ):
427+ value = validators .numeric (value , allow_empty = True , minimum = 0 )
428+ if not value :
429+ value = None
430+
431+ self ._height = value
432+
407433 @property
408434 def callback (self ) -> Optional [CallbackFunction ]:
409435 """A JavaScript function to execute in the (JavaScript) Highcharts constructor.
@@ -429,7 +455,13 @@ def constructor(self) -> Optional[str]:
429455 Accepts:
430456
431457 * ``'Chart'``
458+ * ``'chart'``
432459 * ``'Stock'``
460+ * ``'stockChart'``
461+ * ``'Map'``
462+ * ``'mapChart'``
463+ * ``'Gantt'``
464+ * ``'ganttChart'``
433465
434466 :rtype: :class:`str <python:str>` or :obj:`None <python:None>`
435467 """
@@ -441,11 +473,19 @@ def constructor(self, value):
441473 if not value :
442474 self ._constructor = None
443475 else :
444- if value not in ['Chart' , 'Stock' ]:
476+ if value not in ['Chart' , 'Stock' , 'Map' , 'Gantt' , 'chart' , 'stockChart' , 'mapChart' , 'ganttChart' , ]:
445477 raise errors .HighchartsUnsupportedConstructorError (f'constructor expects '
446- f'either "Chart" or '
447- f'"Stock ", but '
478+ f'"Chart", "Stock", "Map", "Gantt", "chart", '
479+ f'"stockChart", "mapChart", or "ganttChart ", but '
448480 f'received: "{ value } "' )
481+ if value == 'Chart' :
482+ value = 'chart'
483+ elif value == 'Stock' :
484+ value = 'stockChart'
485+ elif value == 'Map' :
486+ value = 'mapChart'
487+ elif value == 'Gantt' :
488+ value = 'ganttChart'
449489
450490 self ._constructor = value
451491
@@ -669,7 +709,6 @@ def request_chart(self,
669709 self .no_download = kwargs .get ('no_download' , self .no_download )
670710 self .async_rendering = kwargs .get ('async_rendering' , self .async_rendering )
671711 self .global_options = kwargs .get ('global_options' , self .global_options )
672- self .data_options = kwargs .get ('data_options' , self .data_options )
673712 self .custom_code = kwargs .get ('custom_code' , self .custom_code )
674713
675714 missing_details = []
@@ -701,16 +740,15 @@ def request_chart(self,
701740 'constr' : self .constructor ,
702741 'b64' : self .use_base64 ,
703742 'noDownload' : self .no_download ,
704- 'asyncRendering' : self .async_rendering
705743 }
706744 if self .width :
707745 payload ['width' ] = self .width
746+ if self .height :
747+ payload ['height' ] = self .height
708748 if self .callback :
709749 payload ['callback' ] = 'HIGHCHARTS FOR PYTHON: REPLACE WITH CALLBACK'
710750 if self .global_options :
711751 payload ['globalOptions' ] = 'HIGHCHARTS FOR PYTHON: REPLACE WITH GLOBAL'
712- if self .data_options :
713- payload ['dataOptions' ] = 'HIGHCHARTS FOR PYTHON: REPLACE WITH DATA'
714752 if self .custom_code :
715753 payload ['customCode' ] = 'HIGHCHARTS FOR PYTHON: REPLACE WITH CUSTOM'
716754
0 commit comments