
If you want to generate an image of a dashboard or a particular visualization and export it, you can:
use the export setting in the $.ig.RevealView or
initiate export programmatically outside of the $.ig.RevealView.
You need to enable the export image functionality in the server-side. To do this, please refer to Enabling server-side screenshot generation.
To enable your end users to generate an image of a dashboard or a particular visualization you simply need to set the $.ig.RevealSettings.showExportImage to true when loading the dashboard. This will make the Export button available in the overflow menu when a dashboard is opened or a particular visualization is maximized.
When the user clicks the Export button, the Export image dialog will open. The user can choose between two options here: Copy to clipboard and Export Image. If they click the Export Image button on the bottom right, the RevealView calls the onImageExported callback.
Here’s a sample implementation of the onImageExported callback:
$.ig.revealView.onImageExported = function (img) {
var body = window.open("about:blank").document.body;
body.appendChild(img);
}
To get an image of the $.ig.RevealView programmatically, you will need to invoke the ToImage method. Calling this method will not result in showing the Export Image dialog. This way, you can get a screenshot when the user clicks a button, which is outside of the $.ig.RevealView. This method will create a screenshot of the RevealView component as it is displayed on the screen.
Keep in mind that if the end user has any dialog opened at the time of the ToImage method call, the dialog will be screen-shotted together with the dashboard.