js/script.js
/* Serves as the entry point for this program and sets up all the views and the initially selected data. */
Serves as the entry point for this program and sets up all the views and the initially selected data.
Serves as the entry point for this program and sets up all the views and the initially selected data .
async function main() {
    const cropVisualization = new CropVisualization(2014, new Set(), "Bananas"); 
    const data = loadData().then(data => {
        console.log(data);
        const worldMap = new Map(data, cropVisualization);
        const cropList = new CropList(data, cropVisualization);
        const guidedTours = new GuidedTours(data, cropVisualization);
        const barChart = new BarChart(data, cropVisualization);
        const lineChart = new LineChart(data, cropVisualization);
        const table = new Table(data, cropVisualization);
        d3.json('data/world.json').then(mapData => {
            worldMap.drawMap(mapData);
            cropList.drawCropList();
            guidedTours.drawGuidedTours();
            barChart.drawBarChart();
            lineChart.drawLineChart();
            lineChart.drawYearBar();
            cropList.updateCropOnMap(cropList);
            d3.select("#" + cropVisualization.selected_crop).attr("class", "clickedCropLi");
            for (let country of ["China", "India", "Brazil", "Ecuador", "Philippines", "Indonesia"]) {
                cropVisualization.selected_countries.add(country);
                barChart.updateBarChart();
            }
            lineChart.updateLineChart();
            table.drawTable();
            worldMap.highlightBoundariesOfAllSelectedCountries();
        });
    });
}
async function main ( ) { const cropVisualization = new CropVisualization ( 2014 , new Set ( ) , "Bananas" ) ; const data = loadData ( ) . then ( data => { console . log ( data ) ; const worldMap = new Map ( data , cropVisualization ) ; const cropList = new CropList ( data , cropVisualization ) ; const guidedTours = new GuidedTours ( data , cropVisualization ) ; const barChart = new BarChart ( data , cropVisualization ) ; const lineChart = new LineChart ( data , cropVisualization ) ; const table = new Table ( data , cropVisualization ) ; d3 . json ( 'data/world.json' ) . then ( mapData => { worldMap . drawMap ( mapData ) ; cropList . drawCropList ( ) ; guidedTours . drawGuidedTours ( ) ; barChart . drawBarChart ( ) ; lineChart . drawLineChart ( ) ; lineChart . drawYearBar ( ) ; cropList . updateCropOnMap ( cropList ) ; d3 . select ( "#" + cropVisualization . selected_crop ) . attr ( "class" , "clickedCropLi" ) ; for ( let country of [ "China" , "India" , "Brazil" , "Ecuador" , "Philippines" , "Indonesia" ] ) { cropVisualization . selected_countries . add ( country ) ; barChart . updateBarChart ( ) ; } lineChart . updateLineChart ( ) ; table . drawTable ( ) ; worldMap . highlightBoundariesOfAllSelectedCountries ( ) ; } ) ; } ) ; }
Serves as the entry point for this program and sets up all the views and the initially selected data.
Serves as the entry point for this program and sets up all the views and the initially selected data .
//Default values