Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Collapse]Spreadsheet
   [Expand]Product Information
    Product Structure
    Getting Started
   [Expand]Spreadsheet Document
    Supported Formats
   [Expand]Cell Basics
   [Expand]Spreadsheet Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
    Data Grouping
   [Expand]Pivot Table Overview
   [Expand]Charting Overview
    Printing
    Events
   [Expand]Mail Merge Overview
    Protection
    Find and Replace
   [Expand]Visual Elements
    Services
   [Expand]Shortcuts
   [Collapse]Examples
    [Expand]Files
    [Expand]Workbooks
    [Expand]Worksheets
    [Expand]Rows and Columns
    [Expand]Cells
    [Expand]Formulas
    [Expand]Import and Export Data
    [Expand]Data Binding
    [Expand]Mail Merge
    [Expand]Formatting Cells
    [Expand]Conditional Formatting
    [Expand]Group Data
    [Expand]Filter Data
    [Expand]Tables
    [Expand]Pivot Tables
    [Expand]Printing
    [Expand]Pictures
    [Collapse]Charts
      How to: Create a Basic Chart
      How to: Format Chart Elements
      How to: Display the Chart Title
      How to: Display and Format Data Labels
      How to: Show or Hide the Chart Legend
      How to: Change the Display of Chart Axes
      How to: Protect a Chart
      How to: Create a Chart Sheet
      How to: Move a Chart to a Chart Sheet
      How to: Specify Chart Sheet Print Options
      How to: Remove a Chart Sheet
      How to: Protect a Chart Sheet
    [Expand]Protection
    [Expand]Customization
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Show or Hide the Chart Legend

After you create a chart, its legend appears by default. A chart legend is a box that identifies data series displayed on a chart. In most cases, the legend displays series names, but in a pie or doughnut chart it shows data points of a single series. The legend also adds a sample of the line style, color and fill pattern used to draw the series on the chart.

The chart legend is defined by the Legend object, which can be accessed by utilizing the ChartObject.Legend property. To specify the legend placement, use the Legend.Position property. By default, the legend does not overlap the chart. However, to save space in the chart, you can turn this option off by setting the Legend.Overlay property to true. To remove the legend completely, set the Legend.Visible property to false.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5222.

Expanded Change a Legend Entry

You can also modify the individual legend entries by utilizing the Legend.CustomEntries property, which provides access to the collection of customized legend entries (LegendEntryCollection). For example, to hide a legend entry, add a LegendEntry instance to the collection with the index set to the index of the selected entry. Next, set the LegendEntry.Hidden property to true. You can also change the font attributes of an individual entry by utilizing the LegendEntry.Font property.

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E5222.

The example below demonstrates how to remove the required entries from the chart legend by utilizing the Legend.CustomEntries property.

Expanded See Also

How would you rate this topic?​​​​​​​