One of the less known features supported by Telerik’s RadChart for Silverlight/WPF is the ability to completely abandon the default control layout and build one of your own with no constraints for the number of elements used. The goal of this blog post is to shed some light on this functionality and to demonstrate the most common techniques that can be used to customize the legend.
First of all, to build your own custom chart layout you should set the UseDefaultLayout property of the RadChart object to false. Here is the custom layout I prepared:
The code above declares a RadChart control with custom grid layout containing a ChartArea populated with two data series and a ChartLegend. There are also two sliders used to precisely position the legend. Following is the result:
By default the ChartLegend uses a vertical StackPanel to arrange its children, Being an ItemsControl, it is extremely easy to replace the Items panel of the legend with any panel fitting your needs. Here I have changed the default items panel with a horizontal one:
And the result is:
There are much more scenarios when you could need to have more control over the visual appearance of the chart legend. For example, one could want to add a ScrollViewer control in order to be able to show large number of chart legend items in a limited space. Here is a legend style which you can use to do this:
These are some of the most frequently requested customizations that can be applied to the chart legend and the chart control itself. We will be glad to hear your comments and recommendations about the ways we can go to make our product more friendly and easy to use.
Copyright © 2016, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.