Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

LegendVerticalAlignment Enum

Lists values that specify the legend’s vertical alignment.

Namespace: DevExpress.XtraTreeMap

Assembly: DevExpress.XtraTreeMap.v24.2.dll

NuGet Package: DevExpress.TreeMap

#Declaration

public enum LegendVerticalAlignment

#Members

Name Description Image
TopOutside

The legend is positioned above the chart.

Legend vertical alignment - TopOutside

Top

The legend’s top edge is aligned with the chart’s top edge.

Legend vertical alignment - Top

Center

Centers a legend vertically in the chart.

Legend vertical alignment - Center

Bottom

The legend’s bottom edge is aligned with the chart’s bottom edge.

Legend vertical alignment - Bottom

BottomOutside

The legend is positioned below the chart’s bottom edge.

Legend vertical alignment - BottomOutside

#Related API Members

The following properties accept/return LegendVerticalAlignment values:

#Example

#How to Add a Legend to a Treemap

This example adds a legend to a treemap and configures its title, border, and text settings.

Treemap legend

using DevExpress.XtraTreeMap;
using System;
using System.Drawing;
using System.Windows.Forms;
//...
    private void Form1_Load(object sender, EventArgs e) {
        //...

        // Create a legend.
        ColorListLegend legend = new ColorListLegend();

        // Specify the legend title, and the title's color and font.
        legend.Title.Text = "Field of Activity";
        legend.Title.TextColor = Color.Black;
        legend.Title.DXFont = new DXFont("Tahoma", 10);

        // Define the color for legend items.
        legend.TextColor = Color.Black;

        // Set the offset beween an item's marker and text.
        legend.TextOffset = 16;

        // Specify the legend alignment and position.
        legend.Direction = LegendDirection.LeftToRight;
        legend.HorizontalAlignment = LegendHorizontalAlignment.Center;
        legend.VerticalAlignment = LegendVerticalAlignment.BottomOutside;

        // Define whether to arrange items in left-aligned columns.
        legend.EquallySpacedItems = true;

        // Configure the border color and width.
        legend.BorderColor = Color.LightGray;
        legend.BorderWidth = 1;

        // Assign the legend to the treemap.
        treeMapControl1.Legend = legend;
    }
See Also