ASP.NET MVC Controls | ComponentOne
Working with Controls / FlexChart / Work with FlexChart / Legend
In This Topic
    Legend
    In This Topic

    Legend is a chart element which displays a list of colors, symbols and text corresponding to each data series drawn on that chart. It helps in understanding and analysis of the plotted data in the case of multiple series.

    FlexChart automatically places the legend according to the space available on the chart area. However, you can also set it to display at top, bottom, left or right with respect to the plot area by setting the Position property. In addition, you can toggle the visibility of any series by clicking its corresponding legend item using the LegendToggle property. Moreover, FlexChart allows you to set the orientation of the legend using the Legend.Orientation property which accepts values from the LegendOrientation enumeration which provides the following orientations:

    The image below shows how the FlexChart appears after these properties have been set.

    Showing legend in a FlexChart

    Clicking the legend item makes the corresponding series invisible as shown below.

    Toggling legend visibility in a FlexChart

    The following code example demonstrates how to set these properties. This example uses the sample created in the Mixed Charts section.

    Razor
    Copy Code
    .Legend(C1.Web.Mvc.Chart.Position.Top)
    .LegendToggle(true)
    .Legend(C1.Web.Mvc.Chart.LegendOrientation.Auto)