Skip to content

Commit 76509c6

Browse files
authored
Merge pull request #45 from highcharts-for-python/develop
PR for v.1.1.1
2 parents cccef44 + cc197bf commit 76509c6

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
Release 1.1.1
2+
=========================================
3+
4+
* **FIXED:** Problem when producing a JS literal, with the JS code inserting an unnecessary ``new`` (#42 and #43).
5+
* **ENHANCEMENT:** Added more elegant error handling when something goes wrong displaying a chart in Jupyter (#43).
6+
17
Release 1.1.0
28
=========================================
39

highcharts_core/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.1.0'
1+
__version__ = '1.1.1'

highcharts_core/chart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def to_js_literal(self,
330330
callback_as_str = f"""{callback_as_str}"""
331331
signature_elements += 1
332332

333-
signature = """new Highcharts.chart("""
333+
signature = """Highcharts.chart("""
334334
signature += container_as_str
335335
if signature_elements > 1:
336336
signature += ',\n'

highcharts_core/utility_functions.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,20 +406,29 @@ def get_retryHighcharts():
406406
fn()
407407
return resolve();
408408
} catch (err) {
409-
if ((err instanceof ReferenceError) || (err instanceof TypeError) || ((err instanceof Error) && (err.message.includes('#13')))) {
409+
if ((err instanceof ReferenceError) || (err instanceof TypeError)) {
410410
if (retriesLeft === 0) {
411411
var target_div = document.getElementById(container);
412412
if (target_div) {
413413
var timeElapsed = (retries * interval) / 1000;
414-
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>";
414+
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.)";
415+
var errorHTML = "<p>" + errorMessage + "</p>";
415416
target_div.innerHTML = errorMessage;
417+
console.log(errorMessage);
418+
console.error(err);
416419
}
417420
return reject();
418421
}
419422
420423
setTimeout(() => {
421424
retryHighcharts(fn, container, retries, retriesLeft - 1, interval).then(resolve).catch(reject);
422425
}, interval);
426+
} else if ((err instanceof Error) && (err.message.includes('#13'))) {
427+
var errorMessage = "It looks like the container specified \'" + container + "\' was not created successfully. Please check your browser\'s console log for more details.";
428+
console.error(errorMessage);
429+
console.error(err);
430+
431+
return reject();
423432
} else {
424433
throw err;
425434
}

tests/input_files/chart_obj/01-expected.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var someVariableName = new Highcharts.chart('some-div-id',
1+
var someVariableName = Highcharts.chart('some-div-id',
22
{
33
accessibility: {
44
announceNewData: {

0 commit comments

Comments
 (0)