From 9f1f6e2c96467792f145efd79fe58238c63db0d5 Mon Sep 17 00:00:00 2001 From: Chris Modzelewski Date: Thu, 27 Apr 2023 10:44:53 -0400 Subject: [PATCH] Fixed chart.to_js_literal() bug and added more elegant Jupyter error handling. --- CHANGES.rst | 8 ++++++++ highcharts_gantt/__version__.py | 2 +- highcharts_gantt/chart.py | 6 +++--- tests/input_files/chart_obj/01-expected.js | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 0e15897..70aaad2 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,11 @@ +Release 1.1.1 +========================================= + +* **FIXED:** Problem when producing a JS literal, with the JS code inserting an unnecessary ``new``. +* **ENHANCEMENT:** Added more elegant error handling when something goes wrong displaying a chart in Jupyter. + +--------------------- + Release 1.1.0 ========================================= diff --git a/highcharts_gantt/__version__.py b/highcharts_gantt/__version__.py index 1a72d32..b3ddbc4 100644 --- a/highcharts_gantt/__version__.py +++ b/highcharts_gantt/__version__.py @@ -1 +1 @@ -__version__ = '1.1.0' +__version__ = '1.1.1' diff --git a/highcharts_gantt/chart.py b/highcharts_gantt/chart.py index d346434..2f4582a 100644 --- a/highcharts_gantt/chart.py +++ b/highcharts_gantt/chart.py @@ -281,11 +281,11 @@ def to_js_literal(self, callback_as_str = f"""{callback_as_str}""" signature_elements += 1 - signature = """new Highcharts.chart(""" + signature = """Highcharts.chart(""" if self.is_gantt_chart: - signature = """new Highcharts.ganttChart(""" + signature = """Highcharts.ganttChart(""" elif self.is_stock_chart: - signature = """new Highcharts.stockChart(""" + signature = """Highcharts.stockChart(""" if container_as_str: signature += container_as_str if signature_elements > 1: diff --git a/tests/input_files/chart_obj/01-expected.js b/tests/input_files/chart_obj/01-expected.js index 2cfa2ea..568a3cc 100644 --- a/tests/input_files/chart_obj/01-expected.js +++ b/tests/input_files/chart_obj/01-expected.js @@ -1,4 +1,4 @@ -var someVariableName = new Highcharts.stockChart('some-div-id', +var someVariableName = Highcharts.stockChart('some-div-id', { accessibility: { announceNewData: {