Version

Adding Common Legend

By default, the XamDataChart™ does not display Chart Legends for any series in the chart control. If you want to show a common Legend for multiple Series, you need to add a legend object to your application and then bind it to the Legend property of the XamDataChart control. In addition, you must set the Title property for each Series object or else its corresponding legend item will use a default Series title.

The following example code demonstrates how to add a common Legend for multiple series defined in the XamDataChart control’s Series collection.

In XAML:

<Grid>
    <ig:XamDataChart Legend="{x:Reference Legend}">
        ...
        <ig:XamDataChart.Series>
            <ig:LineSeries Title="Volume Series"/>
            <ig:FinancialPriceSeries Title="Price Series"/>
        </ig:XamDataChart.Series>
    </ig:XamDataChart>
    <ig:Legend x:Name="Legend"
               HorizontalOptions="EndAndExpand"
               VerticalOptions="StartAndExpand">
    </ig:Legend>
</Grid>

The following image shows how the XamDataChart control might look like with a common legend for multiple series.

xamDataChart Common Legend 01.png