Share via


Create a visualization (chart)

 

Applies To: Dynamics CRM 2015

To create a visualization using the Microsoft Dynamics CRM SDK, you must create a record for the SavedQueryVisualization or UserQueryVisualization entity to create an organization-owned or user-owned chart respectively. This topic shows how to create a chart visualization and a web resource visualization.

In This Topic

Before you create a visualization

Create a chart visualization

Create a web resource visualization

Before you create a visualization

Before creating a visualization, make sure that you are aware of the following:

  • Type of visualization: If you want your visualizations to be available across the organization and don’t want to manage the access levels at a more granular level, you might want to create an organization-owned visualization. However, if you’re concerned about the access privileges and security of your visualization, consider creating a user-owned visualization where you have more control over who can access it.

    Note

    Organization-owned visualizations can only be created by those users who have the System Administrator or System Customizer role.

  • Associated Entity: Visualizations are attached to entities. More information: c2e420e0-66e6-4317-b203-8a0710d0d3f4#SupportedVisualizationEntities. You can attach a chart to a supported entity by using the SavedQueryVisualization.PrimaryEntityTypeCode or UserQueryVisualization.PrimaryEntityTypeCode attribute.

Create a chart visualization

Charts require you to specify the underlying data for the charts and how the charts will look in the form of data description and presentation description XML strings. More information: Understand charts: Underlying data and chart representation and Sample charts.

For a complete sample on how to create an organization-owned chart, see Sample: Create, retrieve, update, and delete a chart.

Create a multi-series chart

Multi-series charts map multiple series (vertical) axis values to a single category (horizontal) axis value. The only difference from a single series chart is that these charts have multiple <measurecollection> and corresponding <series> elements specified in the XML strings. Each <measurecollection> element contains a child element called <measure> that defines a series (vertical) axis value for the same category (horizontal) value. More information: Understand charts: Underlying data and chart representation.

For a sample multi-series chart and the corresponding data description and presentation descriptions XML strings, see b77df80e-664f-47a9-8df0-9433eade2fde#MultiSeriesChart.

Create a web resource visualization

Visualizations containing web resources don’t require you to specify the data description and presentation description XML strings. The following sample demonstrates how to create an organization-owned visualization containing a web resource by using the SDK.

SavedQueryVisualization newWebResourceVisualization = new SavedQueryVisualization()
{
   Name = "Sample Dashboard Visualization",
   Description = "Sample organization-owned visualization",
                           PrimaryEntityTypeCode = Account.EntityLogicalName,
   WebResourceId = new EntityReference(WebResource.EntityLogicalName, _webResourceId))

};
_orgOwnedVisualizationId = _serviceProxy.Create(newWebResourceVisualization);

If you want to create a web resource visualization by using the Microsoft Dynamics CRM web application, you must create an XML file in the following format, and then use Import Chart in the ribbon to import the visualization.

<visualization>
  <name>Visualization_Name</name>
  <description>Description</description>
  <webresourcename>Name_Of_An_Existing_Web_Resource</webresourcename>
  <primaryentitytypecode>Entity_Logical_Name</primaryentitytypecode>
  <isdefault>Value: true or false</isdefault>
</visualization>

For example, to create a Sample Visualization that displays an existing Web resource called new_TestWebResource, and the visualization should be attached to the account entity, the XML should look like.

<visualization>
  <name>Sample Visualization</name>
  <description>Sample Web Resource Visualization.</description>
  <webresourcename>new_TestWebResource</webresourcename>
  <primaryentitytypecode>account</primaryentitytypecode>
  <isdefault>false</isdefault>
</visualization>

See Also

View data with visualizations (charts)
Understand charts: Underlying data and chart representation
Actions on visualizations (charts)
Sample charts
Customize visualizations and dashboards
Sample: Create, retrieve, update, and delete a chart

© 2016 Microsoft. All rights reserved. Copyright