How to create popup in magento 2?

In Magento 2 We can simply call modal popup using default modal.js library.
Create phtml(template) file,

In above Template file we can show popup based on click on chart link. When click on chart link defined in our DOM element popup modal will be displayed.

CallĀ Magento_Ui/js/modal/modal object in your require dependency.

There are many default options are available for modal.js file.
Different types of optios you can pass as per your requirement in above options object.
List of default options for modal popup, if you want to override default value set options value in your custom template in options object.


How to Create a CSV File to Download using Magento 2?

In Magento 2 Native, One php class \Magento\Framework\App\Response\Http\FileFactory is used for create csv and download CSV by magento way. create() function in FileFactory.php is used for create CSV file.
There are many another way to download CSV file using Core PHP script but its not best way to use within Magento Coding standard.
You can write CSV and download a CSV file using just simple below code snippet in your controller file,

When you run controller action you can download CSV file using just Magento straight forward way.
Using the above way you can download CSV file using Magento 2 Way.