Tag Archives: Hide Chart Name

How – To Series 13: How to Hide System Chart or User Chart Name in Dashboard

Hi all,
I have worked on one of the requirement to hide lables of all charts(System or User) in all the dashboards. This requirement has been done more than once for different instances. Thought of sharing so that it will be helpful to someone.         By default, Chart Name and view Name will be shown in every chart when it is displayed in a dashboard as follows:

Inorder to hide the chart lable, I thought of going with the following appraoch
              In Post Stage of chart retrieval, replace the chart name with an empty string.

Pluing Code:

public void Execute(IServiceProvider serviceProvider)

{
// Get the context

IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

// Check the required pre-requisits; if not, exit
if (!(context.MessageName.ToLower() == “retrieve” && (context.PrimaryEntityName.ToLower() == “savedqueryvisualization” || context.PrimaryEntityName.ToLower() == “userqueryvisualization”)))

return;
// Get the chart entity
Entity entity = (Entity)context.OutputParameters[“BusinessEntity”];

//Replace the chart name with empty string.
if (entity.Attributes.Contains(“name”))
entity.Attributes[“name”] = string.Empty;
}

As chart can be either System or User so register the plugin on following two steps:

 

Once plugin is registered, following is the result:

I have also shared the code here
Hope it helps..!!! 🙂

Cheers…
Vikranth