Create a Visualization (Chart)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Find the latest SDK documentation: CRM 2015 SDK

To create a visualization (chart), you create an instance of the savedqueryvisualization class. You must have the System Administrator or System Customizer role in Microsoft Dynamics CRM to create a chart. To create a chart, you must supply values for the following properties: name, savedqueryid, datadescription, and presentationdescription. The savedqueryid property enables you to associate a chart with a saved query. You must have the Append To privilege on the saved query to successfully attach a chart to it. The datadescription and presentationdescription properties enable you to specify XML strings that define the data to display and how to display the data. These two properties can be validated with the following XML schemas: the data description schema and the presentation schema.

When you create an instance of the savedqueryvisualization class, the system validates the data description and presentation schemas to check whether the data in these schemas complies with the respective schema definitions. The system also checks for consistency between the data description and presentation schemas to make sure that the data fetched by the data description schema can be rendered by the presentation schema.

To view sample data description and presentation schemas for different chart types in Microsoft Dynamics CRM Online, see Visualization (Chart) Samples.

Data Description

The data description schema contains mapping information about the data to be displayed in the chart such as the attribute name and aggregate function. The data description schema contains the following elements.

Element Description
FetchCollection The FetchCollection element uses FetchXML to retrieve data for the chart. The element contains information about the aggregate functions and the group by clause. For more information about FetchXML, see Using FetchXML. If the chart is a comparison chart, this element will contain two group by clauses. Each FetchCollection element maps to a CategoryCollection element.

The visualization data description schema does not validate the query specified as FetchXML in the FetchCollection element. The validation is performed as per the FetchXML schema. For more information, see FetchXML Schema.

CategoryCollection The CategoryCollection element contains information about the category (X) and series (Y) axes. The CategoryCollection element has a subelement called Category that maps to the group by clause specified in the FetchCollection element. The group by clause for an attribute is displayed on the X-axis of the chart.

Each Category subelement has a child element called MeasureCollection that maps to the Series element in the presentation XML. The MeasureCollection element specifies the series information about a chart such as a bar representation or a line representation of the values. A single series chart has a single MeasureCollection child element inside the category subelement whereas a multi-series chart will have multiple MeasureCollection child elements (each mapped to the respective Series element in the presentation XML) inside the Category subelement.

Each MeasureCollection child element has an element called Measure that corresponds to the Y-axis value for a series that corresponds to each X-axis value.

For detailed information about the data description schema, see Visualization (Chart) Data Description Schema.

Presentation Description

The presentation schema contains information about the appearance of the chart such as chart title, chart color, and chart type. There is no XSD available for this XML string. However, the XML is a serialization of the Chart class in the .NET Chart Controls. For more information about the presentation schema and a complete programming reference for the Chart class, see Chart Controls for .NET Framework Documentation.

See Also

Concepts

Reference

Other Resources

© 2010 Microsoft Corporation. All rights reserved.