Version

Configuring the RevealView Object

Overview

The RevealView component can be instantiated while passing the RevealSettings object as a parameter.

The RevealSettings object can be used to enable or disable different features towards the end user, including:

  • Showing/Hiding UI Elements - The ShowFilters property is read by RevealView during initialization time and based on its value either shows or hides the Global Filters UI to the user. Other similar properties are ShowExportButton, CanEdit, ShowChangeDataSource,and MaximizedVisualization.

  • Specifying a Dashboard - The Dashboard property is used to specify which dashboard should be rendered. As shown in Loading Dashboard Files, the dashboard must be retrieved by using the RevealUtility.LoadDashboard method, which receives a Stream and returns the dashboard object (instance of the RVDashboard class).

  • Selecting Global Filter values - You can specify which values are initially selected for existing Global Filters when loading a dashboard.

Code

The following code snippet shows how to load a dashboard and sets the “Territory” selected value to be “Americas”, thus the dashboard will be showing data filtered by “Americas”

var revealView = new RevealView();
using (var fileStream = File.OpenRead(path))
{
    var dashboard = await RevealUtility.LoadDashboard(fileStream);
    var territoryFilter = dashboard.GetFilterByTitle("Territory");
    var settings = new RevealSettings(dashboard);
    settings.SetFilterSelectedValues(territoryFilter, new List<object>() { "Americas" });
    revealView.Settings = settings;
}

About Timing

RevealView applies RevealSettings during initialization time, which is a particular time before the dashboard is displayed on screen. This has several implications:

  • If you change the settings object after the dashboard is rendered, it will not affect the already loaded dashboard.

  • You can, however, change the selected values for dashboard filters after the view was created. To do that you need to use the setFilterSelectedValues method in the RevealView object.

  • Any change for properties in the RevealSettings object (like CanEdit, CanSaveAs, etc) requires the creation of a new instance of RevealView.