Skip to content

Commit

Permalink
Fix disappearing region charts
Browse files Browse the repository at this point in the history
  • Loading branch information
henhuy committed May 7, 2024
1 parent a535d46 commit e888076
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"createChart": false,
"clearChart": false,
"hidePotentialLayers": false,
"URLSearchParams": false
"URLSearchParams": false,
"preResultCharts": false
},
"strict": "implied"
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ and this project tries to adhere to [Semantic Versioning](https://semver.org/spe
- show potential layers if detail panel is open when revisiting settings menu
- popups for distilled layers
- charts for popups
- disappearing region charts

## [0.1.0] - 2024-03-19
### Added
Expand Down
3 changes: 2 additions & 1 deletion digiplan/static/js/charts.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* jshint ignore:start */
const preResultCharts = {
wind_capacity: "wind_capacity_chart",
wind_areas: "wind_areas_chart",
Expand All @@ -6,6 +7,7 @@ const preResultCharts = {
pv_roof_capacity: "pv_roof_capacity_chart",
pv_roof_areas: "pv_roof_areas_chart",
};
/* jshint ignore:end */

// Onboarding Charts
const onboarding_wind_div = document.getElementById("onboarding_wind_chart");
Expand Down Expand Up @@ -57,7 +59,6 @@ document.addEventListener("show.bs.tab", resizeCharts);

function createChart(div_id, options) {
const chartElement = document.getElementById(div_id);
chartElement.innerHTML = "";
let chart;
if (echarts.getInstanceByDom(chartElement)) {
chart = echarts.getInstanceByDom(chartElement);
Expand Down
7 changes: 7 additions & 0 deletions digiplan/static/js/results.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,13 @@ function showCharts(charts = {}) {
success: function (chart_options) {
for (const chart in charts) {
createChart(charts[chart], chart_options[chart]);
// Remove skeleton placeholder if it exists
const skeleton = document
.getElementById(charts[chart])
.querySelector(".skeleton");
if (skeleton !== null) {
skeleton.remove();
}
}
},
});
Expand Down

0 comments on commit e888076

Please sign in to comment.