diff --git a/CHANGELOG.md b/CHANGELOG.md index 5999d0d91..139c8ec9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Unusual Draw in Chess Activity #1678 - Pressing the start button in ColorMyWorld activity immediately shows "Congratulations! You finished!" #1691 - Broken dialog box on first screen tutorial #1418 +- Sample values in Chart activity are not initialized #1695 ## [1.8.0] - 2024-04-10 ### Added diff --git a/activities/Chart.activity/js/activity.js b/activities/Chart.activity/js/activity.js index be30e2592..3a524dfe1 100644 --- a/activities/Chart.activity/js/activity.js +++ b/activities/Chart.activity/js/activity.js @@ -22,6 +22,8 @@ const app = new Vue({ "csv-view": CsvView, }, data: { + isLocalized: false, + pendingNewInstance: false, currentenv: null, SugarL10n: null, SugarPresence: null, @@ -145,9 +147,15 @@ const app = new Vue({ }); }, localized() { + this.isLocalized = true; this.SugarL10n.localize(this.l10n); document.getElementById("export-csv-button").title = this.l10n.stringexportAsCSV; document.getElementById("export-img-button").title = this.l10n.stringSaveImage; + // If onJournalNewInstance was triggered before localization + if (this.pendingNewInstance) { + this.onJournalNewInstance(); // Execute the pending call + this.pendingNewInstance = false; + } }, @@ -270,6 +278,10 @@ const app = new Vue({ onJournalNewInstance() { + if (!this.isLocalized) { + this.pendingNewInstance = true; // Mark the call as pending + return; + } const randArr = this.shuffleArray([1, 2, 3, 4, 5, 6]); for(let i = 0; i < 3; i++) { const label = "EgLabel" + randArr[i];