Finally, let's now implement the most important piece of our puzzle, the renderChart method. We will code it together piece by piece as follows:
- First of all, we need to retrieve the selections made by the user in the chart form. We can do so using the view's getChartFormDetails method:
console.log("Rendering the chart"); const chartFormDetails = this._view.getChartFormDetails();
Of course, we need to make sure that there are no errors:
if (chartFormDetails.error) { console.error("Failed to retrieve the chart details", chartFormDetails.error); return; }
- Furthermore, we can also verify that all the properties that we expected are defined and available:
if (!chartFormDetails.countryId || !chartFormDetails.indicator ...