Skip to content

Commit

Permalink
Merge pull request #45 from highcharts-for-python/develop
Browse files Browse the repository at this point in the history
PR for v.1.1.1
  • Loading branch information
hcpchris authored Apr 27, 2023
2 parents cccef44 + cc197bf commit 76509c6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Release 1.1.1
=========================================

* **FIXED:** Problem when producing a JS literal, with the JS code inserting an unnecessary ``new`` (#42 and #43).
* **ENHANCEMENT:** Added more elegant error handling when something goes wrong displaying a chart in Jupyter (#43).

Release 1.1.0
=========================================

Expand Down
2 changes: 1 addition & 1 deletion highcharts_core/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.1.0'
__version__ = '1.1.1'
2 changes: 1 addition & 1 deletion highcharts_core/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def to_js_literal(self,
callback_as_str = f"""{callback_as_str}"""
signature_elements += 1

signature = """new Highcharts.chart("""
signature = """Highcharts.chart("""
signature += container_as_str
if signature_elements > 1:
signature += ',\n'
Expand Down
13 changes: 11 additions & 2 deletions highcharts_core/utility_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,20 +406,29 @@ def get_retryHighcharts():
fn()
return resolve();
} catch (err) {
if ((err instanceof ReferenceError) || (err instanceof TypeError) || ((err instanceof Error) && (err.message.includes('#13')))) {
if ((err instanceof ReferenceError) || (err instanceof TypeError)) {
if (retriesLeft === 0) {
var target_div = document.getElementById(container);
if (target_div) {
var timeElapsed = (retries * interval) / 1000;
var errorMessage = "<p>Something went wrong with the Highcharts.js script. It should have been automatically loaded, but it did not load for over " + timeElapsed + " seconds. Check your internet connection, and then if the problem persists please reach out for support.</p>";
var errorMessage = "Something went wrong with the Highcharts.js script. It should have been automatically loaded, but it did not load for over " + timeElapsed + " seconds. Check your internet connection, and then if the problem persists please reach out for support. (You can also check your browser's console log for more details.)";
var errorHTML = "<p>" + errorMessage + "</p>";
target_div.innerHTML = errorMessage;
console.log(errorMessage);
console.error(err);
}
return reject();
}
setTimeout(() => {
retryHighcharts(fn, container, retries, retriesLeft - 1, interval).then(resolve).catch(reject);
}, interval);
} else if ((err instanceof Error) && (err.message.includes('#13'))) {
var errorMessage = "It looks like the container specified \'" + container + "\' was not created successfully. Please check your browser\'s console log for more details.";
console.error(errorMessage);
console.error(err);
return reject();
} else {
throw err;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/input_files/chart_obj/01-expected.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var someVariableName = new Highcharts.chart('some-div-id',
var someVariableName = Highcharts.chart('some-div-id',
{
accessibility: {
announceNewData: {
Expand Down

0 comments on commit 76509c6

Please sign in to comment.