Developers configure the measures and dimensions displayed in charts by setting the role property to the desired value per chart type. Additional definitions apply to all chart types.
You can use the same annotation file with different qualifiers to present charts with different chart views. You do this by specifying different qualifiers in the annotation file for each card. The following sections of the annotation file apply to all chart types:
UI.SelectionVariant.SelectOptions: You can specify the filter values that are applied to the card, which are applied when retrieving the card data.
UI.PresentationVariant.SortOrder: You can specify the sort order to be used.
UI.Chart.MeasureAttributes.Measure annotation: Defines the measures used in the chart.
UI.Chart.MeasureAttributes.Role annotation: the manner in which a measure is used within the chart. This is configured differently for each chart type, as described below.
UI.Chart.DimensionAttributes.Dimension annotation: the dimensions used in the chart.
UI.Chart.DimensionAttributes.Role annotation: the manner in which a dimension is used within the chart.This is configured differently for each chart type, as described below.
This section describes line, donut, bubble, column, stacked column, and vertical bullet charts.
The value assigned to the role property for dimensions and measures in the annotation file determines the visualization of the chart. For dimensions, you can set the role to category or series. If no value is specified, it's defaulted to category.
For measures, you can set the role to values:: axis1, axis2 or axis3. If no value is specified, it's defaulted to axis1. The actual interpretation of the role value specified in the annotation file varies according to the chart type used, as detailed in the following section.
Line Chart
Donut Chart
Donut charts require exactly one measure. You can provide more than one dimension, in which case they are stacked so that the sections of the chart represent the combination of both dimensions. For example, if you define "Sales" as your measure, and provide two dimensions: "Year" and "Country", the chart will display the sales data of each combination of year and country as a separate colored section.
Bubble Chart
Following is a code snippet which demonstrates defining a bubble chart card. Note that there are three measures (under the MeasureAttributes property) and one dimension (under the DimensionAttributes property).
<Annotation Term="UI.Chart" Qualifier="Qualifier_ID_1"> <Record Type="UI.ChartDefinitionType"> <PropertyValue Property="Title" String="View1" /> <PropertyValue Property="ChartType" EnumMember="UI.ChartType/Bubble"/> <PropertyValue Property="MeasureAttributes"> <Collection> <Record Type="UI.ChartMeasureAttributeType"> <PropertyValue Property="Measure" PropertyPath="SalesShare" /> <PropertyValue Property="Role" EnumMember="UI.ChartMeasureRoleType/Axis1" /> </Record> <Record Type="UI.ChartMeasureAttributeType"> <PropertyValue Property="Measure" PropertyPath="TotalSales" /> <PropertyValue Property="Role" EnumMember="UI.ChartMeasureRoleType/Axis2" /> </Record> <Record Type="UI.ChartMeasureAttributeType"> <PropertyValue Property="Measure" PropertyPath="Sales" /> <PropertyValue Property="Role" EnumMember="UI.ChartMeasureRoleType/Axis3" /> </Record> </Collection> </PropertyValue> <PropertyValue Property="DimensionAttributes"> <Collection> <Record Type="UI.ChartDimensionAttributeType"> <PropertyValue Property="Dimension" PropertyPath="Product" /> <PropertyValue Property="Role" EnumMember="UI.ChartDimensionRoleType/Series" /> </Record> </Collection> </PropertyValue> </Record> </Annotation>
Column Chart
Column charts require at least one measure and one dimension. Irrespective of the role defined for the measure in the annotation file, every measure will be represented as a separate column. Similarly, irrespective of the role defined in the annotation file, every dimension will be added to the category axis (x-axis).
Stacked Column Chart
A stacked column chart is similar to the column chart; however, all measures irrespective of role, get stacked on top of each other. There should be at least one dimension with the assigned role category and all dimensions with this role would be added to the category axis (x-axis). All dimensions with role series also get stacked. It's recommended to either stack based on dimensions or measures, but not mix both in a single chart card.
Vertical Bullet Chart
Vertical bullet charts accept at least one measure and one dimension. All dimensions irrespective of their role will be assigned to the category axis. All measures with role axis1 would be represented as solid colored columns, which represent actual values. All measures with role axis2 would be represented as a solid black line, which represents the target value.